Hello Gustavo Frederico Temple Pedrosa,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/26751
to review the following change.
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: Ic20fb0174710ae25057ea6a798add648fc868933
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1067561
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/51/26751/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 ca1e8bf..67c1bea 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, runVmParam.getCustomProperties(),
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, String
runOnceCustomProperties, List<String> messages) {
String customProperties = runOnceCustomProperties != null ?
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 b999653..d5d420c 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
@@ -684,7 +684,15 @@
EntityModel<DisplayType> qxlProtocol = new
EntityModel<DisplayType>(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/26751
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic20fb0174710ae25057ea6a798add648fc868933
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: Gustavo Frederico Temple Pedrosa
<[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches