Moti Asayag has uploaded a new change for review.

Change subject: engine: Unlabel removed bonds
......................................................................

engine: Unlabel removed bonds

If a bond is broken, but the bond itself is being
maintained without its slaves, the labels should
be cleared from the bond so other interfaces could
be labeled with those labels.

Change-Id: I054d757bef8c59b42456917d5824ce75d8696fa4
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksCommand.java
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/23033/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksCommand.java
index 19234b7..d7073cf 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksCommand.java
@@ -2,6 +2,7 @@
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
@@ -12,6 +13,7 @@
 import org.ovirt.engine.core.bll.VdsHandler;
 import org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelper;
 import org.ovirt.engine.core.common.action.SetupNetworksParameters;
+import org.ovirt.engine.core.common.businessentities.Entities;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.network.Network;
@@ -91,6 +93,10 @@
             return;
         }
 
+        if (!getRemovedBonds().isEmpty()) {
+            unlabelRemovedBonds();
+        }
+
         T bckndCmdParams = getParameters();
         final SetupNetworksVdsCommandParameters vdsCmdParams = new 
SetupNetworksVdsCommandParameters(
                 getVdsId(),
@@ -127,6 +133,15 @@
         }
     }
 
+    private void unlabelRemovedBonds() {
+        Map<String, VdsNetworkInterface> nicsByName = 
Entities.entitiesByName(getInterfaces());
+        for (String bond : getRemovedBonds()) {
+            if (nicsByName.containsKey(bond)) {
+                nicsByName.get(bond).setLabels(null);
+            }
+        }
+    }
+
     private void updateModifiedLabeledInterfaces() {
         TransactionSupport.executeInNewTransaction(new TransactionMethod<T>() {
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I054d757bef8c59b42456917d5824ce75d8696fa4
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