Vered Volansky has uploaded a new change for review. Change subject: webadmin: Repair disallow RO in UI ......................................................................
webadmin: Repair disallow RO in UI Qemu currently does not support direct-LUN disks connected using VirtIO-SCSI. This patch blocks this option from UI when adding/editing/attaching a direct-LUN disk with VirtIO-SCSI interface to a VM. This wasn't checked in Add/Edit Disk to Vm dialog, nor in Attach table. IDE behaviour was changed to comply with this behaviour in this patch as well. This patch also removes un-needed verfication for IDE disk. Change-Id: Ieb1923d03785be7f228076e12f4865242aed5c90 Bug-Url: https://bugzilla.redhat.com/1097754 Signed-off-by: Vered Volansky <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/disks/DisksViewColumns.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java 3 files changed, 21 insertions(+), 21 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/27958/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/disks/DisksViewColumns.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/disks/DisksViewColumns.java index 6d35bbd..52645a2 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/disks/DisksViewColumns.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/disks/DisksViewColumns.java @@ -265,8 +265,13 @@ }) { @Override protected boolean canEdit(EntityModel object) { - return true; - } + DiskModel diskModel = (DiskModel) object.getEntity(); + Disk disk = diskModel.getDisk(); + boolean lunIscsiLimitation = + (disk.getDiskInterface() == DiskInterface.VirtIO_SCSI && disk.getDiskStorageType() == DiskStorageType.LUN); + boolean ideLimitation = (disk.getDiskInterface() == DiskInterface.IDE); + return !lunIscsiLimitation && !ideLimitation; + } @Override public Boolean getValue(EntityModel object) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java index cc8bb73..794d0bd 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java @@ -49,7 +49,6 @@ import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyQuotaValidation; import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation; import org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation; -import org.ovirt.engine.ui.uicommonweb.validation.ValidationResult; import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.Event; import org.ovirt.engine.ui.uicompat.EventArgs; @@ -666,13 +665,21 @@ protected void updateReadOnlyChangeability() { DiskInterface diskInterface = (DiskInterface) getDiskInterface().getSelectedItem(); - if (DiskInterface.IDE.equals(diskInterface)) { + if (diskInterface == DiskInterface.IDE) { getIsReadOnly().setChangeProhibitionReason(CONSTANTS.cannotEnableIdeInterfaceForReadOnlyDisk()); getIsReadOnly().setIsChangable(false); + getIsReadOnly().setEntity(false); + return; } - else { - getIsReadOnly().setIsChangable(isEditEnabled()); + + boolean isDirectLUN = Boolean.FALSE.equals(getIsInternal().getEntity()); + if (diskInterface == DiskInterface.VirtIO_SCSI && isDirectLUN) { + getIsReadOnly().setChangeProhibitionReason(CONSTANTS.cannotEnableVirtIoScsiInterfaceForLunReadOnlyDisk()); + getIsReadOnly().setIsChangable(false); + getIsReadOnly().setEntity(false); + return; } + getIsReadOnly().setIsChangable(isEditEnabled()); } private void updatePlugChangeability() { @@ -779,21 +786,6 @@ if (dataCenter != null && dataCenter.getQuotaEnforcementType() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) { getQuota().validateSelectedItem(new IValidation[] { new NotEmptyQuotaValidation() }); } - - getDiskInterface().validateEntity(new IValidation[] { new IValidation() { - @Override - public ValidationResult validate(Object value) { - ValidationResult result = new ValidationResult(); - - if (getDiskInterface().getSelectedItem() == DiskInterface.IDE && (Boolean) getIsReadOnly().getEntity()) - { - result.setSuccess(false); - result.getReasons().add(ConstantsManager.getInstance().getConstants().cannotEnableIdeInterfaceForReadOnlyDisk()); - } - - return result; - } - }}); return getAlias().getIsValid() && getDescription().getIsValid() && getQuota().getIsValid() && getDiskInterface().getIsValid(); } diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java index ec32e8b..f014e3d 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java @@ -2223,6 +2223,9 @@ @DefaultStringValue("Are you sure you want to place the following storage domain(s) into maintenance mode?") String areYouSureYouWantToPlaceFollowingStorageDomainsIntoMaintenanceModeMsg(); + @DefaultStringValue("A VirtIO-ISCSI direct LUN disk can't be read-only.") + String cannotEnableVirtIoScsiInterfaceForLunReadOnlyDisk(); + @DefaultStringValue("Global Maintenance Enabled") String haGlobalMaintenance(); -- To view, visit http://gerrit.ovirt.org/27958 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ieb1923d03785be7f228076e12f4865242aed5c90 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Vered Volansky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
