From f9998e418c483afb2ce3f8b26def31d66223baf2 Mon Sep 17 00:00:00 2001 From: EK <20902920+kioie@users.noreply.github.com> Date: Thu, 27 Jun 2019 06:36:27 +0300 Subject: [PATCH] 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 --- .../main/java/com/cloud/storage/VolumeApiServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 099f88bde42..182379acbab 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -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}; } -} \ No newline at end of file +}