Skip to content

Commit f9998e4

Browse files
kioieyadvr
authored andcommitted
server: warn on migration of volumes within the same storage pool (#3424)
Added an if statement that catches the destination poolid as an invalid parameter if it is similer to the current poolid. Fixes #3291
1 parent 2c3c88e commit f9998e4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,10 @@ public Volume migrateVolume(MigrateVolumeCmd cmd) {
20332033
throw new InvalidParameterValueException("Volume must be in ready state");
20342034
}
20352035

2036+
if (vol.getPoolId() == storagePoolId) {
2037+
throw new InvalidParameterValueException("Volume " + vol + " is already on the destination storage pool");
2038+
}
2039+
20362040
boolean liveMigrateVolume = false;
20372041
Long instanceId = vol.getInstanceId();
20382042
Long srcClusterId = null;
@@ -3384,4 +3388,4 @@ public String getConfigComponentName() {
33843388
public ConfigKey<?>[] getConfigKeys() {
33853389
return new ConfigKey<?>[] {ConcurrentMigrationsThresholdPerDatastore};
33863390
}
3387-
}
3391+
}

0 commit comments

Comments
 (0)