mirror of https://github.com/apache/cloudstack.git
bug 5147: this checkin ensures that we cover some more corner cases, in particular, to not allow an execution when we have pools in inconsistent states (maintenance, prepareformaintenance or errorinmaintenance)
This commit is contained in:
parent
c889626278
commit
ec01e0b423
|
|
@ -73,7 +73,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseCmd {
|
|||
}
|
||||
|
||||
if(getManagementServer().getPsMaintenanceCount(storagePool.getPodId()) > 0){
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"There already exist other storage pools in maintenance");
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"There already exist other storage pools in maintenance process");
|
||||
}
|
||||
|
||||
long jobId = 0;
|
||||
|
|
|
|||
|
|
@ -8733,12 +8733,15 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
|
||||
@Override
|
||||
public long getPsMaintenanceCount(long podId){
|
||||
List<StoragePoolVO> poolsInMaintenance = _poolDao.listPoolsByStatus(Status.Maintenance);
|
||||
List<StoragePoolVO> poolsInTransition = new ArrayList<StoragePoolVO>();
|
||||
poolsInTransition.addAll(_poolDao.listPoolsByStatus(Status.Maintenance));
|
||||
poolsInTransition.addAll(_poolDao.listPoolsByStatus(Status.PrepareForMaintenance));
|
||||
poolsInTransition.addAll(_poolDao.listPoolsByStatus(Status.ErrorInMaintenance));
|
||||
|
||||
if(poolsInMaintenance==null)
|
||||
if(poolsInTransition==null)
|
||||
return 0;
|
||||
else
|
||||
return poolsInMaintenance.size();
|
||||
return poolsInTransition.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue