Skip to content

Commit 7ba48e7

Browse files
author
Prachi Damle
committed
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.
1 parent 2814d23 commit 7ba48e7

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

‎server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ public DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualM
310310
List<Host> suitableHosts = new ArrayList<Host>();
311311
suitableHosts.add(host);
312312
Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources(
313-
suitableHosts, suitableVolumeStoragePools, avoids, getPlannerUsage(planner,vmProfile, plan ,avoids));
313+
suitableHosts, suitableVolumeStoragePools, avoids,
314+
getPlannerUsage(planner, vmProfile, plan, avoids), readyAndReusedVolumes);
314315
if (potentialResources != null) {
315316
Pod pod = _podDao.findById(host.getPodId());
316317
Cluster cluster = _clusterDao.findById(host.getClusterId());
@@ -370,7 +371,8 @@ public DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualM
370371
List<Host> suitableHosts = new ArrayList<Host>();
371372
suitableHosts.add(host);
372373
Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources(
373-
suitableHosts, suitableVolumeStoragePools, avoids, getPlannerUsage(planner,vmProfile, plan ,avoids));
374+
suitableHosts, suitableVolumeStoragePools, avoids,
375+
getPlannerUsage(planner, vmProfile, plan, avoids), readyAndReusedVolumes);
374376
if (potentialResources != null) {
375377
Pod pod = _podDao.findById(host.getPodId());
376378
Cluster cluster = _clusterDao.findById(host.getClusterId());
@@ -888,7 +890,8 @@ private DeployDestination checkClustersforDestination(List<Long> clusterList,
888890
// choose the potential host and pool for the VM
889891
if (!suitableVolumeStoragePools.isEmpty()) {
890892
Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources(
891-
suitableHosts, suitableVolumeStoragePools, avoid, resourceUsageRequired);
893+
suitableHosts, suitableVolumeStoragePools, avoid, resourceUsageRequired,
894+
readyAndReusedVolumes);
892895

893896
if (potentialResources != null) {
894897
Pod pod = _podDao.findById(clusterVO.getPodId());
@@ -1016,11 +1019,16 @@ private Pair<Boolean, Boolean> findVMStorageRequirements(VirtualMachineProfile<?
10161019
}
10171020
protected Pair<Host, Map<Volume, StoragePool>> findPotentialDeploymentResources(List<Host> suitableHosts,
10181021
Map<Volume, List<StoragePool>> suitableVolumeStoragePools, ExcludeList avoid,
1019-
DeploymentPlanner.PlannerResourceUsage resourceUsageRequired) {
1022+
DeploymentPlanner.PlannerResourceUsage resourceUsageRequired, List<Volume> readyAndReusedVolumes) {
10201023
s_logger.debug("Trying to find a potenial host and associated storage pools from the suitable host/pool lists for this VM");
10211024

10221025
boolean hostCanAccessPool = false;
10231026
boolean haveEnoughSpace = false;
1027+
1028+
if (readyAndReusedVolumes == null) {
1029+
readyAndReusedVolumes = new ArrayList<Volume>();
1030+
}
1031+
10241032
Map<Volume, StoragePool> storage = new HashMap<Volume, StoragePool>();
10251033
TreeSet<Volume> volumesOrderBySizeDesc = new TreeSet<Volume>(new Comparator<Volume>() {
10261034
@Override
@@ -1044,7 +1052,7 @@ public int compare(Volume v1, Volume v2) {
10441052
for (StoragePool potentialSPool : volumePoolList) {
10451053
if (hostCanAccessSPool(potentialHost, potentialSPool)) {
10461054
hostCanAccessPool = true;
1047-
if (multipleVolume) {
1055+
if (multipleVolume && !readyAndReusedVolumes.contains(vol)) {
10481056
List<Volume> requestVolumes = null;
10491057
if (volumeAllocationMap.containsKey(potentialSPool))
10501058
requestVolumes = volumeAllocationMap.get(potentialSPool);

0 commit comments

Comments
 (0)