Updated Branches:
  refs/heads/4.2 f1706e2c4 -> 5e42d93b6

CLOUDSTACK-3665:Failed to create volume from snapshot. 


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

Branch: refs/heads/4.2
Commit: 5e42d93b6f14ce407ed9527c29fb9262d90ce07b
Parents: f1706e2
Author: Min Chen <[email protected]>
Authored: Wed Jul 24 14:36:29 2013 -0700
Committer: Min Chen <[email protected]>
Committed: Wed Jul 24 14:37:02 2013 -0700

----------------------------------------------------------------------
 .../allocator/ClusterScopeStoragePoolAllocator.java       | 10 +++++++---
 .../storage/allocator/LocalStoragePoolAllocator.java      |  3 ++-
 .../storage/allocator/RandomStoragePoolAllocator.java     |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e42d93b/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 41afa83..a026290 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()));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e42d93b/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 4056fe7..58f3c7f 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<StoragePoolVO> availablePools = 
_storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e42d93b/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 fda787f..6a5bf65 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;
                }
 

Reply via email to