Alona Kaplan has uploaded a new change for review.

Change subject: engine: moving VM with empty nic to unsupported cluster should 
be blocked
......................................................................

engine: moving VM with empty nic to unsupported cluster should be blocked

When moving VM with empty nic (no network) from cluster 3.2 to cluster 3.1
the VM have nic without network on cluster 3.1.
This patch blocks it by canDoAction.

Change-Id: Ic94c4b06b42675e4c5fe28317b38a3590d8fbe79
Bug-Url: https://bugzilla.redhat.com/909834
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/88/11988/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
index 6fab1a4..95c15ed 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
@@ -59,7 +59,7 @@
 
                 Version clusterCompatibilityVersion = 
targetCluster.getcompatibility_version();
                 if (!validateDestinationClusterContainsNetworks(interfaces)
-                        || !validateNicsLinkedCorrectly(interfaces, 
clusterCompatibilityVersion)) {
+                        || !validateNics(interfaces, 
clusterCompatibilityVersion)) {
                     return false;
                 }
 
@@ -86,20 +86,21 @@
     }
 
     /**
-     * Checks that when unlinking is not supported in the destination cluster 
and a NIC has unlinked network, it's not
-     * valid.
+     * Checks that when unlinking/null network is not supported in the 
destination cluster and a NIC has unlinked/null
+     * network, it's not valid.
      *
      * @param interfaces
      *            The NICs to check.
      * @param clusterCompatibilityVersion
      *            The destination cluster's compatibility version.
-     * @return Whether the NICs are linked correctly (with regards to the 
destination cluster).
+     * @return Whether the NICs are linked correctly and network name is valid 
(with regards to the destination
+     *         cluster).
      */
-    private boolean validateNicsLinkedCorrectly(List<VmNetworkInterface> 
interfaces,
+    private boolean validateNics(List<VmNetworkInterface> interfaces,
             Version clusterCompatibilityVersion) {
         for (VmNetworkInterface iface : interfaces) {
             VmNicValidator nicValidator = new VmNicValidator(iface, 
clusterCompatibilityVersion);
-            if (!validate(nicValidator.linkedCorrectly())) {
+            if (!validate(nicValidator.linkedCorrectly()) || 
!validate(nicValidator.networkNameValid())) {
                 return false;
             }
         }


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

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

Reply via email to