Liron Aravot has posted comments on this change.

Change subject: core: Image configuration adjustments for cloning a VM
......................................................................


Patch Set 3:

(4 comments)

http://gerrit.ovirt.org/#/c/35225/3/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java:

Line 91:                     
ImagesHandler.filterImageDisks(vmFromConfiguration.getDiskMap().values(),
Line 92:                             false,
Line 93:                             true,
Line 94:                             true);
Line 95:             adjustDisksImageConfiguration(diskImagesFromConfiguration);
I don't think that this call should be 'hidden' here, it will make debugging 
this command harder (you'll fill one thing in the UI/Rest and will have to 
start look where it's was changed), I'd consider to move it to the outside 
(call in the canDoAction like in other flows).
Line 96:         }
Line 97:         return diskImagesFromConfiguration;
Line 98:     }
Line 99: 


Line 99: 
Line 100:     private void adjustDisksImageConfiguration(Collection<DiskImage> 
diskImages) {
Line 101:         for (DiskImage diskImage : diskImages) {
Line 102:             // Adjust disk image configuration if needed.
Line 103:             if 
(destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain()
 &&
let's export this part to a method so that this if clause will be more 
readable..you can name it retrieveDomainForDisk()
Line 104:                     
diskImage.getVolumeType().equals(VolumeType.Sparse) &&
Line 105:                     
diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) {
Line 106:                 diskImage.setvolumeFormat(VolumeFormat.COW);
Line 107:             }


Line 100:     private void adjustDisksImageConfiguration(Collection<DiskImage> 
diskImages) {
Line 101:         for (DiskImage diskImage : diskImages) {
Line 102:             // Adjust disk image configuration if needed.
Line 103:             if 
(destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain()
 &&
Line 104:                     
diskImage.getVolumeType().equals(VolumeType.Sparse) &&
I'd switch the order so that this check will be first
Line 105:                     
diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) {
Line 106:                 diskImage.setvolumeFormat(VolumeFormat.COW);
Line 107:             }
Line 108:         }


Line 101:         for (DiskImage diskImage : diskImages) {
Line 102:             // Adjust disk image configuration if needed.
Line 103:             if 
(destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain()
 &&
Line 104:                     
diskImage.getVolumeType().equals(VolumeType.Sparse) &&
Line 105:                     
diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) {
I'd remove the last check and just set it
Line 106:                 diskImage.setvolumeFormat(VolumeFormat.COW);
Line 107:             }
Line 108:         }
Line 109:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id924e9beab5d84277fad4f3a2a40b14571beaf22
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Amit Aviram <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Liron Aravot <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: [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