Liron Ar has posted comments on this change. Change subject: engine: Validate that IDE disk is not read-only ......................................................................
Patch Set 5: Code-Review-1 (2 comments) Marking -1 as it seems like it'll break adding floating disks. Another issue is that we already have a method to validate the disk interface when adding it to a vm, which is exactly what we need - i think that this check should be done there as well, related comment to it within the patch. http://gerrit.ovirt.org/#/c/23953/5/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java: Line 100: return failCanDoAction(VdcBllMessages.CANNOT_ADD_FLOATING_DISK_WITH_PLUG_VM_SET); Line 101: } Line 102: Line 103: DiskValidator diskValidator = getDiskValidator(getParameters().getDiskInfo()); Line 104: if (!validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface())) { why just add this check to diskValidator.isDiskInterfaceSupported? that way we don't need to remember to add it each time and it'll be applied to all scenarios. Line 105: return false; Line 106: } Line 107: Line 108: if (DiskStorageType.IMAGE == getParameters().getDiskInfo().getDiskStorageType()) { http://gerrit.ovirt.org/#/c/23953/5/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/DiskValidator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/DiskValidator.java: Line 99: Line 100: } Line 101: Line 102: public ValidationResult isReadOnlyPropertyCompatibleWithInterface() { Line 103: if (Boolean.TRUE.equals(disk.getReadOnly()) && disk.getDiskInterface() == DiskInterface.IDE) { this will return false always for floating disks, meaning that we won't be able to add ide disks Line 104: return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_IDE_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR); Line 105: } Line 106: Line 107: return ValidationResult.VALID; -- To view, visit http://gerrit.ovirt.org/23953 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I441362adf2f4833b034ede4093fc8195debd2ed5 Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sergey Gotliv <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Cheryn Tan <[email protected]> Gerrit-Reviewer: Liron Ar <[email protected]> Gerrit-Reviewer: Maor Lipchuk <[email protected]> Gerrit-Reviewer: Sergey Gotliv <[email protected]> Gerrit-Reviewer: Vered Volansky <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
