mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-22 22:03:39 +03:00
Bug #1673: Add support for 64-bit net_tx/net_rx counters. Contributed by Simon Boulet.
This commit is contained in:
parent
d22567fe23
commit
5d54095119
@ -94,6 +94,30 @@ public:
|
|||||||
int xpath(unsigned int& value, const char * xpath_expr,
|
int xpath(unsigned int& value, const char * xpath_expr,
|
||||||
const unsigned int& def);
|
const unsigned int& 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(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
|
* Gets and sets a xpath attribute, if the attribute is not found a default
|
||||||
* is used
|
* is used
|
||||||
|
@ -173,13 +173,13 @@ public:
|
|||||||
* @param _memory Kilobytes used by the VM (total)
|
* @param _memory Kilobytes used by the VM (total)
|
||||||
* @param _cpu used by the VM (rate)
|
* @param _cpu used by the VM (rate)
|
||||||
* @param _net_tx transmitted bytes (total)
|
* @param _net_tx transmitted bytes (total)
|
||||||
* @param _net_tx received bytes (total)
|
* @param _net_rx received bytes (total)
|
||||||
*/
|
*/
|
||||||
void update_info(
|
void update_info(
|
||||||
const int _memory,
|
const int _memory,
|
||||||
const int _cpu,
|
const int _cpu,
|
||||||
const int _net_tx,
|
const long long _net_tx,
|
||||||
const int _net_rx)
|
const long long _net_rx)
|
||||||
{
|
{
|
||||||
if (_memory != -1)
|
if (_memory != -1)
|
||||||
{
|
{
|
||||||
@ -1009,12 +1009,12 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Network usage, transmitted bytes
|
* Network usage, transmitted bytes
|
||||||
*/
|
*/
|
||||||
int net_tx;
|
long long net_tx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network usage, received bytes
|
* Network usage, received bytes
|
||||||
*/
|
*/
|
||||||
int net_rx;
|
long long net_rx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* History record, for the current host
|
* History record, for the current host
|
||||||
|
@ -386,8 +386,8 @@ void VirtualMachineManagerDriver::protocol(
|
|||||||
|
|
||||||
int cpu = -1;
|
int cpu = -1;
|
||||||
int memory = -1;
|
int memory = -1;
|
||||||
int net_tx = -1;
|
long long net_tx = -1;
|
||||||
int net_rx = -1;
|
long long net_rx = -1;
|
||||||
char state = '-';
|
char state = '-';
|
||||||
|
|
||||||
string monitor_str = is.str();
|
string monitor_str = is.str();
|
||||||
|
@ -222,6 +222,74 @@ int ObjectXML::xpath(unsigned int& value, const char * xpath_expr,
|
|||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int ObjectXML::xpath(long long& value, const char * xpath_expr,
|
||||||
|
const long long& def)
|
||||||
|
{
|
||||||
|
vector<string> 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<string> 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 ObjectXML::xpath(time_t& value, const char * xpath_expr, const time_t& def)
|
||||||
{
|
{
|
||||||
int int_val;
|
int int_val;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user