Liron Ar has posted comments on this change.

Change subject: engine: Do not add disk in snapshot preview
......................................................................


Patch Set 4: (3 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AbstractDiskVmCommand.java
Line 230: 
Line 231:     protected boolean isVmNotLocked() {
Line 232:         return
Line 233:                 getVmId() != null &&
Line 234:                 validate(new VmValidator(getVm()).vmNotLocked());
even after getVmId() is checked, getVm() can return null here and cause to NPE.
Line 235:     }


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
Line 128:         if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != 
null) {
Line 129:             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE);
Line 130:         }
Line 131: 
Line 132:         if (getVm() != null) {
suggestion: you can put those checks in the CDA to avoid the duplication 
between this method and the check of the images method.
Line 133:             if (!isVmNotInPreviewSnapshot()) {
Line 134:                 return false;
Line 135:             }
Line 136: 


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotPlugDiskToVmCommand.java
Line 45:                 isVmInUpPausedDownStatus() &&
Line 46:                 isDiskExist(disk) &&
Line 47:                 checkCanPerformPlugUnPlugDisk() &&
Line 48:                 isVmNotInPreviewSnapshot() &&
Line 49:                 isVmNotLocked();
it's already checked that the vm is up/paused/down in line 45..so you will 
never reach here with the vm locked.
Line 50:     }
Line 51: 
Line 52:     private boolean checkCanPerformPlugUnPlugDisk() {
Line 53:         boolean returnValue = true;


--
To view, visit http://gerrit.ovirt.org/13327
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibfde0540f1d77456ed1412b015a0963f4682039f
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Libor Spevak <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Libor Spevak <[email protected]>
Gerrit-Reviewer: Liron Ar <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to