Tal Nisan has posted comments on this change.

Change subject: core: Command refactoring.
......................................................................


Patch Set 1:

(6 comments)

http://gerrit.ovirt.org/#/c/35788/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java:

Line 168:         }
Line 169:         if (!StringUtils.equals(getOldStoragePool().getName(), 
getStoragePool().getName())
Line 170:                 && !isStoragePoolUnique(getStoragePool().getName())) {
Line 171:             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NAME_ALREADY_EXIST);
Line 172:             return false;
If you're at it you can change it to:
    return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NAME_ALREADY_EXIST);
Line 173:         }
Line 174:         if ( getOldStoragePool().isLocal() != 
getStoragePool().isLocal()
Line 175:                 && 
getStorageDomainStaticDAO().getAllForStoragePool(getStoragePool().getId()).size()
 > 0) {
Line 176:             getReturnValue().getCanDoActionMessages()


Line 175:                 && 
getStorageDomainStaticDAO().getAllForStoragePool(getStoragePool().getId()).size()
 > 0) {
Line 176:             getReturnValue().getCanDoActionMessages()
Line 177:                     
.add(VdcBllMessages.ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_DOMAINS
Line 178:                             .toString());
Line 179:             return false;
Also here
Line 180:         }
Line 181:         if (!checkStoragePoolNameLengthValid()) {
Line 182:             return false;
Line 183:         }


Line 184:         if ( 
!getOldStoragePool().getcompatibility_version().equals(getStoragePool()
Line 185:                 .getcompatibility_version())) {
Line 186:             if (!isStoragePoolVersionSupported()) {
Line 187:                 
addCanDoActionMessage(VersionSupport.getUnsupportedVersionMessage());
Line 188:                 return false;
And here :)
Line 189:             }
Line 190:             // decreasing of compatibility version is allowed under 
conditions
Line 191:             else if 
(getStoragePool().getcompatibility_version().compareTo(getOldStoragePool().getcompatibility_version())
 < 0) {
Line 192:                 List<Network> networks = 
getNetworkDAO().getAllForDataCenter(getStoragePoolId());


Line 196:                     validator.setDataCenter(getStoragePool());
Line 197:                     if (!NetworkUtils.isManagementNetwork(network)
Line 198:                             || 
!validator.canNetworkCompatabilityBeDecreased()) {
Line 199:                         
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION);
Line 200:                         return false;
And here ;)
Line 201:                     }
Line 202:                 } else if (networks.size() > 1) {
Line 203:                     
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION);
Line 204:                     return false;


Line 200:                         return false;
Line 201:                     }
Line 202:                 } else if (networks.size() > 1) {
Line 203:                     
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION);
Line 204:                     return false;
And here :P
Line 205:                 }
Line 206:             } else {
Line 207:                 // Check all clusters has at least the same 
compatibility version.
Line 208:                 if  (!checkAllClustersLevel()) {


http://gerrit.ovirt.org/#/c/35788/1/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommandTest.java
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommandTest.java:

Line 94:         doReturn(vdsGroupDao).when(cmd).getVdsGroupDAO();
Line 95:         doReturn(vdsDao).when(cmd).getVdsDAO();
Line 96:         doReturn(networkDao).when(cmd).getNetworkDAO();
Line 97:         doReturn(validator).when(cmd).createStoragePoolValidator();
Line 98:         doReturn(true).when(sdList).isEmpty();
How is this related to the command change?
Tests should not be changed cause of a refactoring in the command
Line 99: 
Line 100:         
mcr.mockConfigValue(ConfigValues.AutoRegistrationDefaultVdsGroupID, 
DEFAULT_VDS_GROUP_ID);
Line 101:         mcr.mockConfigValue(ConfigValues.ManagementNetwork, 
"test_mgmt");
Line 102:         mcr.mockConfigValue(ConfigValues.NonVmNetworkSupported, 
false);


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd0c28eb86af753a7e48e845da23fc5feca2019a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Amit Aviram <[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