Lior Vernia has uploaded a new change for review.

Change subject: engine: Allowed creation of bonds in SetupNetworksHelper
......................................................................

engine: Allowed creation of bonds in SetupNetworksHelper

The validation used to check that any NIC to which VLAN-tagged
networks were attached existed on the host; this no longer must be
true since we've enabled adding new bonds that hadn't before existed
on the host.

Change-Id: I167758e86b32bd90f09203321f89bf1a5adc7bf6
Bug-Url: https://bugzilla.redhat.com/968190
Signed-off-by: Lior Vernia <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksHelper.java
1 file changed, 15 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/65/17665/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksHelper.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksHelper.java
index dcfd07f..ba1c409 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksHelper.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksHelper.java
@@ -72,16 +72,8 @@
             if (addInterfaceToProcessedList(iface)) {
                 if (isBond(iface)) {
                     extractBondIfModified(iface, name);
-                } else {
-                    if (StringUtils.isNotBlank(iface.getBondName())) {
-                        extractBondSlave(iface);
-                    }
-
-                    // validate the nic exists on host
-                    String nameWithoutVlanId = NetworkUtils.StripVlan(name);
-                    if (!getExistingIfaces().containsKey(nameWithoutVlanId)) {
-                        
addViolation(VdcBllMessages.NETWORK_INTERFACES_DONT_EXIST, nameWithoutVlanId);
-                    }
+                } else if (StringUtils.isNotBlank(iface.getBondName())) {
+                    extractBondSlave(iface);
                 }
 
                 // validate and extract to network map
@@ -97,11 +89,24 @@
         extractRemovedBonds();
         detectSlaveChanges();
         validateMTU();
+        validateInterfacesExist();
 
         return translateViolations();
     }
 
     /**
+     * Validates that all interfaces exist on the host, except bonds that may 
be created.
+     */
+    private void validateInterfacesExist() {
+        for (VdsNetworkInterface iface : params.getInterfaces()) {
+            String nameWithoutVlanId = NetworkUtils.StripVlan(iface.getName());
+            if (!getExistingIfaces().containsKey(nameWithoutVlanId) && 
!bonds.containsKey(nameWithoutVlanId)) {
+                addViolation(VdcBllMessages.NETWORK_INTERFACES_DONT_EXIST, 
nameWithoutVlanId);
+            }
+        }
+    }
+
+    /**
      * Validates there is no differences on MTU value between non-VM network 
to Vlans over the same interface/bond
      */
     private void validateMTU() {


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

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

Reply via email to