mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-01 06:50:25 +03:00
Do not update disk monitor infor in the DB. Disk usage will be kept in
the object and written to the DB the next time the VM is updated (presumably, in the next monitor message from probes). This will reduce DB I/O needs
This commit is contained in:
parent
61202c75bf
commit
9c929148fc
@ -74,16 +74,19 @@ public:
|
||||
*
|
||||
* @param id VM id
|
||||
* @param monitor_str String returned by the poll driver call
|
||||
* @param update_db write data to DB (or keep it in memory)
|
||||
*/
|
||||
static void process_poll(int id, const string &monitor_str);
|
||||
static void process_poll(int id, const string &monitor_str, bool update_db);
|
||||
|
||||
/**
|
||||
* Updates the VM with the information gathered by the drivers
|
||||
*
|
||||
* @param vm VM to update, must be locked
|
||||
* @param monitor_str String returned by the poll driver call
|
||||
* @param update_db write data to DB (or keep it in memory)
|
||||
*/
|
||||
static void process_poll(VirtualMachine* vm, const string &monitor_str);
|
||||
static void process_poll(VirtualMachine* vm, const string &monitor_str,
|
||||
bool update_db);
|
||||
|
||||
/**
|
||||
* Check if action is supported for imported VMs
|
||||
|
@ -282,7 +282,7 @@ void MonitorThread::do_message()
|
||||
continue;
|
||||
}
|
||||
|
||||
VirtualMachineManagerDriver::process_poll(vm, itm->second);
|
||||
VirtualMachineManagerDriver::process_poll(vm, itm->second, true);
|
||||
|
||||
vm->unlock();
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ static void monitor_action(istringstream& is,
|
||||
continue;
|
||||
}
|
||||
|
||||
VirtualMachineManagerDriver::process_poll(vm_id, poll_info);
|
||||
VirtualMachineManagerDriver::process_poll(vm_id, poll_info, false);
|
||||
}
|
||||
|
||||
oss << "Datastore " << ds_name << " (" << id << ") successfully monitored.";
|
||||
|
@ -645,7 +645,7 @@ void VirtualMachineManagerDriver::protocol(const string& message) const
|
||||
string monitor_str;
|
||||
getline(is, monitor_str);
|
||||
|
||||
process_poll(vm, monitor_str);
|
||||
process_poll(vm, monitor_str, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -670,7 +670,8 @@ void VirtualMachineManagerDriver::protocol(const string& message) const
|
||||
|
||||
void VirtualMachineManagerDriver::process_poll(
|
||||
int id,
|
||||
const string &monitor_str)
|
||||
const string &monitor_str,
|
||||
bool update_db)
|
||||
{
|
||||
// Get the VM from the pool
|
||||
VirtualMachine* vm = Nebula::instance().get_vmpool()->get(id,true);
|
||||
@ -680,7 +681,7 @@ void VirtualMachineManagerDriver::process_poll(
|
||||
return;
|
||||
}
|
||||
|
||||
process_poll(vm, monitor_str);
|
||||
process_poll(vm, monitor_str, update_db);
|
||||
|
||||
vm->unlock();
|
||||
}
|
||||
@ -690,7 +691,8 @@ void VirtualMachineManagerDriver::process_poll(
|
||||
|
||||
void VirtualMachineManagerDriver::process_poll(
|
||||
VirtualMachine* vm,
|
||||
const string& monitor_str)
|
||||
const string& monitor_str,
|
||||
bool update_db)
|
||||
{
|
||||
char state;
|
||||
|
||||
@ -705,15 +707,20 @@ void VirtualMachineManagerDriver::process_poll(
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE)
|
||||
{
|
||||
if (vm->update_info(monitor_str) == 0)
|
||||
int rc = vm->update_info(monitor_str);
|
||||
|
||||
if ( update_db )
|
||||
{
|
||||
vmpool->update_history(vm);
|
||||
if ( rc == 0)
|
||||
{
|
||||
vmpool->update_history(vm);
|
||||
|
||||
vmpool->update_monitoring(vm);
|
||||
vmpool->update_monitoring(vm);
|
||||
}
|
||||
|
||||
vmpool->update(vm);
|
||||
}
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
VirtualMachineMonitorInfo &minfo = vm->get_info();
|
||||
|
||||
state = minfo.remove_state();
|
||||
|
Loading…
x
Reference in New Issue
Block a user