diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 6b039ef09b..d0edcdb8fd 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -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 diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index af334a1115..c588171a46 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -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"); } /* -------------------------------------------------------------------------- */ diff --git a/src/vmm/VirtualMachineManagerDriver.cc b/src/vmm/VirtualMachineManagerDriver.cc index 2cd330e6ac..4820a2d50f 100644 --- a/src/vmm/VirtualMachineManagerDriver.cc +++ b/src/vmm/VirtualMachineManagerDriver.cc @@ -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();