bug 11047: change the put storage pool into maintenance mode: 1. only look at the available storoge pool in its own dc to decide to start vms created on it. 2. if start vm failed, don't throw exception, as these vms are marked stopped already, admin can start these vm by himself.

status 11047: resolved fixed
Reviewed-by: frank
This commit is contained in:
Edison Su 2011-09-21 16:16:03 -07:00
parent f685b8825d
commit d722766427
3 changed files with 11 additions and 4 deletions

View File

@ -2095,7 +2095,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
// 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
List<StoragePoolVO> upPools = _storagePoolDao.listByStatus(StoragePoolStatus.Up);
List<StoragePoolVO> upPools = _storagePoolDao.listByStatusInZone(primaryStorage.getDataCenterId(), StoragePoolStatus.Up);
if (upPools == null || upPools.size() == 0) {
restart = false;
@ -2161,7 +2161,6 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
if (_vmMgr.advanceStart(consoleProxy, null, user, account) == null) {
String errorMsg = "There was an error starting the console proxy id: " + vmInstance.getId() + " on another storage pool, cannot enable primary storage maintenance";
s_logger.warn(errorMsg);
throw new CloudRuntimeException(errorMsg);
} else {
// update work status
work.setStartedAfterMaintenance(true);
@ -2201,7 +2200,6 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
if (_vmMgr.advanceStart(secStrgVm, null, user, account) == null) {
String errorMsg = "There was an error starting the ssvm id: " + vmInstance.getId() + " on another storage pool, cannot enable primary storage maintenance";
s_logger.warn(errorMsg);
throw new CloudRuntimeException(errorMsg);
} else {
// update work status
work.setStartedAfterMaintenance(true);
@ -2227,7 +2225,6 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
if (_vmMgr.advanceStart(domR, null, user, account) == null) {
String errorMsg = "There was an error starting the domain router id: " + vmInstance.getId() + " on another storage pool, cannot enable primary storage maintenance";
s_logger.warn(errorMsg);
throw new CloudRuntimeException(errorMsg);
} else {
// update work status
work.setStartedAfterMaintenance(true);

View File

@ -107,4 +107,6 @@ public interface StoragePoolDao extends GenericDao<StoragePoolVO, Long> {
long countPoolsByStatus(StoragePoolStatus... statuses);
List<StoragePoolVO> listByStatusInZone(long dcId, StoragePoolStatus status);
}

View File

@ -167,6 +167,14 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
sc.setParameters("status", status);
return listBy(sc);
}
@Override
public List<StoragePoolVO> listByStatusInZone(long dcId, StoragePoolStatus status){
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("status", status);
sc.setParameters("datacenterId", dcId);
return listBy(sc);
}
@Override
public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) {