diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index f25196d9821..db6d5e918ca 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -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 upPools = _storagePoolDao.listByStatus(StoragePoolStatus.Up); + List 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); diff --git a/server/src/com/cloud/storage/dao/StoragePoolDao.java b/server/src/com/cloud/storage/dao/StoragePoolDao.java index 201f9153eab..9aed738278c 100644 --- a/server/src/com/cloud/storage/dao/StoragePoolDao.java +++ b/server/src/com/cloud/storage/dao/StoragePoolDao.java @@ -107,4 +107,6 @@ public interface StoragePoolDao extends GenericDao { long countPoolsByStatus(StoragePoolStatus... statuses); + List listByStatusInZone(long dcId, StoragePoolStatus status); + } diff --git a/server/src/com/cloud/storage/dao/StoragePoolDaoImpl.java b/server/src/com/cloud/storage/dao/StoragePoolDaoImpl.java index 146d8e9d134..17b1d264f96 100644 --- a/server/src/com/cloud/storage/dao/StoragePoolDaoImpl.java +++ b/server/src/com/cloud/storage/dao/StoragePoolDaoImpl.java @@ -167,6 +167,14 @@ public class StoragePoolDaoImpl extends GenericDaoBase imp sc.setParameters("status", status); return listBy(sc); } + + @Override + public List listByStatusInZone(long dcId, StoragePoolStatus status){ + SearchCriteria 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) {