Ayal Baron has posted comments on this change.
Change subject: core: ImportVmCommand: fix disk alias generation
......................................................................
Patch Set 2: I would prefer that you didn't submit this
(4 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
Line 112: public static boolean setDiskAlias(BaseDisk disk, VM vm) {
Line 113: return setDiskAlias(disk, vm, nullSafeGetCount(vm));
Line 114: }
Line 115:
Line 116: public static boolean setDiskAlias(BaseDisk disk, VM vm, int
count) {
why another method here?
just set int count = nullSafeGetCount(vm) ?
Line 117: if (disk != null) {
Line 118: String vmName = nullSafeGetVmName(vm);
Line 119: disk.setDiskAlias(getSuggestedDiskAlias(disk, vmName,
count));
Line 120: return true;
Line 113: return setDiskAlias(disk, vm, nullSafeGetCount(vm));
Line 114: }
Line 115:
Line 116: public static boolean setDiskAlias(BaseDisk disk, VM vm, int
count) {
Line 117: if (disk != null) {
why not reverse this and return early?
Line 118: String vmName = nullSafeGetVmName(vm);
Line 119: disk.setDiskAlias(getSuggestedDiskAlias(disk, vmName,
count));
Line 120: return true;
Line 121: } else {
Line 114: }
Line 115:
Line 116: public static boolean setDiskAlias(BaseDisk disk, VM vm, int
count) {
Line 117: if (disk != null) {
Line 118: String vmName = nullSafeGetVmName(vm);
do you foresee usage of these methods? (nullSafe...)
if so, I would push them into class VM otherwise I would just write inline
Line 119: disk.setDiskAlias(getSuggestedDiskAlias(disk, vmName,
count));
Line 120: return true;
Line 121: } else {
Line 122: log.errorFormat("Disk object is null");
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
Line 637: }
Line 638: }
Line 639: disk.setcreation_date(new Date());
Line 640: BaseImagesCommand.saveImage(disk);
Line 641: ImagesHandler.setDiskAlias(disk, getVm(),
aliasCounter);
why not increment here?
Line 642: getBaseDiskDao().save(disk);
Line 643: saveDiskImageDynamic(disk);
Line 644: }
Line 645:
--
To view, visit http://gerrit.ovirt.org/9629
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibdd6525529d3d5e0c8ee2c86b418562929118207
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Alissa Bonas <[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: Vered Volansky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches