Skip to content

Commit d646f30

Browse files
committed
bug CS-15095: vm cpu freq <= host cpu freq
1 parent dd3b402 commit d646f30

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,19 @@ protected List<Host> allocateTo(DeploymentPlan plan, ServiceOffering offering, V
211211
}
212212

213213
boolean numCpusGood = host.getCpus().intValue() >= offering.getCpu();
214+
boolean cpuFreqGood = host.getSpeed().intValue() >= offering.getSpeed();
214215
int cpu_requested = offering.getCpu() * offering.getSpeed();
215216
long ram_requested = offering.getRamSize() * 1024L * 1024L;
216217
boolean hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, _factor, considerReservedCapacity);
217218

218-
if (numCpusGood && hostHasCapacity) {
219+
if (numCpusGood && cpuFreqGood && hostHasCapacity) {
219220
if (s_logger.isDebugEnabled()) {
220221
s_logger.debug("Found a suitable host, adding to list: " + host.getId());
221222
}
222223
suitableHosts.add(host);
223224
} else {
224225
if (s_logger.isDebugEnabled()) {
225-
s_logger.debug("Not using host " + host.getId() + "; numCpusGood: " + numCpusGood + ", host has capacity?" + hostHasCapacity);
226+
s_logger.debug("Not using host " + host.getId() + "; numCpusGood: " + numCpusGood + "; cpuFreqGood: " + cpuFreqGood + ", host has capacity?" + hostHasCapacity);
226227
}
227228
}
228229
}

0 commit comments

Comments
 (0)