bug 5147: Improvements after testing the storage maintenance across multiple sp's, with sys vms scattered across multiple sps

This commit is contained in:
abhishek 2010-09-10 13:43:37 -07:00
parent e741b7272f
commit 93261c4eb8
5 changed files with 28 additions and 6 deletions

View File

@ -103,5 +103,7 @@ public interface StoragePoolDao extends GenericDao<StoragePoolVO, Long> {
long countBy(long podId, Status... statuses);
List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid);
List<StoragePoolVO> listPoolsByStatus(Status status);
}

View File

@ -59,6 +59,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
protected final SearchBuilder<StoragePoolVO> HostPathDcSearch;
protected final SearchBuilder<StoragePoolVO> DcPodAnyClusterSearch;
protected final SearchBuilder<StoragePoolVO> DeleteLvmSearch;
protected final SearchBuilder<StoragePoolVO> StatusSearch;
protected final GenericSearchBuilder<StoragePoolVO, Long> MaintenanceCountSearch;
@ -109,6 +110,10 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
HostSearch.and("host", HostSearch.entity().getHostAddress(), SearchCriteria.Op.EQ);
HostSearch.done();
StatusSearch = createSearchBuilder();
StatusSearch.and("status",StatusSearch.entity().getStatus(),SearchCriteria.Op.EQ);
StatusSearch.done();
HostPathDcPodSearch = createSearchBuilder();
HostPathDcPodSearch.and("hostAddress", HostPathDcPodSearch.entity().getHostAddress(), SearchCriteria.Op.EQ);
HostPathDcPodSearch.and("path", HostPathDcPodSearch.entity().getPath(), SearchCriteria.Op.EQ);
@ -183,6 +188,13 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
sc.setParameters("host", hostFqdnOrIp);
return listBy(sc);
}
@Override
public List<StoragePoolVO> listPoolsByStatus(Status status){
SearchCriteria<StoragePoolVO> sc = StatusSearch.create();
sc.setParameters("status", status);
return listBy(sc);
}
@Override
public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, String host, String path) {

View File

@ -185,8 +185,9 @@ public class CreateVolumeCmd extends BaseCmd {
if(s_logger.isDebugEnabled())
s_logger.debug("CreateVolume command has been accepted, job id: " + jobId);
}
long volumeId = waitInstanceCreation(jobId);
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.VOLUME_ID.getName(), Long.valueOf(volumeId)));

View File

@ -8722,7 +8722,12 @@ public class ManagementServerImpl implements ManagementServer {
@Override
public long getPsMaintenanceCount(long podId){
return _poolDao.countBy(podId, Status.Maintenance);
List<StoragePoolVO> poolsInMaintenance = _poolDao.listPoolsByStatus(Status.Maintenance);
if(poolsInMaintenance==null)
return 0;
else
return poolsInMaintenance.size();
}
}

View File

@ -440,7 +440,9 @@ public class StorageManagerImpl implements StorageManager {
for (StoragePoolHostVO poolHost: poolHosts) {
try {
return _agentMgr.send(poolHost.getHostId(), cmds, stopOnError);
Answer[] answerRet = _agentMgr.send(poolHost.getHostId(), cmds, stopOnError);
return answerRet;
} catch (AgentUnavailableException e) {
s_logger.debug("Moving on because unable to send to " + poolHost.getHostId() + " due to " + e.getMessage());
} catch (OperationTimedoutException e) {
@ -1664,7 +1666,7 @@ public class StorageManagerImpl implements StorageManager {
_asyncMgr.updateAsyncJobAttachment(job.getId(), "volume", volume.getId());
_asyncMgr.updateAsyncJobStatus(job.getId(), BaseCmd.PROGRESS_INSTANCE_CREATED, volume.getId());
}
List<StoragePoolVO> poolsToAvoid = new ArrayList<StoragePoolVO>();
Set<Long> podsToAvoid = new HashSet<Long>();
Pair<HostPodVO, Long> pod = null;
@ -2007,9 +2009,9 @@ public class StorageManagerImpl implements StorageManager {
//check to see if other ps exist
//if they do, then we can migrate over the system vms to them
//if they dont, then just stop all vms on this one
count = _storagePoolDao.countBy(primaryStorage.getPodId(), Status.Up);
List<StoragePoolVO> upPools = _storagePoolDao.listPoolsByStatus(Status.Up);
if(count == 0)
if(upPools==null || upPools.size()==0)
restart = false;
//2. Get a list of all the volumes within this storage pool