This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new f9998e4  server: warn on migration of volumes within the same storage 
pool (#3424)
f9998e4 is described below

commit f9998e418c483afb2ce3f8b26def31d66223baf2
Author: EK <20902920+ki...@users.noreply.github.com>
AuthorDate: Thu Jun 27 06:36:27 2019 +0300

    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
---
 server/src/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 099f88b..182379a 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
+}

Reply via email to