Lior Vernia has uploaded a new change for review.

Change subject: engine: Remove update functionality from AttachNetworkToCluster
......................................................................

engine: Remove update functionality from AttachNetworkToCluster

The command is no longer used to update networks that are already
attached to the cluster, so the update functionality can be removed.

Change-Id: I7aae709dfa0f55ab78d9c1f3caddf75c9d27deb9
Signed-off-by: Lior Vernia <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworksToClusterCommand.java
2 files changed, 8 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/24902/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
index 0c66017..f641b09 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
@@ -65,7 +65,7 @@
 
             @Override
             public Void runInTransaction() {
-                updateNetworkAttachment(getVdsGroupId(), getNetworkCluster(), 
getNetwork());
+                attachNetwork(getVdsGroupId(), getNetworkCluster(), 
getNetwork());
                 return null;
             }
         });
@@ -201,24 +201,12 @@
         return false;
     }
 
-    public static void updateNetworkAttachment(Guid clusterId, NetworkCluster 
networkCluster, Network network) {
-        if (networkExists(clusterId, networkCluster)) {
-            getNetworkClusterDao().update(networkCluster);
-        } else {
-            getNetworkClusterDao().save(new NetworkCluster(clusterId, 
network.getId(),
-                    NetworkStatus.OPERATIONAL,
-                    false,
-                    networkCluster.isRequired(),
-                    networkCluster.isMigration()));
-        }
-
-        if (network.getCluster().isDisplay()) {
-            getNetworkClusterDao().setNetworkExclusivelyAsDisplay(clusterId, 
network.getId());
-        }
-
-        if (network.getCluster().isMigration()) {
-            getNetworkClusterDao().setNetworkExclusivelyAsMigration(clusterId, 
network.getId());
-        }
+    public static void attachNetwork(Guid clusterId, NetworkCluster 
networkCluster, Network network) {
+        getNetworkClusterDao().save(new NetworkCluster(clusterId, 
network.getId(),
+                NetworkStatus.OPERATIONAL,
+                false,
+                networkCluster.isRequired(),
+                networkCluster.isMigration()));
 
         NetworkClusterHelper.setStatus(clusterId, network);
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworksToClusterCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworksToClusterCommand.java
index db72a24..7eb4a0a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworksToClusterCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworksToClusterCommand.java
@@ -40,7 +40,7 @@
             @Override
             public Void runInTransaction() {
                 for (AttachNetworkToVdsGroupParameter param : 
getParameters().getClusterNetworksParameters()) {
-                    
AttachNetworkToVdsGroupCommand.updateNetworkAttachment(param.getVdsGroupId(),
+                    
AttachNetworkToVdsGroupCommand.attachNetwork(param.getVdsGroupId(),
                             param.getNetworkCluster(),
                             param.getNetwork());
                 }


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

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