If hypervisortype is baremetal, need to make sure we choose the correct planner

This commit is contained in:
Prachi Damle 2013-05-16 13:40:44 -07:00
parent db4f335c8a
commit 0d23cd3c9e
3 changed files with 22 additions and 12 deletions

View File

@ -223,7 +223,11 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
ServiceOffering offering = vmProfile.getServiceOffering();
String plannerName = offering.getDeploymentPlanner();
if (plannerName == null) {
plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key());
if (vm.getHypervisorType() != HypervisorType.BareMetal) {
plannerName = "BareMetalPlanner";
} else {
plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key());
}
}
DeploymentPlanner planner = null;
for (DeploymentPlanner plannerInList : _planners) {

View File

@ -486,13 +486,15 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
// check what the ServiceOffering says. If null, check the global config
ServiceOffering offering = vm.getServiceOffering();
if (offering != null && offering.getDeploymentPlanner() != null) {
if (offering.getDeploymentPlanner().equals(this.getName())) {
return true;
}
} else {
if (_globalDeploymentPlanner != null && _globalDeploymentPlanner.equals(this._name)) {
return true;
if (vm.getHypervisorType() != HypervisorType.BareMetal) {
if (offering != null && offering.getDeploymentPlanner() != null) {
if (offering.getDeploymentPlanner().equals(this.getName())) {
return true;
}
} else {
if (_globalDeploymentPlanner != null && _globalDeploymentPlanner.equals(this._name)) {
return true;
}
}
}
return false;

View File

@ -2832,7 +2832,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
}
return result;
}
@Override
public boolean finalizeDeployment(Commands cmds,
VirtualMachineProfile<UserVmVO> profile, DeployDestination dest,
@ -3029,7 +3029,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
+ " stop due to exception ", ex);
}
}
VMInstanceVO vm = profile.getVirtualMachine();
List<NicVO> nics = _nicDao.listByVmId(vm.getId());
for (NicVO nic : nics) {
@ -3171,7 +3171,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
ServiceOfferingVO offering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getServiceOfferingId());
String plannerName = offering.getDeploymentPlanner();
if (plannerName == null) {
plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key());
if (vm.getHypervisorType() != HypervisorType.BareMetal) {
plannerName = "BareMetalPlanner";
} else {
plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key());
}
}
String reservationId = vmEntity.reserve(plannerName, plan, new ExcludeList(), new Long(callerUser.getId()).toString());
@ -3815,7 +3819,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
+ cmd.getAccountName() + " is disabled.");
}
//check caller has access to both the old and new account
//check caller has access to both the old and new account
_accountMgr.checkAccess(caller, null, true, oldAccount);
_accountMgr.checkAccess(caller, null, true, newAccount);