Updated Branches: refs/heads/4.2 2814d2360 -> 7ba48e7c6
CS-18506: stopped vm cant start after disable threshold has been reached Changes: - Do not do the stoarge capacity check for a VM having READY Volumes that are already present on the storagepool. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7ba48e7c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7ba48e7c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7ba48e7c Branch: refs/heads/4.2 Commit: 7ba48e7c65a64497ed236d3985b4a04bd16dc2d2 Parents: 2814d23 Author: Prachi Damle <[email protected]> Authored: Mon Nov 11 17:59:49 2013 -0800 Committer: Prachi Damle <[email protected]> Committed: Mon Nov 11 18:00:18 2013 -0800 ---------------------------------------------------------------------- .../deploy/DeploymentPlanningManagerImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ba48e7c/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 52abe83..efcc12a 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -310,7 +310,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy List<Host> suitableHosts = new ArrayList<Host>(); suitableHosts.add(host); Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources( - suitableHosts, suitableVolumeStoragePools, avoids, getPlannerUsage(planner,vmProfile, plan ,avoids)); + suitableHosts, suitableVolumeStoragePools, avoids, + getPlannerUsage(planner, vmProfile, plan, avoids), readyAndReusedVolumes); if (potentialResources != null) { Pod pod = _podDao.findById(host.getPodId()); Cluster cluster = _clusterDao.findById(host.getClusterId()); @@ -370,7 +371,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy List<Host> suitableHosts = new ArrayList<Host>(); suitableHosts.add(host); Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources( - suitableHosts, suitableVolumeStoragePools, avoids, getPlannerUsage(planner,vmProfile, plan ,avoids)); + suitableHosts, suitableVolumeStoragePools, avoids, + getPlannerUsage(planner, vmProfile, plan, avoids), readyAndReusedVolumes); if (potentialResources != null) { Pod pod = _podDao.findById(host.getPodId()); Cluster cluster = _clusterDao.findById(host.getClusterId()); @@ -888,7 +890,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy // choose the potential host and pool for the VM if (!suitableVolumeStoragePools.isEmpty()) { Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources( - suitableHosts, suitableVolumeStoragePools, avoid, resourceUsageRequired); + suitableHosts, suitableVolumeStoragePools, avoid, resourceUsageRequired, + readyAndReusedVolumes); if (potentialResources != null) { Pod pod = _podDao.findById(clusterVO.getPodId()); @@ -1016,11 +1019,16 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy } protected Pair<Host, Map<Volume, StoragePool>> findPotentialDeploymentResources(List<Host> suitableHosts, Map<Volume, List<StoragePool>> suitableVolumeStoragePools, ExcludeList avoid, - DeploymentPlanner.PlannerResourceUsage resourceUsageRequired) { + DeploymentPlanner.PlannerResourceUsage resourceUsageRequired, List<Volume> readyAndReusedVolumes) { s_logger.debug("Trying to find a potenial host and associated storage pools from the suitable host/pool lists for this VM"); boolean hostCanAccessPool = false; boolean haveEnoughSpace = false; + + if (readyAndReusedVolumes == null) { + readyAndReusedVolumes = new ArrayList<Volume>(); + } + Map<Volume, StoragePool> storage = new HashMap<Volume, StoragePool>(); TreeSet<Volume> volumesOrderBySizeDesc = new TreeSet<Volume>(new Comparator<Volume>() { @Override @@ -1044,7 +1052,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy for (StoragePool potentialSPool : volumePoolList) { if (hostCanAccessSPool(potentialHost, potentialSPool)) { hostCanAccessPool = true; - if (multipleVolume) { + if (multipleVolume && !readyAndReusedVolumes.contains(vol)) { List<Volume> requestVolumes = null; if (volumeAllocationMap.containsKey(potentialSPool)) requestVolumes = volumeAllocationMap.get(potentialSPool);
