cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject git commit: refs/heads/master - CLOUDSTACK-1604: deploy VM failed when global setting "vm.allocation.algorithm" is set to "userdispersing"
Date Thu, 14 Mar 2013 18:40:53 GMT
Updated Branches:
  refs/heads/master e6d46d7ec -> a7231015e


CLOUDSTACK-1604: deploy VM failed when global setting "vm.allocation.algorithm" is set to
"userdispersing"

Changes:
- DeployPlannerSelector was newly introduced for BareMetal feature. It had the planner name
hardcoded.
- Change it to decide the planner by referring to the global config vm.allocation.algorithm
value


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

Branch: refs/heads/master
Commit: a7231015e8f27a4e43b9cc7571ceca5514285b94
Parents: e6d46d7
Author: Prachi Damle <prachi@cloud.com>
Authored: Wed Mar 13 17:56:06 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Thu Mar 14 11:24:35 2013 -0700

----------------------------------------------------------------------
 .../deploy/AbstractDeployPlannerSelector.java      |   14 ++++++++++++--
 .../cloud/deploy/HypervisorVmPlannerSelector.java  |   15 ++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a7231015/server/src/com/cloud/deploy/AbstractDeployPlannerSelector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/AbstractDeployPlannerSelector.java b/server/src/com/cloud/deploy/AbstractDeployPlannerSelector.java
index 62094eb..03e8774 100755
--- a/server/src/com/cloud/deploy/AbstractDeployPlannerSelector.java
+++ b/server/src/com/cloud/deploy/AbstractDeployPlannerSelector.java
@@ -18,15 +18,23 @@ package com.cloud.deploy;
 
 import java.util.Map;
 
+import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.configuration.Config;
+import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.UserVmVO;
 
-public abstract class AbstractDeployPlannerSelector implements DeployPlannerSelector {
+public abstract class AbstractDeployPlannerSelector extends AdapterBase implements DeployPlannerSelector
{
     protected Map<String, Object>  params;
     protected String name;
     protected int runLevel;
-    
+
+    @Inject
+    protected ConfigurationDao _configDao;
+    protected String _allocationAlgorithm = "random";
+
     @Override
     public String getName() {
         return name;
@@ -59,6 +67,8 @@ public abstract class AbstractDeployPlannerSelector implements DeployPlannerSele
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{
+        super.configure(name, params);
+        _allocationAlgorithm = _configDao.getValue(Config.VmAllocationAlgorithm.key());
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a7231015/server/src/com/cloud/deploy/HypervisorVmPlannerSelector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/HypervisorVmPlannerSelector.java b/server/src/com/cloud/deploy/HypervisorVmPlannerSelector.java
index 034a9aa..8b2a144 100755
--- a/server/src/com/cloud/deploy/HypervisorVmPlannerSelector.java
+++ b/server/src/com/cloud/deploy/HypervisorVmPlannerSelector.java
@@ -18,6 +18,7 @@ package com.cloud.deploy;
 
 import javax.ejb.Local;
 
+import com.cloud.deploy.DeploymentPlanner.AllocationAlgorithm;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.vm.UserVmVO;
 
@@ -26,8 +27,20 @@ public class HypervisorVmPlannerSelector extends AbstractDeployPlannerSelector
{
     @Override
     public String selectPlanner(UserVmVO vm) {
         if (vm.getHypervisorType() != HypervisorType.BareMetal) {
-            return "FirstFitPlanner";
+            //check the allocation strategy
+            if (_allocationAlgorithm != null) {
+                if (_allocationAlgorithm.equals(AllocationAlgorithm.random.toString())
+                        || _allocationAlgorithm.equals(AllocationAlgorithm.firstfit.toString()))
{
+                    return "FirstFitPlanner";
+                } else if (_allocationAlgorithm.equals(AllocationAlgorithm.userdispersing.toString()))
{
+                    return "UserDispersingPlanner";
+                } else if (_allocationAlgorithm.equals(AllocationAlgorithm.userconcentratedpod_random.toString())
+                        || _allocationAlgorithm.equals(AllocationAlgorithm.userconcentratedpod_firstfit.toString()))
{
+                    return "UserConcentratedPodPlanner";
+                }
+            }
         }
+
         return null;
     }
 }


Mime
View raw message