Skip to content

Commit 1ff8f4a

Browse files
committed
Refactoring Allocator classes
1 parent 21af134 commit 1ff8f4a

File tree

4 files changed

+294
-252
lines changed

4 files changed

+294
-252
lines changed

Diff for: engine/schema/src/main/java/com/cloud/host/dao/HostDao.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public interface HostDao extends GenericDao<HostVO, Long>, StateDao<Status, Stat
164164
*/
165165
List<String> listOrderedHostsHypervisorVersionsInDatacenter(long datacenterId, HypervisorType hypervisorType);
166166

167-
List<HostVO> findHostsWithTagRuleThatMatchComputeOferringTags(String computeOfferingTags);
167+
List<HostVO> findHostsWithTagRuleThatMatchComputeOfferingTags(String computeOfferingTags);
168168

169169
List<Long> findClustersThatMatchHostTagRule(String computeOfferingTags);
170170
}

Diff for: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ private List<Long> findHostByComputeOfferings(String computeOfferingTags){
13491349
}
13501350
}
13511351

1352-
public List<HostVO> findHostsWithTagRuleThatMatchComputeOferringTags(String computeOfferingTags) {
1352+
public List<HostVO> findHostsWithTagRuleThatMatchComputeOfferingTags(String computeOfferingTags) {
13531353
List<HostTagVO> hostTagVOList = _hostTagsDao.findHostRuleTags();
13541354
List<HostVO> result = new ArrayList<>();
13551355
for (HostTagVO rule: hostTagVOList) {
@@ -1363,7 +1363,7 @@ public List<HostVO> findHostsWithTagRuleThatMatchComputeOferringTags(String comp
13631363

13641364
public List<Long> findClustersThatMatchHostTagRule(String computeOfferingTags) {
13651365
Set<Long> result = new HashSet<>();
1366-
List<HostVO> hosts = findHostsWithTagRuleThatMatchComputeOferringTags(computeOfferingTags);
1366+
List<HostVO> hosts = findHostsWithTagRuleThatMatchComputeOfferingTags(computeOfferingTags);
13671367
for (HostVO host: hosts) {
13681368
result.add(host.getClusterId());
13691369
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private List<Host> findSuitableHosts(VirtualMachineProfile vmProfile, Deployment
121121
hostsCopy = _hostDao.listAllHostsThatHaveNoRuleTag(type, clusterId, podId, dcId);
122122
}
123123
}
124-
hostsCopy = ListUtils.union(hostsCopy, _hostDao.findHostsWithTagRuleThatMatchComputeOferringTags(offeringHostTag));
124+
hostsCopy = ListUtils.union(hostsCopy, _hostDao.findHostsWithTagRuleThatMatchComputeOfferingTags(hostTag));
125125

126126
if (hostsCopy.isEmpty()) {
127127
logger.error(String.format("No suitable host found for vm [%s] with tags [%s].", vmProfile, hostTag));

0 commit comments

Comments
 (0)