CLOUDSTACK-4664: [ZWPS] High delay to start a stopped VM which has ROOT/DATA 
volumes migrated to Second Zone wide primary Storage(More than 10 mins)

Changes:
- DeploymentPlanningManager needs to reuse the zone wide primary storage pool 
when VM's volume is READY


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

Branch: refs/heads/master
Commit: 62d60c2b77db872e0f7d1a32e9286b4f7680e950
Parents: 7416383
Author: Prachi Damle <[email protected]>
Authored: Fri Sep 13 14:37:00 2013 -0700
Committer: Prachi Damle <[email protected]>
Committed: Wed Sep 18 16:52:07 2013 -0700

----------------------------------------------------------------------
 .../deploy/DeploymentPlanningManagerImpl.java    | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/62d60c2b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java 
b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
index 8b0257f..8cd44f4 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -37,6 +37,7 @@ import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
 import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
 import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
@@ -78,6 +79,7 @@ import com.cloud.org.Cluster;
 import com.cloud.org.Grouping;
 import com.cloud.resource.ResourceState;
 import com.cloud.storage.DiskOfferingVO;
+import com.cloud.storage.ScopeType;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.StoragePoolHostVO;
@@ -1081,11 +1083,24 @@ public class DeploymentPlanningManagerImpl extends 
ManagerBase implements Deploy
                 if (!pool.isInMaintenance()) {
                     if (!avoid.shouldAvoid(pool)) {
                         long exstPoolDcId = pool.getDataCenterId();
-
                         long exstPoolPodId = pool.getPodId() != null ? 
pool.getPodId() : -1;
                         long exstPoolClusterId = pool.getClusterId() != null ? 
pool.getClusterId() : -1;
+                        boolean canReusePool = false;
                         if (plan.getDataCenterId() == exstPoolDcId && 
plan.getPodId() == exstPoolPodId
                                 && plan.getClusterId() == exstPoolClusterId) {
+                            canReusePool = true;
+                        } else if (plan.getDataCenterId() == exstPoolDcId) {
+                            DataStore dataStore = 
this.dataStoreMgr.getPrimaryDataStore(pool.getId());
+                            if (dataStore != null && dataStore.getScope() != 
null
+                                    && dataStore.getScope().getScopeType() == 
ScopeType.ZONE) {
+                                canReusePool = true;
+                            }
+                        } else {
+                            s_logger.debug("Pool of the volume does not fit 
the specified plan, need to reallocate a pool for this volume");
+                            canReusePool = false;
+                        }
+
+                        if (canReusePool) {
                             s_logger.debug("Planner need not allocate a pool 
for this volume since its READY");
                             suitablePools.add(pool);
                             suitableVolumeStoragePools.put(toBeCreated, 
suitablePools);
@@ -1093,8 +1108,6 @@ public class DeploymentPlanningManagerImpl extends 
ManagerBase implements Deploy
                                 readyAndReusedVolumes.add(toBeCreated);
                             }
                             continue;
-                        } else {
-                            s_logger.debug("Pool of the volume does not fit 
the specified plan, need to reallocate a pool for this volume");
                         }
                     } else {
                         s_logger.debug("Pool of the volume is in avoid set, 
need to reallocate a pool for this volume");

Reply via email to