From 38205fd6d149f4022f99f8030e628df976f966eb Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sat, 4 Aug 2012 02:23:02 +0200 Subject: [PATCH] bug #1402: Read monitor values as floats and truncate them to store in the host share --- src/host/Host.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/host/Host.cc b/src/host/Host.cc index 804b34a87f..6ad778b7e7 100644 --- a/src/host/Host.cc +++ b/src/host/Host.cc @@ -173,6 +173,7 @@ int Host::update_info(string &parse_str) { char * error_msg; int rc; + float fv; rc = obj_template->parse(parse_str, &error_msg); @@ -184,14 +185,20 @@ int Host::update_info(string &parse_str) return -1; } - get_template_attribute("TOTALCPU",host_share.max_cpu); - get_template_attribute("TOTALMEMORY",host_share.max_mem); + get_template_attribute("TOTALCPU", fv); + host_share.max_cpu = static_cast(fv); + get_template_attribute("TOTALMEMORY", fv); + host_share.max_mem = static_cast(fv); - get_template_attribute("FREECPU",host_share.free_cpu); - get_template_attribute("FREEMEMORY",host_share.free_mem); + get_template_attribute("FREECPU", fv); + host_share.free_cpu = static_cast(fv); + get_template_attribute("FREEMEMORY", fv); + host_share.free_mem = static_cast(fv); - get_template_attribute("USEDCPU",host_share.used_cpu); - get_template_attribute("USEDMEMORY",host_share.used_mem); + get_template_attribute("USEDCPU", fv); + host_share.used_cpu = static_cast(fv); + get_template_attribute("USEDMEMORY", fv); + host_share.used_mem = static_cast(fv); return 0; }