You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2012/05/28 00:35:41 UTC

[10/50] [abbrv] git commit: bug CS-15095: vm cpu freq <= host cpu freq

bug CS-15095: vm cpu freq <= host cpu freq


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c530ffdc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c530ffdc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c530ffdc

Branch: refs/heads/3.0.x
Commit: c530ffdc5251c819f87d8bb0ff54a16b2b73af72
Parents: 8405913
Author: Edison Su <su...@gmail.com>
Authored: Fri May 25 11:17:15 2012 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Fri May 25 11:17:24 2012 -0700

----------------------------------------------------------------------
 .../manager/allocator/impl/FirstFitAllocator.java  |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c530ffdc/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
index 95151cf..f93fa65 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
@@ -211,18 +211,19 @@ public class FirstFitAllocator implements HostAllocator {
             }
 
             boolean numCpusGood = host.getCpus().intValue() >= offering.getCpu();
+            boolean cpuFreqGood = host.getSpeed().intValue() >= offering.getSpeed();
     		int cpu_requested = offering.getCpu() * offering.getSpeed();
     		long ram_requested = offering.getRamSize() * 1024L * 1024L;	
     		boolean hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, _factor, considerReservedCapacity);
 
-            if (numCpusGood && hostHasCapacity) {
+            if (numCpusGood && cpuFreqGood && hostHasCapacity) {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Found a suitable host, adding to list: " + host.getId());
                 }
                 suitableHosts.add(host);
             } else {
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Not using host " + host.getId() + "; numCpusGood: " + numCpusGood + ", host has capacity?" + hostHasCapacity);
+                    s_logger.debug("Not using host " + host.getId() + "; numCpusGood: " + numCpusGood + "; cpuFreqGood: " + cpuFreqGood + ", host has capacity?" + hostHasCapacity);
                 }
             }
         }