You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2014/07/30 09:29:26 UTC

git commit: updated refs/heads/master to fc14fe1

Repository: cloudstack
Updated Branches:
  refs/heads/master ec10e8db2 -> fc14fe113


CLOUDSTACK-7201. Before initating  out live volume migration to a pool check that if the
destination pool is a cluster wide pool, it should be in the same cluster as the vm to
which the volume is attached.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fc14fe11
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fc14fe11
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fc14fe11

Branch: refs/heads/master
Commit: fc14fe1132d03ad8828faf434989d3cd394d023b
Parents: ec10e8d
Author: Devdeep Singh <de...@gmail.com>
Authored: Wed Jul 30 12:02:43 2014 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed Jul 30 13:01:29 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc14fe11/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 7432fc4..7ec4798 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1669,6 +1669,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
         boolean liveMigrateVolume = false;
         Long instanceId = vol.getInstanceId();
+        Long srcClusterId = null;
         VMInstanceVO vm = null;
         if (instanceId != null) {
             vm = _vmInstanceDao.findById(instanceId);
@@ -1686,6 +1687,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 HypervisorCapabilitiesVO capabilities = null;
                 if (host != null) {
                     capabilities = _hypervisorCapabilitiesDao.findByHypervisorTypeAndVersion(host.getHypervisorType(), host.getHypervisorVersion());
+                    srcClusterId = host.getClusterId();
                 }
 
                 if (capabilities != null) {
@@ -1711,6 +1713,14 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         if (_volumeMgr.volumeOnSharedStoragePool(vol)) {
             if (destPool.isLocal()) {
                 throw new InvalidParameterValueException("Migration of volume from shared to local storage pool is not supported");
+            } else {
+                // If the volume is attached to a running vm and the volume is on a shared storage pool, check
+                // to make sure that the destination storage pool is in the same cluster as the vm.
+                if (liveMigrateVolume && destPool.getClusterId() != null && srcClusterId != null) {
+                    if (!srcClusterId.equals(destPool.getClusterId())) {
+                        throw new InvalidParameterValueException("Cannot migrate a volume of a virtual machine to a storage pool in a different cluster");
+                    }
+                }
             }
         } else {
             throw new InvalidParameterValueException("Migration of volume from local storage pool is not supported");