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 0DED410273 for ; Fri, 12 Jul 2013 22:22:10 +0000 (UTC) Received: (qmail 32216 invoked by uid 500); 12 Jul 2013 22:22:09 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 32199 invoked by uid 500); 12 Jul 2013 22:22:09 -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 32191 invoked by uid 99); 12 Jul 2013 22:22:09 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jul 2013 22:22:09 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AAA0F89BA65; Fri, 12 Jul 2013 22:22:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: edison@apache.org To: commits@cloudstack.apache.org Date: Fri, 12 Jul 2013 22:22:09 -0000 Message-Id: <3331bd05b77940d8b92c11b007d77b98@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: updated refs/heads/4.2 to 8439209 Updated Branches: refs/heads/4.2 13ec10caa -> 8439209ba CLOUDSTACK-3264: [ZWPS]NPE while finding storage pools for migration Description: Filter primary storage pools based on zonewide/clusterwide configuration when considering pools to list for storage migration of volumes. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cb96d709 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb96d709 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb96d709 Branch: refs/heads/4.2 Commit: cb96d70967832d50af0350ca896b011519b66755 Parents: 13ec10c Author: Vijayendra Bhamidipati Authored: Mon Jul 8 13:15:23 2013 -0700 Committer: Edison Su Committed: Fri Jul 12 15:21:40 2013 -0700 ---------------------------------------------------------------------- .../storage/allocator/AbstractStoragePoolAllocator.java | 3 +++ .../allocator/ClusterScopeStoragePoolAllocator.java | 3 +++ .../storage/allocator/LocalStoragePoolAllocator.java | 3 +++ .../storage/allocator/RandomStoragePoolAllocator.java | 5 +++++ server/src/com/cloud/server/ManagementServerImpl.java | 10 ++++++++-- 5 files changed, 22 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java index e16703e..89e0974 100755 --- a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java +++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java @@ -145,6 +145,9 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement protected List reOrder(List pools, VirtualMachineProfile vmProfile, DeploymentPlan plan) { + if (pools == null) { + return null; + } Account account = null; if (vmProfile.getVirtualMachine() != null) { account = vmProfile.getOwner(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java index 0933adc..41afa83 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java +++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java @@ -59,6 +59,9 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat Long podId = plan.getPodId(); Long clusterId = plan.getClusterId(); + if (clusterId == null) { + return null; + } if (dskCh.getTags() != null && dskCh.getTags().length != 0) { s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having tags:" + Arrays.toString(dskCh.getTags())); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java index ef9e84e..4056fe7 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java +++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java @@ -96,6 +96,9 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator { } } } else { + if (plan.getClusterId() == null) { + return null; + } List availablePools = _storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId(), dskCh.getTags()); for (StoragePoolVO pool : availablePools) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java ---------------------------------------------------------------------- diff --git a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java b/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java index 76ce663..fda787f 100644 --- a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java +++ b/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java @@ -46,6 +46,11 @@ public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator { long dcId = plan.getDataCenterId(); Long podId = plan.getPodId(); Long clusterId = plan.getClusterId(); + + if (clusterId == null) { + return null; + } + s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); List pools = _storagePoolDao.listBy(dcId, podId, clusterId, ScopeType.CLUSTER); if (pools.size() == 0) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/server/src/com/cloud/server/ManagementServerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 36b3879..58e4b44 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -1258,8 +1258,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe // Get all the pools available. Only shared pools are considered because only a volume on a shared pools // can be live migrated while the virtual machine stays on the same host. - List storagePools = _poolDao.findPoolsByTags(volume.getDataCenterId(), - volume.getPodId(), srcVolumePool.getClusterId(), null); + List storagePools = null; + + if (srcVolumePool.getClusterId() == null) { + storagePools = _poolDao.findZoneWideStoragePoolsByTags(volume.getDataCenterId(), null); + } else { + storagePools = _poolDao.findPoolsByTags(volume.getDataCenterId(), volume.getPodId(), srcVolumePool.getClusterId(), null); + } + storagePools.remove(srcVolumePool); for (StoragePoolVO pool : storagePools) { if (pool.isShared()) {