mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-2771: Unable to create guest VM in basic zone: Zone is dedicated
Changes: - Check the domain of the dedicated zone
This commit is contained in:
parent
70ca581499
commit
7296cca9ac
@ -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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user