From 989e88e03fa50d61518474630ec0e0ff6a2b552b Mon Sep 17 00:00:00 2001 From: prachi Date: Mon, 5 Mar 2012 16:42:37 -0800 Subject: [PATCH] Bug 14000 - Neither Admin or regular user can create a VM when the Pod is disabled Bug 14006 - Admin could not create a VM when the cluster is Disabled Changes: - For Root admin, planner will not filter out the disabled pods or clusters from the resource list --- .../src/com/cloud/deploy/FirstFitPlanner.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java index a11c0bde033..f24897693f3 100755 --- a/server/src/com/cloud/deploy/FirstFitPlanner.java +++ b/server/src/com/cloud/deploy/FirstFitPlanner.java @@ -297,13 +297,15 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner { } podsWithCapacity.removeAll(avoid.getPodsToAvoid()); } - List disabledPods = listDisabledPods(plan.getDataCenterId()); - if(!disabledPods.isEmpty()){ - if (s_logger.isDebugEnabled()) { - s_logger.debug("Removing from the podId list these pods that are disabled: "+ disabledPods); + if(!isRootAdmin(plan.getReservationContext())){ + List disabledPods = listDisabledPods(plan.getDataCenterId()); + if(!disabledPods.isEmpty()){ + if (s_logger.isDebugEnabled()) { + s_logger.debug("Removing from the podId list these pods that are disabled: "+ disabledPods); + } + podsWithCapacity.removeAll(disabledPods); } - podsWithCapacity.removeAll(disabledPods); - } + } }else{ if (s_logger.isDebugEnabled()) { s_logger.debug("No pods found having a host with enough capacity, returning."); @@ -357,18 +359,20 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner { prioritizedClusterIds.removeAll(avoid.getClustersToAvoid()); } - List disabledClusters = new ArrayList(); - if(isZone){ - disabledClusters = listDisabledClusters(plan.getDataCenterId(), null); - }else{ - disabledClusters = listDisabledClusters(plan.getDataCenterId(), id); - } - if(!disabledClusters.isEmpty()){ - if (s_logger.isDebugEnabled()) { - s_logger.debug("Removing from the clusterId list these clusters that are disabled/clusters under disabled pods: "+ disabledClusters); + if(!isRootAdmin(plan.getReservationContext())){ + List disabledClusters = new ArrayList(); + if(isZone){ + disabledClusters = listDisabledClusters(plan.getDataCenterId(), null); + }else{ + disabledClusters = listDisabledClusters(plan.getDataCenterId(), id); } - prioritizedClusterIds.removeAll(disabledClusters); - } + if(!disabledClusters.isEmpty()){ + if (s_logger.isDebugEnabled()) { + s_logger.debug("Removing from the clusterId list these clusters that are disabled/clusters under disabled pods: "+ disabledClusters); + } + prioritizedClusterIds.removeAll(disabledClusters); + } + } }else{ if (s_logger.isDebugEnabled()) { s_logger.debug("No clusters found having a host with enough capacity, returning.");