Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@
return suitableHosts;
}
String offeringHostTag = offering.getHostTag();

VMTemplateVO template = (VMTemplateVO)vmProfile.getTemplate();
String templateTag = template.getTemplateTag();
String hostTag = null;
if (ObjectUtils.anyNull(offeringHostTag, templateTag)) {
hostTag = offeringHostTag;
hostTag = hostTag == null ? templateTag : String.format("%s, %s", hostTag, templateTag);
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));
if (ObjectUtils.anyNotNull(offeringHostTag, templateTag)) {
hostTag = ObjectUtils.allNotNull(offeringHostTag, templateTag) ?
String.format("%s, %s", offeringHostTag, templateTag) :
ObjectUtils.firstNonNull(offeringHostTag, templateTag);
logger.debug("Looking for hosts in dc [{}], pod [{}], cluster [{}] and complying with host tag(s): [{}]", dcId, podId, clusterId, hostTag);

Check warning on line 105 in plugins/host-allocators/random/src/main/java/com/cloud/agent/manager/allocator/impl/RandomAllocator.java

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L103 - L105 were not covered by tests
} else {
logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);
logger.debug("Looking for hosts in dc: {} pod: {} cluster: {}", dcId , podId, clusterId);

Check warning on line 107 in plugins/host-allocators/random/src/main/java/com/cloud/agent/manager/allocator/impl/RandomAllocator.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L107 was not covered by tests
}
if (hosts != null) {
// retain all computing hosts, regardless of whether they support routing...it's random after all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javax.inject.Inject;
import javax.naming.ConfigurationException;

import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -130,8 +129,8 @@
// FirstFitAllocator should be used for user VMs only since it won't care whether the host is capable of routing or not
return new ArrayList<>();
}

logger.debug("Looking for hosts in zone [{}], pod [{}], cluster [{}]", dcId, podId, clusterId);
String paramAsStringToLog = String.format("zone [%s], pod [%s], cluster [%s]", dcId, podId, clusterId);
logger.debug("Looking for hosts in {}", paramAsStringToLog);

Check warning on line 133 in server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java#L132-L133

Added lines #L132 - L133 were not covered by tests

String hostTagOnOffering = offering.getHostTag();
String hostTagOnTemplate = template.getTemplateTag();
Expand Down Expand Up @@ -203,8 +202,8 @@


if (clusterHosts.isEmpty()) {
logger.error("No suitable host found for vm [{}] with tags [{}].", vmProfile, hostTagOnOffering);
throw new CloudRuntimeException(String.format("No suitable host found for vm [%s].", vmProfile));
logger.warn("No suitable host found for VM [{}] with tags {} in {}.", vmProfile, hostTagOnOffering, paramAsStringToLog);
return null;

Check warning on line 206 in server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java#L205-L206

Added lines #L205 - L206 were not covered by tests
}
// add all hosts that we are not considering to the avoid list
List<HostVO> allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(type, clusterId, podId, dcId, null);
Expand Down
Loading