Vitor de Lima has uploaded a new change for review.

Change subject: core, engine: Prevent VM suspend in the ppc64 arch
......................................................................

core, engine: Prevent VM suspend in the ppc64 arch

This change prevents the suspension of VMs in architectures that do not
support it by checking the availability of this feature in the
canDoAction method of the HibernateVM command.

Change-Id: Ia0ccb0dd008319a2a230821415d902897690f01b
Signed-off-by: Vitor de Lima <vitor.l...@eldorado.org.br>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.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
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
6 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/24016/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
index ce23ab0..3cf1079 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
@@ -7,6 +7,7 @@
 import org.ovirt.engine.core.bll.memory.MemoryUtils;
 import org.ovirt.engine.core.bll.validator.LocalizedVmStatus;
 import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VmOperationParameterBase;
@@ -236,6 +237,11 @@
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND);
         }
 
+        if 
(!FeatureSupported.isSuspendSupportedByArchitecture(getVm().getClusterArch(),
+                getVm().getVdsGroupCompatibilityVersion())) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SUSPEND_NOT_SUPPORTED);
+        }
+
         if (!canRunActionOnNonManagedVm()) {
            return false;
         }
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 29faffc..94313b4 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
@@ -246,6 +246,7 @@
     
ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS(ErrorType.BAD_PARAMETERS),
     
ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS(ErrorType.BAD_PARAMETERS),
     
ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI(ErrorType.BAD_PARAMETERS),
+    ACTION_TYPE_FAILED_SUSPEND_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_OS_TYPE(ErrorType.BAD_PARAMETERS),
     
ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME(ErrorType.BAD_PARAMETERS),
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 7f240a1..d96511a 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -624,6 +624,7 @@
 ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS=Cannot 
${action} ${type}. Selected watchdog model is not supported by the operating 
system.
 ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS=Cannot 
${action} ${type}. Selected display type is not supported by the operating 
system.
 ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI=Cannot 
${action} ${type}. Selected operation system does not support VirtIO-SCSI. 
Please disable VirtIO-SCSI for the VM.
+ACTION_TYPE_FAILED_SUSPEND_NOT_SUPPORTED=Cannot ${action} ${type}. Selected VM 
has an architecture that does not support suspension.
 ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION=Cannot ${action} 
${type}. Cluster does not support Single Qxl Pci devices.
 ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal 
Domain name: ${Domain}. Domain name has unsupported special character ${Char}.
 ACTION_TYPE_FAILED_ILLEGAL_ARCHITECTURE_TYPE_INCOMPATIBLE=Cannot ${action} 
${type}. Architecture does not match the expected value.
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 f21c221..b394396 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
@@ -1699,6 +1699,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Selected operation system 
does not support VirtIO-SCSI. Please disable VirtIO-SCSI for the VM.")
     String ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Selected VM has an 
architecture that does not support suspension.")
+    String ACTION_TYPE_FAILED_SUSPEND_NOT_SUPPORTED();
+
     @DefaultStringValue("Cannot ${action} ${type}. Cannot set single display 
device to non Linux operating system.")
     String ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_OS_TYPE();
 
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 0f70123..fa04684 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
@@ -604,6 +604,7 @@
 ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS=Cannot 
${action} ${type}. Selected watchdog model is not supported by the operating 
system.
 ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS=Cannot 
${action} ${type}. Selected display type is not supported by the operating 
system.
 ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI=Cannot 
${action} ${type}. Selected operation system does not support VirtIO-SCSI. 
Please disable VirtIO-SCSI for the VM.
+ACTION_TYPE_FAILED_SUSPEND_NOT_SUPPORTED=Cannot ${action} ${type}. Selected VM 
has an architecture that does not support suspension.
 ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION=Cannot ${action} 
${type}. Cluster does not support Single Qxl Pci devices.
 ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal 
Domain name: ${Domain}. Domain name has unsupported special character ${Char}.
 ACTION_TYPE_FAILED_ILLEGAL_ARCHITECTURE_TYPE_INCOMPATIBLE=Cannot ${action} 
${type}. Architecture does not match the expected value.
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 106df1c..f08fdf0 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -625,6 +625,7 @@
 ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS=Cannot 
${action} ${type}. Selected watchdog model is not supported by the operating 
system.
 ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS=Cannot 
${action} ${type}. Selected display type is not supported by the operating 
system.
 ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI=Cannot 
${action} ${type}. Selected operation system does not support VirtIO-SCSI. 
Please disable VirtIO-SCSI for the VM.
+ACTION_TYPE_FAILED_SUSPEND_NOT_SUPPORTED=Cannot ${action} ${type}. Selected VM 
has an architecture that does not support suspension.
 ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION=Cannot ${action} 
${type}. Cluster does not support Single Qxl Pci devices.
 ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal 
Domain name: ${Domain}. Domain name has unsupported special character ${Char}.
 ACTION_TYPE_FAILED_ILLEGAL_ARCHITECTURE_TYPE_INCOMPATIBLE=Cannot ${action} 
${type}. Architecture does not match the expected value.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0ccb0dd008319a2a230821415d902897690f01b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vitor de Lima <vitor.l...@eldorado.org.br>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to