You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2013/03/14 20:15:10 UTC
git commit: refs/heads/4.1 - CLOUDSTACK-1604: deploy VM failed when
global setting "vm.allocation.algorithm" is set to "userdispersing"
Updated Branches:
refs/heads/4.1 07ffc2a50 -> 48495f86f
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/48495f86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/48495f86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/48495f86
Branch: refs/heads/4.1
Commit: 48495f86f7f5d0a27761c9a73468714ba4ff1c54
Parents: 07ffc2a
Author: Prachi Damle <pr...@cloud.com>
Authored: Wed Mar 13 17:56:06 2013 -0700
Committer: Chip Childers <ch...@gmail.com>
Committed: Thu Mar 14 15:08:08 2013 -0400
----------------------------------------------------------------------
.../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/48495f86/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/48495f86/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;
}
}