Moti Asayag has uploaded a new change for review.

Change subject: engine: Add method for checking existence of network in cluster
......................................................................

engine: Add method for checking existence of network in cluster

The patch adds a method to check if a given network is assigned
to a given cluster. The method will be used in can-do-action
validation where the vnic profile set for a vnic should be
verified as a vnic of a network within the cluster of the vm or
of the template.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/17361/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java
index 2416597..8d60a30 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java
@@ -1,5 +1,7 @@
 package org.ovirt.engine.core.bll.network.cluster;
 
+import java.util.List;
+
 import org.ovirt.engine.core.bll.MultiLevelAdministrationHandler;
 import org.ovirt.engine.core.bll.PredefinedRoles;
 import org.ovirt.engine.core.common.VdcObjectType;
@@ -79,4 +81,15 @@
         return retVal;
     }
 
+    public static boolean isNetworkInCluster(Network network, Guid clusterId) {
+        List<Network> networks = 
DbFacade.getInstance().getNetworkDao().getAllForCluster(clusterId);
+        for (Network clusterNetwork : networks) {
+            if (clusterNetwork.getId().equals(network.getId())) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
 }


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

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