Vered Volansky has uploaded a new change for review. Change subject: core: Disallow RO disks to be attached to VM ......................................................................
core: Disallow RO disks to be attached to VM RO is not supported when using specific inrtefaces when attached to a VM. These case are already disallowed when creating a disk, yet are still allowed when attaching a floating disk with these interfaces. These interface are IDE and iSCSI for a LUN target. This patch adds the relevant validations to AttachDiskToVmCommand's CDA. Change-Id: Iac2a8e0fbece57cbb6f375a65cc37e7c2bba11cf Bug-Url: https://bugzilla.redhat.com/1082673 Bug-Url: https://bugzilla.redhat.com/1094288 Signed-off-by: Vered Volansky <vvola...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java 1 file changed, 10 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/27475/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java index 03a1a41..c6eff29 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java @@ -44,11 +44,7 @@ public AttachDiskToVmCommand(T parameters) { super(parameters); disk = loadDisk((Guid) getParameters().getEntityInfo().getId()); - } - - protected AttachDiskToVmCommand(T parameters, Disk disk) { - super(parameters); - this.disk = disk; + disk.setReadOnly(getParameters().isReadOnly()); } @Override @@ -128,6 +124,10 @@ } } + if (!validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface())) { + return false; + } + if (!validate(diskValidator.isVirtIoScsiValid(getVm()))) { return false; } @@ -136,6 +136,11 @@ return false; } + if (disk.getDiskStorageType() == DiskStorageType.LUN && + !validate(diskValidator.isReadOnlyPropertyCompatibleWithLunInterface())) { + return false; + } + if (!isVmNotInPreviewSnapshot()) { return false; } -- To view, visit http://gerrit.ovirt.org/27475 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac2a8e0fbece57cbb6f375a65cc37e7c2bba11cf Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vered Volansky <vvola...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches