Moti Asayag has uploaded a new change for review.

Change subject: Revert "engine: Obtain old network name from correct NIC 
(#849971)"
......................................................................

Revert "engine: Obtain old network name from correct NIC (#849971)"

This reverts commit d9472bf9135f5d230603da30dc9d1ee65fcdf947.

Commit b06f11509e488f2888ed4044081f5041d00fa93e introduced several
regressions. It designed to calculate the network name by the interfaces
being sent (in order to prevent remove of network not related to the
modified interfaces). However it fails to resolve several cases in which
the sent interface doesn't contain the network name (multiple VLANs over
bond where on backend side assumption can't be made).

Change-Id: I853fcd2400ab131f687d798a4cff230a99294c8f
Signed-off-by: Moti Asayag <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateNetworkToVdsInterfaceCommand.java
1 file changed, 5 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/72/7572/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateNetworkToVdsInterfaceCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateNetworkToVdsInterfaceCommand.java
index b019427..2a3c94d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateNetworkToVdsInterfaceCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateNetworkToVdsInterfaceCommand.java
@@ -160,35 +160,28 @@
     protected boolean canDoAction() {
         String ifaceGateway = null;
         interfaces = 
getInterfaceDAO().getAllInterfacesForVds(getParameters().getVdsId());
+        VdsNetworkInterface updatedIface = null;
 
+        // check that interface exists
         for (final VdsNetworkInterface i : getParameters().getInterfaces()) {
-            VdsNetworkInterface updatedIface = null;
             for (VdsNetworkInterface iface : interfaces) {
                 if (iface.getName().equals(i.getName())) {
                     updatedIface = iface;
-                }
-
-                if (NetworkUtils.interfaceBasedOn(iface.getName(), i.getName())
-                        && StringUtils.isNotEmpty(iface.getNetworkName())) {
-                    if (oldNetworkName != null) {
-                        
addCanDoActionMessage(VdcBllMessages.MORE_THAN_ONE_NETWORK_ATTACHED);
-                        return false;
-                    }
-
-                    oldNetworkName = iface.getNetworkName();
                 }
             }
             if (updatedIface == null) {
                 
addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_NOT_EXISTS);
                 return false;
             }
-
             ifaceGateway = updatedIface.getGateway();
         }
 
         boolean managementNetworkUpdated =
                 StringUtils.equals(getParameters().getNetwork().getname(), 
NetworkUtils.getEngineNetwork());
 
+        // obtain the network name from the host interface and check that the 
old network name is not null
+        oldNetworkName = StringUtils.isEmpty(updatedIface.getNetworkName()) ? 
null : updatedIface.getNetworkName();
+
         if (oldNetworkName == null) {
             if (managementNetworkUpdated) {
                 // the command will update the interface of a management 
network


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I853fcd2400ab131f687d798a4cff230a99294c8f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to