diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 15bb604dd8b..5be61d2ff40 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -2097,7 +2097,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; @@ -2163,7 +2163,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); @@ -2203,7 +2202,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); @@ -2229,7 +2227,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 93beee39ce0..83e01d41d61 100644 --- a/server/src/com/cloud/storage/dao/StoragePoolDao.java +++ b/server/src/com/cloud/storage/dao/StoragePoolDao.java @@ -105,4 +105,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 025be60cd14..f406348fb85 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) {