Arik Hadas has uploaded a new change for review.

Change subject: core: block migration for paused vm only in case of an error
......................................................................

core: block migration for paused vm only in case of an error

We used to block migration for every VM which is in paused state but
actually VMs which are in paused state not due to an error should
be able to migrate so we should not block it for such VMs.

Change-Id: Ic6e7a7d41fcf66e2d3c13b93de7dd68b42aeaecb
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
5 files changed, 17 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/27176/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
index be8d2a3..b2bf701 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
@@ -20,6 +20,7 @@
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
+import org.ovirt.engine.core.common.businessentities.VmPauseStatus;
 import org.ovirt.engine.core.common.businessentities.network.InterfaceStatus;
 import org.ovirt.engine.core.common.businessentities.network.Network;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface;
@@ -320,16 +321,20 @@
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NON_MIGRTABLE_AND_IS_NOT_FORCED_BY_USER_TO_MIGRATE);
         }
 
-        if (vm.getStatus() == VMStatus.MigratingFrom) {
+        switch (vm.getStatus()) {
+        case MigratingFrom:
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MIGRATION_IN_PROGRESS);
-        }
 
-        if (vm.getStatus() == VMStatus.NotResponding) {
-            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, 
LocalizedVmStatus.from(vm.getStatus()));
-        }
+        case NotResponding:
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, 
LocalizedVmStatus.from(VMStatus.NotResponding));
 
-        if (vm.getStatus() == VMStatus.Paused) {
-            return 
failCanDoAction(VdcBllMessages.MIGRATE_PAUSED_VM_IS_UNSUPPORTED);
+        case Paused:
+            if (vm.getVmPauseStatus() != VmPauseStatus.NOERR) {
+                return 
failCanDoAction(VdcBllMessages.MIGRATE_PAUSED_ERR_VM_IS_UNSUPPORTED);
+            }
+            break;
+
+        default:
         }
 
         if (!vm.isQualifyToMigrate()) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 4b6173e..06d3f45 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -841,7 +841,7 @@
     ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST(ErrorType.BAD_PARAMETERS),
     VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_NO_GLUSTER_HOST_TO_PEER_PROBE(ErrorType.CONFLICT),
-    MIGRATE_PAUSED_VM_IS_UNSUPPORTED(ErrorType.NOT_SUPPORTED),
+    MIGRATE_PAUSED_ERR_VM_IS_UNSUPPORTED(ErrorType.NOT_SUPPORTED),
     ACTION_TYPE_FAILED_SERVER_NAME_REQUIRED(ErrorType.BAD_PARAMETERS),
     SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER(ErrorType.CONFLICT),
     SERVER_ALREADY_PART_OF_ANOTHER_CLUSTER(ErrorType.CONFLICT),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 99b0510..c424d9b 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1041,7 +1041,7 @@
 ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_AND_MIGRATABLE=Migratable VM's 
cannot be pinned to CPU.
 ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST=Cannot set 
host CPU pinning when host is not selected
 ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID=Cannot ${action} ${type}. The 
Network Interface ${IfaceName} has an invalid MAC address ${MacAddress}. MAC 
address must be in format "HH:HH:HH:HH:HH:HH" where H is a hexadecimal 
character (either a digit or A-F, case is insignificant).
-MIGRATE_PAUSED_VM_IS_UNSUPPORTED=Migrating a VM in paused status is 
unsupported.
+MIGRATE_PAUSED_ERR_VM_IS_UNSUPPORTED=Migrating a VM in paused status due to an 
error is unsupported.
 VM_INTERFACE_NOT_EXIST=Cannot ${action} ${type}. The VM Network Interface does 
not exist.
 HOST_NETWORK_INTERFACE_NOT_EXIST=Cannot ${action} ${type}. The host network 
interface does not exist.
 ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_DEVICE=Cannot ${action} ${type}. The 
VM Network Interface is plugged to a running VM.
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index f11e863..78a2953 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -2802,8 +2802,8 @@
     @DefaultStringValue("Cannot ${action} ${type}. The Network Interface 
${IfaceName} has an invalid MAC address ${MacAddress}. MAC address must be in 
format \"HH:HH:HH:HH:HH:HH\" where H is a hexadecimal character (either a digit 
or A-F, case is insignificant).")
     String ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID();
 
-    @DefaultStringValue("Migrating a VM in paused status is unsupported.")
-    String MIGRATE_PAUSED_VM_IS_UNSUPPORTED();
+    @DefaultStringValue("Migrating a VM in paused status due to an error is 
unsupported.")
+    String MIGRATE_PAUSED_ERR_VM_IS_UNSUPPORTED();
 
     @DefaultStringValue("Cannot ${action} ${type}. The VM Network Interface 
does not exist.")
     String VM_INTERFACE_NOT_EXIST();
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 59488d5..0177b3a 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -942,7 +942,7 @@
 ERROR_GET_STORAGE_DOMAIN_LIST=Cannot get Storage Domains list.
 ACTION_TYPE_FAILED_VDS_CLUSTER_DIFFERENT_ARCHITECTURES=Cannot ${action} 
${type}. The host and the destination cluster architectures do not match.
 ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID=Cannot ${action} ${type}. The 
Network Interface ${IfaceName} has an invalid MAC address ${MacAddress}. MAC 
address must be in format "HH:HH:HH:HH:HH:HH" where H is a hexadecimal 
character (either a digit or A-F, case is insignificant).
-MIGRATE_PAUSED_VM_IS_UNSUPPORTED=Migrating a VM in paused status is 
unsupported.
+MIGRATE_PAUSED_ERR_VM_IS_UNSUPPORTED=Migrating a VM in paused status due to an 
error is unsupported.
 VM_INTERFACE_NOT_EXIST=Cannot ${action} ${type}. The VM Network Interface does 
not exist.
 ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_DEVICE=Cannot ${action} ${type}. The 
VM Network Interface is plugged to a running VM.
 USER_CANNOT_FORCE_RECONNECT_TO_VM=Console connection denied. Another user has 
already accessed the console of this VM. The VM should be rebooted to allow 
another user to access it, or changed by an admin to not enforce reboot between 
users accessing its console.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6e7a7d41fcf66e2d3c13b93de7dd68b42aeaecb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to