mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-28 14:50:08 +03:00
B #5300: Update monitor information on VMs
This commit is contained in:
parent
3f7b20efcc
commit
0b76513078
@ -301,9 +301,8 @@ public:
|
||||
/**
|
||||
* Updates VM dynamic information (usage counters), and updates last_poll,
|
||||
* and copies it to history record for acct.
|
||||
* @param update_db true if the VM table needs to be updated.
|
||||
*/
|
||||
int update_info(const string& monitor_data, bool& update_db);
|
||||
int update_info(const string& monitor_data);
|
||||
|
||||
/**
|
||||
* Clears the VM monitor information usage counters (MEMORY, CPU),
|
||||
@ -971,9 +970,8 @@ public:
|
||||
/**
|
||||
* Deletes the error message from the template (ERROR_MONITOR)
|
||||
* @param message Message string
|
||||
* @return the number of ERROR_MONITOR attributes removed
|
||||
*/
|
||||
int clear_template_monitor_error();
|
||||
void clear_template_monitor_error();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Timers & Requirements
|
||||
|
@ -2179,15 +2179,13 @@ int VirtualMachine::from_xml(const string &xml_str)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::update_info(const string& monitor_data, bool& update_db)
|
||||
int VirtualMachine::update_info(const string& monitor_data)
|
||||
{
|
||||
int rc;
|
||||
string error;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
update_db = false;
|
||||
|
||||
last_poll = time(0);
|
||||
|
||||
rc = monitoring.update(monitor_data, error);
|
||||
@ -2203,14 +2201,12 @@ int VirtualMachine::update_info(const string& monitor_data, bool& update_db)
|
||||
|
||||
log("VMM", Log::ERROR, oss);
|
||||
|
||||
update_db = true;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
set_vm_info();
|
||||
|
||||
update_db = clear_template_monitor_error() > 0;
|
||||
clear_template_monitor_error();
|
||||
|
||||
oss << "VM " << oid << " successfully monitored: " << monitor_data;
|
||||
|
||||
@ -2344,9 +2340,9 @@ void VirtualMachine::set_template_monitor_error(const string& message)
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::clear_template_monitor_error()
|
||||
void VirtualMachine::clear_template_monitor_error()
|
||||
{
|
||||
return user_obj_template->erase("ERROR_MONITOR");
|
||||
user_obj_template->erase("ERROR_MONITOR");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -718,19 +718,14 @@ void VirtualMachineManagerDriver::process_poll(VirtualMachine* vm,
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE)
|
||||
{
|
||||
bool update_db;
|
||||
|
||||
if (vm->update_info(monitor_str, update_db) == 0)
|
||||
if (vm->update_info(monitor_str) == 0)
|
||||
{
|
||||
vmpool->update_history(vm);
|
||||
|
||||
vmpool->update_monitoring(vm);
|
||||
}
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
vmpool->update(vm);
|
||||
}
|
||||
vmpool->update(vm);
|
||||
|
||||
VirtualMachineMonitorInfo &minfo = vm->get_info();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user