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 68b3b4436a9a4a7648d04d3528b58b64353fb5fb Author: Rohit Yadav <rohit.ya...@shapeblue.com> 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 <rohit.ya...@shapeblue.com> --- 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<HostJoinVO, Long> 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<HostJoinVO, Long> 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<HostJoinVO, Long> 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" <commits@cloudstack.apache.org>.