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:
abhishek 2010-09-10 14:50:47 -07:00
parent c889626278
commit ec01e0b423
2 changed files with 7 additions and 4 deletions

View File

@ -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;

View File

@ -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