Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0D6D1200D63 for ; Thu, 21 Dec 2017 10:58:24 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0C546160C2B; Thu, 21 Dec 2017 09:58:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 533B9160C1A for ; Thu, 21 Dec 2017 10:58:23 +0100 (CET) Received: (qmail 53318 invoked by uid 500); 21 Dec 2017 09:58:15 -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 52823 invoked by uid 99); 21 Dec 2017 09:58:14 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Dec 2017 09:58:14 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 3E46384B98; Thu, 21 Dec 2017 09:58:11 +0000 (UTC) Date: Thu, 21 Dec 2017 09:58:30 +0000 To: "commits@cloudstack.apache.org" Subject: [cloudstack] 21/24: CLOUDSTACK-10001: Fix incorrect total host memory in responses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: rohit@apache.org In-Reply-To: <151385028916.13488.11103536361592410956@gitbox.apache.org> References: <151385028916.13488.11103536361592410956@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: cloudstack X-Git-Refname: refs/heads/debian9-systemvmtemplate X-Git-Reftype: branch X-Git-Rev: 3ebd22d3a4adefbdc86ed5a6c452c47d2bb181fa X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20171221095811.3E46384B98@gitbox.apache.org> archived-at: Thu, 21 Dec 2017 09:58:24 -0000 This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch debian9-systemvmtemplate in repository https://gitbox.apache.org/repos/asf/cloudstack.git commit 3ebd22d3a4adefbdc86ed5a6c452c47d2bb181fa Author: Rohit Yadav AuthorDate: Tue Dec 19 11:45:24 2017 +0530 CLOUDSTACK-10001: Fix incorrect total host memory in responses This fixes incorrect total host memory in listHosts and related host responses, regression introduced in #2120. Signed-off-by: Rohit Yadav --- server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java index 4d411f2..4cb8a76 100644 --- a/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java @@ -159,8 +159,8 @@ public class HostJoinDaoImpl extends GenericDaoBase implements Long mem = host.getMemReservedCapacity() + host.getMemUsedCapacity(); Long cpu = host.getCpuReservedCapacity() + host.getCpuUsedCapacity(); - hostResponse.setMemoryTotal(mem); - Float totalMemorywithOverprovisioning=new Float((host.getTotalMemory()*ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId()))); + hostResponse.setMemoryTotal(host.getTotalMemory()); + Float totalMemorywithOverprovisioning = host.getTotalMemory() * ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId()); hostResponse.setMemWithOverprovisioning(totalMemorywithOverprovisioning.toString()); hostResponse.setMemoryAllocated(mem); @@ -180,7 +180,7 @@ public class HostJoinDaoImpl extends GenericDaoBase implements hostResponse.setHypervisorVersion(host.getHypervisorVersion()); - Float cpuWithOverprovisioning = new Float(host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId())); + Float cpuWithOverprovisioning = host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId()); String cpuAlloc = decimalFormat.format(((float)cpu / cpuWithOverprovisioning * 100f)) + "%"; hostResponse.setCpuAllocated(cpuAlloc); hostResponse.setCpuWithOverprovisioning(cpuWithOverprovisioning.toString()); @@ -308,10 +308,10 @@ public class HostJoinDaoImpl extends GenericDaoBase implements Long mem = host.getMemReservedCapacity() + host.getMemUsedCapacity(); Long cpu = host.getCpuReservedCapacity() + host.getCpuReservedCapacity(); - hostResponse.setMemoryTotal(mem); - Float memWithOverprovisioning =new Float((host.getTotalMemory()*ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId()))); + hostResponse.setMemoryTotal(host.getTotalMemory()); + Float memWithOverprovisioning = host.getTotalMemory() * ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId()); hostResponse.setMemWithOverprovisioning(memWithOverprovisioning.toString()); - hostResponse.setMemoryAllocated(decimalFormat.format((float)mem/ memWithOverprovisioning*100f).toString()+"%"); + hostResponse.setMemoryAllocated(decimalFormat.format((float) mem / memWithOverprovisioning * 100.0f) +"%"); String hostTags = host.getTag(); hostResponse.setHostTags(host.getTag()); -- To stop receiving notification emails like this one, please contact "commits@cloudstack.apache.org" .