Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D9B810882 for ; Thu, 5 Dec 2013 23:37:09 +0000 (UTC) Received: (qmail 44556 invoked by uid 500); 5 Dec 2013 23:37:09 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 44533 invoked by uid 500); 5 Dec 2013 23:37:09 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 44526 invoked by uid 99); 5 Dec 2013 23:37:08 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 23:37:08 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A734082CADC; Thu, 5 Dec 2013 23:37:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nitin@apache.org To: commits@cloudstack.apache.org Message-Id: <1bb05ad1881241d9926c570f770f9268@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to ed1f3d9 Date: Thu, 5 Dec 2013 23:37:08 +0000 (UTC) Updated Branches: refs/heads/master 98ee087d3 -> ed1f3d9ed CLOUDSTACK-5391: check for host cpu capability while stop starting a vm on the same host. Also changed the FirstFitAllocator to use the same method. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ed1f3d9e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ed1f3d9e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ed1f3d9e Branch: refs/heads/master Commit: ed1f3d9ed67cf805e14821d91fc6e612bd232555 Parents: 98ee087 Author: Nitin Mehta Authored: Thu Dec 5 15:37:01 2013 -0800 Committer: Nitin Mehta Committed: Thu Dec 5 15:37:01 2013 -0800 ---------------------------------------------------------------------- .../agent/manager/allocator/impl/FirstFitAllocator.java | 11 ++++------- .../com/cloud/deploy/DeploymentPlanningManagerImpl.java | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed1f3d9e/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 7150317..0bfe192 100755 --- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java @@ -286,8 +286,6 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { continue; } - 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; Cluster cluster = _clusterDao.findById(host.getClusterId()); @@ -296,19 +294,18 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { Float cpuOvercommitRatio = Float.parseFloat(clusterDetailsCpuOvercommit.getValue()); Float memoryOvercommitRatio = Float.parseFloat(clusterDetailsRamOvercommmt.getValue()); - boolean hostHasCapacity = - _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, + boolean hostHasCpuCapability = _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), offering.getSpeed()); + boolean hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, considerReservedCapacity); - if (numCpusGood && cpuFreqGood && hostHasCapacity) { + if (hostHasCpuCapability && 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 + "; cpuFreqGood: " + cpuFreqGood + ", host has capacity?" + - hostHasCapacity); + s_logger.debug("Not using host " + host.getId() + "; host has cpu capability? " + hostHasCpuCapability + ", host has capacity?" + hostHasCapacity); } avoid.addHost(host.getId()); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed1f3d9e/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java index 8fad78c..471225f 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -361,7 +361,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id, "memoryOvercommitRatio"); Float cpuOvercommitRatio = Float.parseFloat(cluster_detail_cpu.getValue()); Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue()); - if (_capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, true, cpuOvercommitRatio, memoryOvercommitRatio, true)) { + if (_capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, true, cpuOvercommitRatio, memoryOvercommitRatio, true) + && _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), offering.getSpeed())) { s_logger.debug("The last host of this VM is UP and has enough capacity"); s_logger.debug("Now checking for suitable pools under zone: " + host.getDataCenterId() + ", pod: " + host.getPodId() + ", cluster: " + host.getClusterId());