Skip to content

Commit d84347b

Browse files
committed
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>
2 parents bf2f441 + 8ef9481 commit d84347b

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

server/src/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,9 @@ public Volume migrateVolume(MigrateVolumeCmd cmd) {
19171917
StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
19181918
if (destPool == null) {
19191919
throw new InvalidParameterValueException("Failed to find the destination storage pool: " + storagePoolId);
1920+
} else if (destPool.isInMaintenance()) {
1921+
throw new InvalidParameterValueException("Cannot migrate volume " + vol + "to the destination storage pool " + destPool.getName() +
1922+
" as the storage pool is in maintenance mode.");
19201923
}
19211924

19221925
if (_volumeMgr.volumeOnSharedStoragePool(vol)) {

server/src/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4988,6 +4988,9 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
49884988
throw new InvalidParameterValueException("There is no volume present with the given id " + entry.getKey());
49894989
} else if (pool == null) {
49904990
throw new InvalidParameterValueException("There is no storage pool present with the given id " + entry.getValue());
4991+
} else if (pool.isInMaintenance()) {
4992+
throw new InvalidParameterValueException("Cannot migrate volume " + volume + "to the destination storage pool " + pool.getName() +
4993+
" as the storage pool is in maintenance mode.");
49914994
} else {
49924995
// Verify the volume given belongs to the vm.
49934996
if (!vmVolumes.contains(volume)) {

0 commit comments

Comments
 (0)