Moti Asayag has uploaded a new change for review.

Change subject: engine: Allow vlan to serve as a migration network
......................................................................

engine: Allow vlan to serve as a migration network

In order for a nic device to be entitled to serve as the
underlying interface for a migration network, it should
be UP. The nics statuses are reported by the getVdsStats
verb of VDSM which doesn't report it for vlan devices.
Therefore, until the statistics will be collected for vlans,
we'll allow migration to go over the vlan if its underlying
nic is UP.

Change-Id: Icdfcca442d40d8f2c3b6b28dc9f520e286b7e8f2
Bug-Url: https://bugzilla.redhat.com/1014013
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
1 file changed, 15 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/20039/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
index a837388..fcb70b4 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
@@ -30,6 +30,7 @@
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+import org.ovirt.engine.core.utils.NetworkUtils;
 
 @LockIdNameAttribute(isReleaseAtEndOfExecute = false)
 public class MigrateVmCommand<T extends MigrateVmParameters> extends 
RunVmCommandBase<T> {
@@ -212,8 +213,7 @@
                 getDbFacade().getInterfaceDao().getAllInterfacesForVds(hostId);
 
         for (VdsNetworkInterface nic : nics) {
-            if (nic.getStatistics().getStatus() == InterfaceStatus.UP
-                    && migrationNetworkName.equals(nic.getNetworkName())) {
+            if (migrationNetworkName.equals(nic.getNetworkName()) && 
isMigrationInterfaceUp(nic, nics)) {
                 return nic.getAddress();
             }
         }
@@ -221,6 +221,19 @@
         return null;
     }
 
+    protected boolean isMigrationInterfaceUp(VdsNetworkInterface nic, 
List<VdsNetworkInterface> nics) {
+        if (nic.getVlanId() != null) {
+            String physicalNic = NetworkUtils.stripVlan(nic.getName());
+            for (VdsNetworkInterface iface : nics) {
+                if (iface.equals(physicalNic)) {
+                    return iface.getStatistics().getStatus() == 
InterfaceStatus.UP;
+                }
+            }
+        }
+
+        return nic.getStatistics().getStatus() == InterfaceStatus.UP;
+    }
+
     /**
      * command succeeded and VM is up => migration done
      * command succeeded and VM is not up => migration started


-- 
To view, visit http://gerrit.ovirt.org/20039
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdfcca442d40d8f2c3b6b28dc9f520e286b7e8f2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masa...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to