Liron Ar has posted comments on this change.

Change subject: engine: Validate that IDE disk is not read-only
......................................................................


Patch Set 5:

(2 comments)

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())) {
> So, let's perform single big disk validation in this way we'll need to reme
adding this check there will reduce 90% percent of the code in this patch, i 
think that it should be there. but anyway, that's not the reason for the -1.

The isDiskInterfaceSupported is exactly what we need (when we validate the 
interface today) and our check should be done exactly when those checks are 
done, i don't see a reason to add another method and inspect scenarios for 
which is should be called (like the floating disk issue i raised here).
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) {
> Floating disk can't be read-only because read-only is the vm device propert
?
when you add a floating disk , disk.getReadOnly() will return null, 
Boolean.TRUE.equals(disk.getReadOnly() will return false and validation error 
will be returned.
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: Ayal Baron <[email protected]>
Gerrit-Reviewer: Cheryn Tan <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Liron Ar <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Sergey Gotliv <[email protected]>
Gerrit-Reviewer: Tal Nisan <[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

Reply via email to