Lior Vernia has uploaded a new change for review.

Change subject: engine: Empty SetupNetworksCommand isn't sent to VDSM
......................................................................

engine: Empty SetupNetworksCommand isn't sent to VDSM

Changed the SetupNetworksCommand so that if it doesn't change anything
in a host's network configuration, it does nothing (instead of sending
an empty command to VDSM) and returns success.

Change-Id: Ib68eeb1e7e75aea7b0730ee4650675fd2b9d37cd
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=904743
Signed-off-by: Lior Vernia <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/SetupNetworksCommand.java
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/11750/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 adbfd0f..8950f5a 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
@@ -83,6 +83,11 @@
 
     @Override
     protected void executeCommand() {
+        if (isEmptyCommand()) {
+            setSucceeded(true);
+            return;
+        }
+
         T bckndCmdParams = getParameters();
         final SetupNetworksVdsCommandParameters vdsCmdParams = new 
SetupNetworksVdsCommandParameters(
                 getVdsId(),
@@ -119,6 +124,11 @@
         }
     }
 
+    private boolean isEmptyCommand() {
+        return getNetworks().isEmpty() && getRemovedNetworks().isEmpty()
+                && getBonds().isEmpty() && getRemovedBonds().isEmpty();
+    }
+
     private List<VdsNetworkInterface> getInterfaces() {
         return getParameters().getInterfaces();
     }


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

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