cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject git commit: updated refs/heads/planner_reserve to e0ad980
Date Wed, 01 May 2013 21:35:20 GMT
Updated Branches:
  refs/heads/planner_reserve fe8cd8de2 -> e0ad98047


Fixing issues while testing VM deployment.


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

Branch: refs/heads/planner_reserve
Commit: e0ad9804749f661ab48523bb62cd34e39edd480e
Parents: fe8cd8d
Author: Prachi Damle <prachi@cloud.com>
Authored: Wed May 1 14:34:33 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Wed May 1 14:34:33 2013 -0700

----------------------------------------------------------------------
 client/tomcatconf/applicationContext.xml.in        |    4 +-
 .../deploy/DeploymentPlanningManagerImpl.java      |   39 ++++++++++-----
 2 files changed, 28 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e0ad9804/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index a341f33..81d8efa 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -615,8 +615,6 @@
 
   <bean id="FirstFitPlanner" class="com.cloud.deploy.FirstFitPlanner">
     <property name="name" value="FirstFitPlanner"/>
-    <property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
-    <property name="HostAllocators" value="#{hostAllocators.Adapters}" />
   </bean>
   
   <bean id="resourceManagerImpl" class="com.cloud.resource.ResourceManagerImpl" >
@@ -835,6 +833,8 @@
   <bean id="DeploymentPlanningManager" class="com.cloud.deploy.DeploymentPlanningManagerImpl">
     <property name="Planners" value="#{deploymentPlanners.Adapters}" />
 	<property name="AffinityGroupProcessors" value="#{affinityProcessors.Adapters}" />
+    <property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
+    <property name="HostAllocators" value="#{hostAllocators.Adapters}" />
   </bean>
   
   <bean id="AffinityGroupJoinDaoImpl" class="com.cloud.api.query.dao.AffinityGroupJoinDaoImpl">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e0ad9804/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 e380adc..4a78783 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -362,12 +362,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements
Deploy
                                     avoids.getPodsToAvoid(), avoids.getClustersToAvoid(),
avoids.getHostsToAvoid(),
                                     avoids.getPoolsToAvoid());
 
-                            PlannerAvoidOutput.getDataCentersToAvoid().removeAll(PlannerAvoidInput.getDataCentersToAvoid());
-                            PlannerAvoidOutput.getPodsToAvoid().removeAll(PlannerAvoidInput.getPodsToAvoid());
-                            PlannerAvoidOutput.getClustersToAvoid().removeAll(PlannerAvoidInput.getClustersToAvoid());
-                            PlannerAvoidOutput.getHostsToAvoid().removeAll(PlannerAvoidInput.getHostsToAvoid());
-                            PlannerAvoidOutput.getPoolsToAvoid().removeAll(PlannerAvoidInput.getPoolsToAvoid());
-
+                            resetAvoidSet(PlannerAvoidOutput, PlannerAvoidInput);
 
                             dest = checkClustersforDestination(clusterList, vmProfile, plan,
avoids, dc,
                                     getPlannerUsage(planner), PlannerAvoidOutput);
@@ -375,11 +370,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements
Deploy
                                 return dest;
                             }
                             // reset the avoid input to the planners
-                            avoids.getDataCentersToAvoid().removeAll(PlannerAvoidOutput.getDataCentersToAvoid());
-                            avoids.getPodsToAvoid().removeAll(PlannerAvoidOutput.getPodsToAvoid());
-                            avoids.getClustersToAvoid().removeAll(PlannerAvoidOutput.getClustersToAvoid());
-                            avoids.getHostsToAvoid().removeAll(PlannerAvoidOutput.getHostsToAvoid());
-                            avoids.getPoolsToAvoid().removeAll(PlannerAvoidOutput.getPoolsToAvoid());
+                            resetAvoidSet(avoids, PlannerAvoidOutput);
 
                         } else {
                             return null;
@@ -408,6 +399,24 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements
Deploy
         return dest;
     }
 
+    private void resetAvoidSet(ExcludeList avoidSet, ExcludeList removeSet) {
+        if (avoidSet.getDataCentersToAvoid() != null && removeSet.getDataCentersToAvoid()
!= null) {
+            avoidSet.getDataCentersToAvoid().removeAll(removeSet.getDataCentersToAvoid());
+        }
+        if (avoidSet.getPodsToAvoid() != null && removeSet.getPodsToAvoid() != null)
{
+            avoidSet.getPodsToAvoid().removeAll(removeSet.getPodsToAvoid());
+        }
+        if (avoidSet.getClustersToAvoid() != null && removeSet.getClustersToAvoid()
!= null) {
+            avoidSet.getClustersToAvoid().removeAll(removeSet.getClustersToAvoid());
+        }
+        if (avoidSet.getHostsToAvoid() != null && removeSet.getHostsToAvoid() !=
null) {
+            avoidSet.getHostsToAvoid().removeAll(removeSet.getHostsToAvoid());
+        }
+        if (avoidSet.getPoolsToAvoid() != null && removeSet.getPoolsToAvoid() !=
null) {
+            avoidSet.getPoolsToAvoid().removeAll(removeSet.getPoolsToAvoid());
+        }
+    }
+
     private PlannerResourceUsage getPlannerUsage(DeploymentPlanner planner) {
         if (planner instanceof DeploymentClusterPlanner) {
             return ((DeploymentClusterPlanner) planner).getResourceUsage();
@@ -619,8 +628,12 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements
Deploy
 
         // remove any hosts/pools that the planners might have added
         // to get the list of hosts/pools that Allocators flagged as 'avoid'
-        allocatorAvoidOutput.getHostsToAvoid().removeAll(plannerAvoidOutput.getHostsToAvoid());
-        allocatorAvoidOutput.getPoolsToAvoid().removeAll(plannerAvoidOutput.getPoolsToAvoid());
+        if (allocatorAvoidOutput.getHostsToAvoid() != null && plannerAvoidOutput.getHostsToAvoid()
!= null) {
+            allocatorAvoidOutput.getHostsToAvoid().removeAll(plannerAvoidOutput.getHostsToAvoid());
+        }
+        if (allocatorAvoidOutput.getPoolsToAvoid() != null && plannerAvoidOutput.getPoolsToAvoid()
!= null) {
+            allocatorAvoidOutput.getPoolsToAvoid().removeAll(plannerAvoidOutput.getPoolsToAvoid());
+        }
 
         // if all hosts or all pools in the cluster are in avoid set after this
         // pass, then put the cluster in avoid set.


Mime
View raw message