diff -Naur opennebula-3.8.1.orig/include/ObjectXML.h opennebula-3.8.1/include/ObjectXML.h --- opennebula-3.8.1.orig/include/ObjectXML.h 2012-10-26 11:30:33.000000000 -0400 +++ opennebula-3.8.1/include/ObjectXML.h 2012-11-29 22:27:33.000000000 -0500 @@ -97,6 +97,30 @@ /** * Gets and sets a xpath attribute, if the attribute is not found a default * is used + * @param value to set + * @param xpath_expr of the xml element + * @param def default value if the element is not found + * + * @return -1 if default was set + */ + int xpath(long long& value, const char * xpath_expr, + const long long& def); + + /** + * Gets and sets a xpath attribute, if the attribute is not found a default + * is used + * @param value to set + * @param xpath_expr of the xml element + * @param def default value if the element is not found + * + * @return -1 if default was set + */ + int xpath(unsigned long long& value, const char * xpath_expr, + const unsigned long long& def); + + /** + * Gets and sets a xpath attribute, if the attribute is not found a default + * is used * @param value to set * @param xpath_expr of the xml element * @param def default value if the element is not found diff -Naur opennebula-3.8.1.orig/include/VirtualMachine.h opennebula-3.8.1/include/VirtualMachine.h --- opennebula-3.8.1.orig/include/VirtualMachine.h 2012-10-26 11:30:33.000000000 -0400 +++ opennebula-3.8.1/include/VirtualMachine.h 2012-11-29 22:37:50.000000000 -0500 @@ -173,13 +173,13 @@ * @param _memory Kilobytes used by the VM (total) * @param _cpu used by the VM (rate) * @param _net_tx transmitted bytes (total) - * @param _net_tx received bytes (total) + * @param _net_rx received bytes (total) */ void update_info( const int _memory, const int _cpu, - const int _net_tx, - const int _net_rx) + const long long _net_tx, + const long long _net_rx) { if (_memory != -1) { @@ -950,12 +950,12 @@ /** * Network usage, transmitted bytes */ - int net_tx; + long long net_tx; /** * Network usage, received bytes */ - int net_rx; + long long net_rx; /** * History record, for the current host diff -Naur opennebula-3.8.1.orig/src/vmm/VirtualMachineManagerDriver.cc opennebula-3.8.1/src/vmm/VirtualMachineManagerDriver.cc --- opennebula-3.8.1.orig/src/vmm/VirtualMachineManagerDriver.cc 2012-10-26 11:30:33.000000000 -0400 +++ opennebula-3.8.1/src/vmm/VirtualMachineManagerDriver.cc 2012-11-29 22:06:31.000000000 -0500 @@ -386,8 +386,8 @@ int cpu = -1; int memory = -1; - int net_tx = -1; - int net_rx = -1; + long long net_tx = -1; + long long net_rx = -1; char state = '-'; string monitor_str = is.str(); diff -Naur opennebula-3.8.1.orig/src/xml/ObjectXML.cc opennebula-3.8.1/src/xml/ObjectXML.cc --- opennebula-3.8.1.orig/src/xml/ObjectXML.cc 2012-10-26 11:30:33.000000000 -0400 +++ opennebula-3.8.1/src/xml/ObjectXML.cc 2012-11-29 22:27:47.000000000 -0500 @@ -222,6 +222,74 @@ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ +int ObjectXML::xpath(long long& value, const char * xpath_expr, + const long long& def) +{ + vector values; + int rc = 0; + + values = (*this)[xpath_expr]; + + if (values.empty() == true) + { + value = def; + rc = -1; + } + else + { + istringstream iss; + + iss.str(values[0]); + + iss >> dec >> value; + + if (iss.fail() == true) + { + value = def; + rc = -1; + } + } + + return rc; +} + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +int ObjectXML::xpath(unsigned long long& value, const char * xpath_expr, + const unsigned long long& def) +{ + vector values; + int rc = 0; + + values = (*this)[xpath_expr]; + + if (values.empty() == true) + { + value = def; + rc = -1; + } + else + { + istringstream iss; + + iss.str(values[0]); + + iss >> dec >> value; + + if (iss.fail() == true) + { + value = def; + rc = -1; + } + } + + return rc; +} + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + int ObjectXML::xpath(time_t& value, const char * xpath_expr, const time_t& def) { int int_val;