Michael Kublin has posted comments on this change.

Change subject: core: WIP : RemoveImageDisk - race when updating snapshots ovf 
(#828192)
......................................................................


Patch Set 14: (6 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveImageCommand.java
Line 99:                 getCommandId()));
Line 100:         p.setEntityId(getParameters().getEntityId());
Line 101:         return 
AsyncTaskManager.getInstance().CreateTask(AsyncTaskType.deleteImage, p);
Line 102:     }
Line 103: 
RemoveImage is called from RemoveAllImages, at that case I don't need any lock.
Not reflected here. Also possible similar about other commands
Line 104:     private void removeImageFromDB() {
Line 105:         final DiskImage diskImage = getDiskImage();
Line 106:         final List<Snapshot> updatedSnapshots;
Line 107:         final boolean shouldPerformOpOnVmSnapshots = 
!diskImage.isShareable();


Line 106:         final List<Snapshot> updatedSnapshots;
Line 107:         final boolean shouldPerformOpOnVmSnapshots = 
!diskImage.isShareable();
Line 108: 
Line 109:         try {
Line 110:             if (shouldPerformOpOnVmSnapshots) {
why I need variable that is used only inside a scope of if?
Line 111:                 VM vm = getVmForNonShareableDiskImage(diskImage);
Line 112:                 lockVmSnapshotsWithWait(vm);
Line 113:                 updatedSnapshots = 
prepareSnapshotConfigWithoutImage(diskImage.getId());
Line 114:             } else {


Line 110:             if (shouldPerformOpOnVmSnapshots) {
Line 111:                 VM vm = getVmForNonShareableDiskImage(diskImage);
Line 112:                 lockVmSnapshotsWithWait(vm);
Line 113:                 updatedSnapshots = 
prepareSnapshotConfigWithoutImage(diskImage.getId());
Line 114:             } else {
These I don't understand, if updateSnapshots is empty, why I perform a delete 
of image ?
Line 115:                 updatedSnapshots = Collections.emptyList();
Line 116:             }
Line 117: 
Line 118:             
TransactionSupport.executeInScope(TransactionScopeOption.Required,


Line 150: 
Line 151:                             return null;
Line 152:                         }
Line 153:                     });
Line 154:         }
finally should be line up
Line 155:         finally {
Line 156:             if (shouldPerformOpOnVmSnapshots) {
Line 157:                 freeVmSnapshotsLock();
Line 158:             }


Line 157:                 freeVmSnapshotsLock();
Line 158:             }
Line 159:         }
Line 160:     }
Line 161: 
Why object is created by default?
Why variable in the middle of class?
Line 162:     private final EngineLock snapshotsEngineLock = new EngineLock();
Line 163: 
Line 164:     private void lockVmSnapshotsWithWait(VM vm) {
Line 165:         Map<String, String> snapshotsExlusiveLockMap = 
Collections.singletonMap(vm.getId().toString(), 
LockingGroup.VM_SNAPSHOTS.name());


Line 165:         Map<String, String> snapshotsExlusiveLockMap = 
Collections.singletonMap(vm.getId().toString(), 
LockingGroup.VM_SNAPSHOTS.name());
Line 166:         
snapshotsEngineLock.setExclusiveLocks(snapshotsExlusiveLockMap);
Line 167:         getLockManager().acquireLockWait(snapshotsEngineLock);
Line 168:     }
Line 169: 
why I need method which contains one line of code? Especially private method.
Line 170:     private void freeVmSnapshotsLock(){
Line 171:         getLockManager().releaseLock(snapshotsEngineLock);
Line 172:      }
Line 173: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iccb44f1aa9d204477955343167133849a4146753
Gerrit-PatchSet: 14
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <[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: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to