Maor Lipchuk has posted comments on this change.

Change subject: core: validate storage format by data center version
......................................................................


Patch Set 4: (4 inline comments)

Some cosmetic suggestions can make the method much shorter

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
Line 151:         return isStorageFormatSupportedByStoragePool() && 
isStorageFormatSupportedByStorageTypeAndFunction();
Line 152:     }
Line 153: 
Line 154:     private boolean isStorageFormatSupportedByStoragePool() {
Line 155:         StorageFormatType storageFormat = 
getStorageDomain().getStorageFormat();
You can neglect the use of storageFormat , and simple use 
getStorageDomain().getStorageFormat() when you need
Line 156:         storage_pool targetStoragePool = getStoragePool();
Line 157: 
Line 158:         Set<StorageFormatType> supportedStorageFormats;
Line 159:         if (targetStoragePool == null) {


Line 154:     private boolean isStorageFormatSupportedByStoragePool() {
Line 155:         StorageFormatType storageFormat = 
getStorageDomain().getStorageFormat();
Line 156:         storage_pool targetStoragePool = getStoragePool();
Line 157: 
Line 158:         Set<StorageFormatType> supportedStorageFormats;
Why not declaring this when setting it already
Line 159:         if (targetStoragePool == null) {
Line 160:             targetStoragePool = 
getStoragePoolDAO().get(getVds().getstorage_pool_id());
Line 161:             if (targetStoragePool == null) {
Line 162:                 return false;


Line 161:             if (targetStoragePool == null) {
Line 162:                 return false;
Line 163:             }
Line 164:         }
Line 165:         supportedStorageFormats = 
getSupportedStorageFormatSet(targetStoragePool.getcompatibility_version());
Why not declaring it here.
Line 166: 
Line 167:         if (!supportedStorageFormats.contains(storageFormat)) {
Line 168:             return false;
Line 169:         }


Line 163:             }
Line 164:         }
Line 165:         supportedStorageFormats = 
getSupportedStorageFormatSet(targetStoragePool.getcompatibility_version());
Line 166: 
Line 167:         if (!supportedStorageFormats.contains(storageFormat)) {
You already in the last condition you can simply return the condition itself:
 
 return supportedStorageFormats.contains(storageFormat)
Line 168:             return false;
Line 169:         }
Line 170: 
Line 171:         return true;


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia062c1587bc6c35c7ec27270d450d1e312742086
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Ayal Baron <aba...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Itamar Heim <ih...@redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to