Liron Ar has posted comments on this change.

Change subject: core: Prevent usage of shareable disks on Gluster domains
......................................................................


Patch Set 2:

(5 comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
Line 149:     private boolean checkIfImageDiskCanBeAdded(VM vm) {
Line 150:         boolean returnValue;
Line 151:         DiskValidator diskValidator = 
getDiskValidator(getParameters().getDiskInfo());
Line 152: 
Line 153:         if (getParameters().getDiskInfo().isShareable() && 
getStorageDomain().getStorageType() == StorageType.GLUSTERFS) {
this should be done after the check that the domain exist on line 
161..otherwise NPE might occur.
Line 154:             returnValue = false;
Line 155:             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN);
Line 156:         }
Line 157: 


Line 151:         DiskValidator diskValidator = 
getDiskValidator(getParameters().getDiskInfo());
Line 152: 
Line 153:         if (getParameters().getDiskInfo().isShareable() && 
getStorageDomain().getStorageType() == StorageType.GLUSTERFS) {
Line 154:             returnValue = false;
Line 155:             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN);
what about tests?
Line 156:         }
Line 157: 
Line 158: 
Line 159:         // vm agnostic checks


Line 158: 
Line 159:         // vm agnostic checks
Line 160:         returnValue =
Line 161:                 validate(new 
StorageDomainValidator(getStorageDomain()).isDomainExistAndActive()) &&
Line 162:                 checkImageConfiguration() &&
just export it to a method and add it after the domain existence check..
Line 163:                 hasFreeSpace(getStorageDomain()) &&
Line 164:                 checkExceedingMaxBlockDiskSize() &&
Line 165:                 canAddShareableDisk() &&
Line 166:                 validate(diskValidator.isVirtIoScsiValid(vm));


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
Line 214:         }
Line 215: 
Line 216:         if (isUpdatedToShareable(getOldDisk(), getNewDisk())) {
Line 217: 
Line 218:             StorageDomain storageDomain = 
getStorageDomainDAO().get(((DiskImage)getNewDisk()).getStorageIds().get(0));
StorageDomainStatic should be loaded, there's no need to load the whole storage 
domain object.
Line 219:             if (storageDomain.getStorageType() == 
StorageType.GLUSTERFS) {
Line 220:                 return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN);
Line 221:             }
Line 222: 


....................................................
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmDiskCommandTest.java
Line 513:     private StorageDomain addNewStorageDomainToDisk(DiskImage 
diskImage, StorageType storageType) {
Line 514:         StorageDomain storage = new StorageDomain();
Line 515:         storage.setId(Guid.newGuid());
Line 516:         storage.setStorageType(storageType);
Line 517:         diskImage.setStorageIds(new 
ArrayList<Guid>(Arrays.asList(storage.getId())));
why not just add it to the arraylist?
Line 518:         return storage;
Line 519:     }
Line 520: 
Line 521:     private VmDevice createVmDevice(Guid diskId, Guid vmId) {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6d741c93d32fa568c1d1f10429cb325a9b01c359
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Cheryn Tan <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Liron Ar <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Sergey Gotliv <[email protected]>
Gerrit-Reviewer: Vered Volansky <[email protected]>
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to