CLOUDSTACK-9682: Block VM migration to a storage which is in maintainenece mode. If

the destination pool is in maintenance mode do not allow a volume to be migrated to
the storage pool. Fixed it for volume migration and vm migration with volume.
This commit is contained in:
Anshul Gangwar 2015-04-20 13:13:48 +05:30
parent 9513053f42
commit 8ef94819da
2 changed files with 6 additions and 0 deletions

View File

@ -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)) {

View File

@ -4983,6 +4983,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)) {