mirror of https://github.com/apache/cloudstack.git
Merge pull request #1838 from anshul1886/CLOUDSTACK-9682
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. * pr/1838: 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. Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
This commit is contained in:
commit
d84347ba8c
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue