Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9534711FE1 for ; Wed, 30 Jul 2014 07:29:27 +0000 (UTC) Received: (qmail 97329 invoked by uid 500); 30 Jul 2014 07:29:27 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 97300 invoked by uid 500); 30 Jul 2014 07:29:27 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 97291 invoked by uid 99); 30 Jul 2014 07:29:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2014 07:29:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 008639508EB; Wed, 30 Jul 2014 07:29:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: devdeep@apache.org To: commits@cloudstack.apache.org Message-Id: <9d045a5d306a45b896246811bfc5f146@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to fc14fe1 Date: Wed, 30 Jul 2014 07:29:26 +0000 (UTC) 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 Authored: Wed Jul 30 12:02:43 2014 +0530 Committer: Devdeep Singh 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");