From 13a9b941930160a9634e27865a03cdc8aed6d6c3 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Wed, 24 Jul 2013 14:36:29 -0700 Subject: [PATCH] CLOUDSTACK-3665:Failed to create volume from snapshot. --- .../allocator/ClusterScopeStoragePoolAllocator.java | 10 +++++++--- .../storage/allocator/LocalStoragePoolAllocator.java | 3 ++- .../storage/allocator/RandomStoragePoolAllocator.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) 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 b1105ba31a7..6b076d39f1a 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java +++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java @@ -59,9 +59,13 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat Long podId = plan.getPodId(); Long clusterId = plan.getClusterId(); - if (clusterId == null) { - return null; - } + if (podId == null) { + // for zone wide storage, podId should be null. We cannot check + // clusterId == null here because it will break ClusterWide primary + // storage volume operation where + // only podId is passed into this call. + 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())); 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 310f4a1ff64..e0d0145c471 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java +++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java @@ -96,7 +96,8 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator { } } } else { - if (plan.getClusterId() == null) { + if (plan.getPodId() == null) { + // zone wide primary storage deployment return null; } List availablePools = _storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(), 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 025a9693f98..527f0703120 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 @@ -47,7 +47,7 @@ public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator { Long podId = plan.getPodId(); Long clusterId = plan.getClusterId(); - if (clusterId == null) { + if (podId == null) { return null; }