Sergey Gotliv has posted comments on this change.

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


Patch Set 5:

(2 comments)

Liron,

I answered all your questions. If my answer about floating disks satisfies you, 
please, remove -1 because usually it prevents from other reviewers to express 
their opinion.

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
So, let's perform single big disk validation in this way we'll need to 
remember/understand anything else. 

isDiskInterfaceSupported - validation between OS and disk interface, probably 
the name can be better.
I introduce validation between the interface and read-only parameter - small 
testable validation which not necessarily validates that interface is correct 
but that read-only is applicable in this case.
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) {
> ide disks = floating disks
Floating disk can't be read-only because read-only is the vm device property 
and not applicable without a VM.
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

Reply via email to