Liron Aravot has posted comments on this change.

Change subject: core: Add a CDA on attach to an uninitialized Data Center
......................................................................


Patch Set 18:

(5 comments)

http://gerrit.ovirt.org/#/c/34239/18/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java:

Line 309:         return Collections.singletonMap(getStoragePoolId().toString(),
Line 310:                 
LockMessagesMatchUtil.makeLockingPair(LockingGroup.POOL, 
VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED));
Line 311:     }
Line 312: 
Line 313:     private boolean isDomainAttachedToDifferentStoragePool() {
/s/isDomainAttachedToDifferentStoragePool/checkDomainAttachedToDifferentStoragePool
 to comply with the other names here
Line 314:         if (getStoragePool().getStatus() == 
StoragePoolStatus.Uninitialized) {
Line 315:             for (Guid storageDomainId : 
getParameters().getStorages()) {
Line 316:                 StorageDomain domain = 
DbFacade.getInstance().getStorageDomainDao().get(storageDomainId);
Line 317:                 if (domain.getStorageDomainType() == 
StorageDomainType.Data && isStorageDomainAttachedToStoragePool(domain)) {


Line 312: 
Line 313:     private boolean isDomainAttachedToDifferentStoragePool() {
Line 314:         if (getStoragePool().getStatus() == 
StoragePoolStatus.Uninitialized) {
Line 315:             for (Guid storageDomainId : 
getParameters().getStorages()) {
Line 316:                 StorageDomain domain = 
DbFacade.getInstance().getStorageDomainDao().get(storageDomainId);
it'll be better to load StorageDomainStatic here, not StorageDomain, we need 
only the static data to check the type
Line 317:                 if (domain.getStorageDomainType() == 
StorageDomainType.Data && isStorageDomainAttachedToStoragePool(domain)) {
Line 318:                     
addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_ADD_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN);
Line 319:                     return false;
Line 320:                 }


Line 313:     private boolean isDomainAttachedToDifferentStoragePool() {
Line 314:         if (getStoragePool().getStatus() == 
StoragePoolStatus.Uninitialized) {
Line 315:             for (Guid storageDomainId : 
getParameters().getStorages()) {
Line 316:                 StorageDomain domain = 
DbFacade.getInstance().getStorageDomainDao().get(storageDomainId);
Line 317:                 if (domain.getStorageDomainType() == 
StorageDomainType.Data && isStorageDomainAttachedToStoragePool(domain)) {
you forgot to change to isDataDomain as Allon requested
Line 318:                     
addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_ADD_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN);
Line 319:                     return false;
Line 320:                 }
Line 321:             }


Line 315:             for (Guid storageDomainId : 
getParameters().getStorages()) {
Line 316:                 StorageDomain domain = 
DbFacade.getInstance().getStorageDomainDao().get(storageDomainId);
Line 317:                 if (domain.getStorageDomainType() == 
StorageDomainType.Data && isStorageDomainAttachedToStoragePool(domain)) {
Line 318:                     
addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_ADD_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN);
Line 319:                     return false;
failCanDo as Allon requested
Line 320:                 }
Line 321:             }
Line 322:         }
Line 323:         return true;


Line 326:     private boolean 
isStorageDomainAttachedToStoragePool(StorageDomain storageDomain) {
Line 327:         List<StorageDomain> storageDomainList =
Line 328:                 (List<StorageDomain>) 
getBackend().runInternalQuery(VdcQueryType.GetStorageDomainsWithAttachedStoragePoolGuid,
Line 329:                         new 
StorageDomainsAndStoragePoolIdQueryParameters(storageDomain, 
getStoragePoolId())).getReturnValue();
Line 330:         return !storageDomainList.isEmpty();
you might get here a NPE if the query return value is null (and it can be), add 
a check to the return statement..
..
Line 331:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaba522270660aaf2b58e7e771e31c9084824076f
Gerrit-PatchSet: 18
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Tal Nisan <tni...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to