You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2014/01/10 19:10:17 UTC

git commit: updated refs/heads/4.2 to e5fc9fd

Updated Branches:
  refs/heads/4.2 9f03150a4 -> e5fc9fdef


CLOUDSTACK-5853
Create two storage pools, one with storage tag X, one with storage tag Y.
Create a service offering with storage tag X.
Create a disk offering with storage tag Y.
Attempt to deploy a virtual machine with a datadisk, using given offerings, it fails.

Deployment planner keeps a global object 'avoid'. It loops through each volume to
be created, asking storage allocators for matching pools, passing this avoid object.

First disk matches a pool or pools, adds ALL other pools to avoid object, then
deployment planner attaches matching pools to a list for that disk.

Second disk matches a pool, adds all other pools to avoid object, then deployment
planner says "wait, matching pool is in avoid, can't use it". Oops. In fact, at this
point ALL pools are in avoid (unless there are other pools that have both tags).

Need to remove matching pool from the avoid set during each select phase.


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

Branch: refs/heads/4.2
Commit: e5fc9fdef9d66172b870cfabecccf3ca38207ed0
Parents: 9f03150
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Fri Jan 10 11:02:35 2014 -0700
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Fri Jan 10 11:02:35 2014 -0700

----------------------------------------------------------------------
 api/src/com/cloud/deploy/DeploymentPlanner.java              | 6 ++++++
 .../storage/allocator/ClusterScopeStoragePoolAllocator.java  | 8 ++++++++
 .../storage/allocator/ZoneWideStoragePoolAllocator.java      | 6 ++++++
 3 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5fc9fde/api/src/com/cloud/deploy/DeploymentPlanner.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/deploy/DeploymentPlanner.java b/api/src/com/cloud/deploy/DeploymentPlanner.java
index 32e4f9e..bed342c 100644
--- a/api/src/com/cloud/deploy/DeploymentPlanner.java
+++ b/api/src/com/cloud/deploy/DeploymentPlanner.java
@@ -178,6 +178,12 @@ public interface DeploymentPlanner extends Adapter {
             _poolIds.add(poolId);
         }
 
+        public void removePool(long poolId) {
+            if (_poolIds != null) {
+                _poolIds.remove(poolId);
+            }
+        }
+
         public void addDataCenter(long dataCenterId) {
             if (_dcIds == null) {
                 _dcIds = new HashSet<Long>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5fc9fde/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 66d5505..349e45c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
@@ -79,14 +79,22 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
         }
 
         List<StoragePoolVO> pools = _storagePoolDao.findPoolsByTags(dcId, podId, clusterId, dskCh.getTags());
+        s_logger.debug("Found pools matching tags: " + pools);
 
         // add remaining pools in cluster, that did not match tags, to avoid set
         List<StoragePoolVO> allPools = _storagePoolDao.findPoolsByTags(dcId, podId, clusterId, null);
         allPools.removeAll(pools);
         for (StoragePoolVO pool : allPools) {
+            s_logger.debug("Adding pool " + pool + " to avoid set since it did not match tags");
             avoid.addPool(pool.getId());
         }
 
+        // make sure our matching pool was not in avoid set
+        for (StoragePoolVO pool : pools) {
+            s_logger.debug("Removing pool " + pool + " from avoid set, must have been inserted when searching for another disk's tag");
+            avoid.removePool(pool.getId());
+        }
+
         if (pools.size() == 0) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("No storage pools available for " + ServiceOffering.StorageType.shared.toString() + " volume allocation, returning");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5fc9fde/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
index db604c7..506f8b0 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
@@ -92,6 +92,12 @@ public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
             avoid.addPool(pool.getId());
         }
 
+        // make sure our matching pool was not in avoid set
+        for (StoragePoolVO pool : storagePoolsByHypervisor) {
+            s_logger.debug("Removing pool " + pool + " from avoid set, must have been inserted when searching for another disk's tag");
+            avoid.removePool(pool.getId());
+        }
+
         for (StoragePoolVO storage : storagePools) {
             if (suitablePools.size() == returnUpTo) {
                 break;