diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 89e1fd90b4e..c9dba012cf8 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -1917,6 +1917,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); if (destPool == null) { throw new InvalidParameterValueException("Failed to find the destination storage pool: " + storagePoolId); + } else if (destPool.isInMaintenance()) { + throw new InvalidParameterValueException("Cannot migrate volume " + vol + "to the destination storage pool " + destPool.getName() + + " as the storage pool is in maintenance mode."); } if (_volumeMgr.volumeOnSharedStoragePool(vol)) { diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index f7449e78c8d..fcd2d8c85e5 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -4988,6 +4988,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir throw new InvalidParameterValueException("There is no volume present with the given id " + entry.getKey()); } else if (pool == null) { throw new InvalidParameterValueException("There is no storage pool present with the given id " + entry.getValue()); + } else if (pool.isInMaintenance()) { + throw new InvalidParameterValueException("Cannot migrate volume " + volume + "to the destination storage pool " + pool.getName() + + " as the storage pool is in maintenance mode."); } else { // Verify the volume given belongs to the vm. if (!vmVolumes.contains(volume)) {