Updated Branches: refs/heads/master 70ca58149 -> 7296cca9a
CLOUDSTACK-2771: Unable to create guest VM in basic zone: Zone is dedicated Changes: - Check the domain of the dedicated zone Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7296cca9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7296cca9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7296cca9 Branch: refs/heads/master Commit: 7296cca9ac1121b962739a474f9d9ce0bd162fb6 Parents: 70ca581 Author: Prachi Damle <[email protected]> Authored: Thu May 30 14:18:49 2013 -0700 Committer: Prachi Damle <[email protected]> Committed: Thu May 30 14:50:55 2013 -0700 ---------------------------------------------------------------------- .../deploy/DeploymentPlanningManagerImpl.java | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7296cca9/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 d954c8b..c29cefb 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -210,7 +210,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy } } - checkForNonDedicatedResources(vm, dc, avoids); + checkForNonDedicatedResources(vmProfile, dc, avoids); if (s_logger.isDebugEnabled()) { s_logger.debug("Deploy avoids pods: " + avoids.getPodsToAvoid() + ", clusters: " + avoids.getClustersToAvoid() + ", hosts: " + avoids.getHostsToAvoid()); @@ -438,8 +438,9 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy return dest; } - private void checkForNonDedicatedResources(VirtualMachine vm, DataCenter dc, ExcludeList avoids) { - boolean isExplicit = false; + private void checkForNonDedicatedResources(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DataCenter dc, ExcludeList avoids) { + boolean isExplicit = false; + VirtualMachine vm = vmProfile.getVirtualMachine(); // check affinity group of type Explicit dedication exists List<AffinityGroupVMMapVO> vmGroupMappings = _affinityGroupVMMapDao.findByVmIdType(vm.getId(), "ExplicitDedication"); @@ -450,8 +451,11 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy if (!isExplicit && vm.getType() == VirtualMachine.Type.User) { //add explicitly dedicated resources in avoidList DedicatedResourceVO dedicatedZone = _dedicatedDao.findByZoneId(dc.getId()); - if (dedicatedZone != null) { - throw new CloudRuntimeException("Failed to deploy VM. Zone " + dc.getName() + " is dedicated."); + if (dedicatedZone != null) { + long accountDomainId = vmProfile.getOwner().getDomainId(); + if (dedicatedZone.getDomainId() != null && !dedicatedZone.getDomainId().equals(accountDomainId)) { + throw new CloudRuntimeException("Failed to deploy VM. Zone " + dc.getName() + " is dedicated."); + } } List<HostPodVO> podsInDc = _podDao.listByDataCenterId(dc.getId());
