Allon Mureinik has posted comments on this change.

Change subject: core: Add alias and description for disk meta data
......................................................................


Patch Set 13:

(5 comments)

http://gerrit.ovirt.org/#/c/34163/13/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java:

Line 401:                 && 
(!getOldDisk().getDiskAlias().equals(getNewDisk().getDiskAlias()) || 
!getOldDisk().getDiskDescription()
Line 402:                         .equals(getNewDisk().getDiskDescription()))) {
Line 403:             return true;
Line 404:         }
Line 405:         return false;
Agree with the above comments.
Also - if it's just a boolean check - drop the if, and just return the boolean.
Line 406:     }
Line 407: 
Line 408:     private void updateMetaDataDescription(DiskImage diskImage) {
Line 409:         try {


Line 412:                             diskImage.getStorageIds().get(0),
Line 413:                             diskImage.getId(),
Line 414:                             diskImage.getImageId(),
Line 415:                             getJsonDiskDescription());
Line 416:             runVdsCommand(VDSCommandType.SetVolumeDescription, 
vdsCommandParameters);
> try to update only if the status of the domain/pool makes sense  (Active/Up
ack.
Some of this logic already exists in validateCanResizeDisk() - it should be 
refactored out, perhaps to a more generic method like canUpdateOnStorage or 
something like that
Line 417:         } catch (Exception e) {
Line 418:             StorageDomain storageDomain =
Line 419:                     
getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0),
Line 420:                             getVm().getStoragePoolId());


Line 430:         try {
Line 431:             return 
ImagesHandler.getJsonDiskDescription(getParameters().getDiskInfo().getDiskAlias(),
Line 432:                     
getParameters().getDiskInfo().getDiskDescription());
Line 433:         } catch (IOException e) {
Line 434:             throw new RuntimeException("Exception while generating 
json for disk", e);
> remove the try-catch, that will never happen. and if it does, it will be ca
ack
Line 435:         }
Line 436:     }
Line 437: 
Line 438:     protected void updateDiskProfile() {


http://gerrit.ovirt.org/#/c/34163/13/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImagesHandlerTest.java
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImagesHandlerTest.java:

Line 125:         String diskAlias = null;
Line 126:         try {
Line 127:             diskAlias = 
ImagesHandler.getJsonDiskDescription("DiskAlias", "DiskDescription");
Line 128:         } catch (IOException e) {
Line 129:             // Do nothing. Test should fail.
> why not just define the method as throws exception?
yup
Line 130:         }
Line 131:         assertTrue("Should be map of disk alias and disk description",
Line 132:                 
diskAlias.equals("{\"DiskDescription\":\"DiskDescription\",\"DiskAlias\":\"DiskAlias\"}"));
Line 133:     }


Line 129:             // Do nothing. Test should fail.
Line 130:         }
Line 131:         assertTrue("Should be map of disk alias and disk description",
Line 132:                 
diskAlias.equals("{\"DiskDescription\":\"DiskDescription\",\"DiskAlias\":\"DiskAlias\"}"));
Line 133:     }
missing: a test for an empty ("") description and a null description.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie2642ae7016579ead699509426e01ac2010bd374
Gerrit-PatchSet: 13
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[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