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
This commit is contained in:
EK 2019-06-27 06:36:27 +03:00 committed by Rohit Yadav
parent 2c3c88e209
commit f9998e418c

View File

@ -2033,6 +2033,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
throw new InvalidParameterValueException("Volume must be in ready state");
}
if (vol.getPoolId() == storagePoolId) {
throw new InvalidParameterValueException("Volume " + vol + " is already on the destination storage pool");
}
boolean liveMigrateVolume = false;
Long instanceId = vol.getInstanceId();
Long srcClusterId = null;
@ -3384,4 +3388,4 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {ConcurrentMigrationsThresholdPerDatastore};
}
}
}