Ayal Baron has posted comments on this change.
Change subject: core: fix err msg-add disk to locked VM (#865551)
......................................................................
Patch Set 5: (3 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
Line 79:
Line 80: @Override
Line 81: protected boolean canDoAction() {
Line 82: boolean returnValue = isVmExist() && acquireLockInternal();
Line 83: VM vm = getVm();
if !returnValue we shouldn't even get the VM, just return.
As opposed to the rest of the function, here returning early is not just a
syntactic difference.
Maybe submit another patch to fix the entire method's structure?
Line 84:
Line 85: // if user sent drive check that its not in use
Line 86: returnValue = returnValue && (vm == null ||
isDiskCanBeAddedToVm(getParameters().getDiskInfo()));
Line 87: if (returnValue && DiskStorageType.IMAGE ==
getParameters().getDiskInfo().getDiskStorageType()) {
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
Line 450: boolean checkIsValid, Collection diskImageList) {
Line 451:
Line 452: boolean returnValue = true;
Line 453: boolean isValid = checkIsValid
Line 454: && ((Boolean)
Backend.getInstance().getResourceManager()
Need to have 1 'if checkIsValid' instead of testing it here and below.
Line 455: .RunVdsCommand(VDSCommandType.IsValid, new
IrsBaseVDSCommandParameters(storagePoolId))
Line 456: .getReturnValue()).booleanValue();
Line 457: if (checkIsValid && !isValid) {
Line 458: returnValue = false;
Line 457: if (checkIsValid && !isValid) {
Line 458: returnValue = false;
Line 459: ListUtils.nullSafeAdd(messages,
VdcBllMessages.ACTION_TYPE_FAILED_IMAGE_REPOSITORY_NOT_FOUND.toString());
Line 460: }
Line 461:
The entire method should be moved to returning early.
Line 462: List<DiskImage> images = getImages(vm, diskImageList);
Line 463: if (returnValue && checkImagesLocked) {
Line 464: List<String> lockedDisksAliases = new ArrayList<String>();
Line 465: for (DiskImage diskImage : images) {
--
To view, visit http://gerrit.ovirt.org/8666
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7a82d91b0ee51ebd1a612dbf210e0ea4533e746
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vered Volansky <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Liron Aravot <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Vered Volansky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches