Gustavo Frederico Temple Pedrosa has uploaded a new change for review.

Change subject: core, webadmin: [Fix] Run Once: avoid SPICE in ppc64 VMs
......................................................................

core, webadmin: [Fix] Run Once: avoid SPICE in ppc64 VMs

The Run Once command and the respective dialog on the frontend allowed
the selection of the SPICE display protocol in ppc64 VMs. Since this is
not supported, this change blocks this.

Change-Id: If4e0612473c2df0cb13a3e6c0995340ce73532b9
Signed-off-by: Gustavo Pedrosa <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
2 files changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/47/25047/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
index aea07f2..fb794b7 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
@@ -23,6 +23,7 @@
 import org.ovirt.engine.core.common.businessentities.BootSequence;
 import org.ovirt.engine.core.common.businessentities.Disk;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
+import org.ovirt.engine.core.common.businessentities.DisplayType;
 import org.ovirt.engine.core.common.businessentities.Entities;
 import org.ovirt.engine.core.common.businessentities.ImageFileType;
 import org.ovirt.engine.core.common.businessentities.RepoImage;
@@ -107,6 +108,7 @@
         return
                 validateVmProperties(vm, messages) &&
                 validate(validateBootSequence(vm, 
runVmParam.getBootSequence(), getVmDisks(), activeIsoDomainId), messages) &&
+                validate(validateDisplayType(), messages) &&
                 validate(new VmValidator(vm).vmNotLocked(), messages) &&
                 
validate(getSnapshotValidator().vmNotDuringSnapshot(vm.getId()), messages) &&
                 validate(validateVmStatusUsingMatrix(vm), messages) &&
@@ -142,6 +144,20 @@
         return ValidationResult.VALID;
     }
 
+    protected ValidationResult validateDisplayType() {
+
+        DisplayType selectedDisplayType = runVmParam.getUseVnc() == null ?
+                vm.getDefaultDisplayType() : (runVmParam.getUseVnc() ? 
DisplayType.vnc : DisplayType.qxl);
+
+        if (!VmValidationUtils.isDisplayTypeSupported(vm.getOs(),
+                vm.getVdsGroupCompatibilityVersion(),
+                selectedDisplayType)) {
+            return new ValidationResult(
+                    
VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS);
+        }
+
+        return ValidationResult.VALID;
+    }
 
     protected boolean validateVmProperties(VM vm, List<String> messages) {
         List<ValidationError> validationErrors =
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
index fc4711c..d62608a 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
@@ -674,7 +674,15 @@
         EntityModel qxlProtocol = new EntityModel(DisplayType.qxl)
            
.setTitle(ConstantsManager.getInstance().getConstants().spiceTitle());
 
-        getDisplayProtocol().setItems(Arrays.asList(vncProtocol, qxlProtocol));
+        boolean hasSpiceSupport = 
AsyncDataProvider.hasSpiceSupport(vm.getOs(), 
vm.getVdsGroupCompatibilityVersion());
+
+        if (hasSpiceSupport) {
+            getDisplayProtocol().setItems(Arrays.asList(vncProtocol, 
qxlProtocol));
+        } else {
+            getDisplayProtocol().setItems(Arrays.asList(vncProtocol));
+            getDisplayConsole_Spice_IsSelected().setIsAvailable(false);
+        }
+
         getDisplayProtocol().setSelectedItem(vm.getDefaultDisplayType() == 
DisplayType.vnc ?
                 vncProtocol : qxlProtocol);
     }


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

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

Reply via email to