Skip to content

Commit 154743a

Browse files
committed
Fix issue with allocator not considering subsequent clusters
1 parent 653b973 commit 154743a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

plugins/host-allocators/random/src/main/java/com/cloud/agent/manager/allocator/impl/RandomAllocator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ private List<Host> findSuitableHosts(VirtualMachineProfile vmProfile, Deployment
9494
return suitableHosts;
9595
}
9696
String offeringHostTag = offering.getHostTag();
97+
9798
VMTemplateVO template = (VMTemplateVO)vmProfile.getTemplate();
9899
String templateTag = template.getTemplateTag();
99100
String hostTag = null;
100101
if (ObjectUtils.anyNull(offeringHostTag, templateTag)) {
101102
hostTag = offeringHostTag;
102-
hostTag = hostTag == null ? templateTag : String.format("%s, %s", hostTag, templateTag);
103-
logger.debug(String.format("Looking for hosts in dc [%s], pod [%s], cluster [%s] and complying with host tag(s): [%s]", dcId, podId, clusterId, hostTag));
103+
logger.debug("Looking for hosts in dc [{}], pod [{}], cluster [{}] and complying with host tag(s): [{}]", dcId, podId, clusterId, hostTag);
104104
} else {
105-
logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);
105+
logger.debug("Looking for hosts in dc: {} pod: {} cluster: {}", dcId , podId, clusterId);
106106
}
107107
if (hosts != null) {
108108
// retain all computing hosts, regardless of whether they support routing...it's random after all

server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan pla
130130
// FirstFitAllocator should be used for user VMs only since it won't care whether the host is capable of routing or not
131131
return new ArrayList<>();
132132
}
133-
134-
logger.debug("Looking for hosts in zone [{}], pod [{}], cluster [{}]", dcId, podId, clusterId);
133+
String paramAsStringToLog = String.format("zone [%s], pod [%s], cluster [%s]", dcId, podId, clusterId);
134+
logger.debug("Looking for hosts in {}", paramAsStringToLog);
135135

136136
String hostTagOnOffering = offering.getHostTag();
137137
String hostTagOnTemplate = template.getTemplateTag();
@@ -203,8 +203,7 @@ public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan pla
203203

204204

205205
if (clusterHosts.isEmpty()) {
206-
logger.error("No suitable host found for vm [{}] with tags [{}].", vmProfile, hostTagOnOffering);
207-
throw new CloudRuntimeException(String.format("No suitable host found for vm [%s].", vmProfile));
206+
logger.warn("No suitable host found for VM [{}] with tags {} in {}.", vmProfile, hostTagOnOffering, paramAsStringToLog);
208207
}
209208
// add all hosts that we are not considering to the avoid list
210209
List<HostVO> allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(type, clusterId, podId, dcId, null);

0 commit comments

Comments
 (0)