mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Wait poll_period since the VM started to run to proactively monitor a VM
This commit is contained in:
parent
4970884d29
commit
9f9057dd79
@ -750,6 +750,14 @@ public:
|
||||
history->running_stime=_stime;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the running start time for the VM
|
||||
*/
|
||||
time_t get_running_stime()
|
||||
{
|
||||
return history->running_stime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets end time of VM running state.
|
||||
* @param _etime time when the running state finished
|
||||
|
@ -1456,14 +1456,13 @@ error_common:
|
||||
|
||||
void VirtualMachineManager::timer_action()
|
||||
{
|
||||
static int mark = 0;
|
||||
static int timer_start = time(0);
|
||||
static int mark = 0;
|
||||
|
||||
VirtualMachine * vm;
|
||||
vector<int> oids;
|
||||
vector<int>::iterator it;
|
||||
int rc;
|
||||
ostringstream os;
|
||||
VirtualMachine * vm;
|
||||
vector<int> oids;
|
||||
vector<int>::iterator it;
|
||||
int rc;
|
||||
ostringstream os;
|
||||
|
||||
time_t thetime = time(0);
|
||||
|
||||
@ -1483,13 +1482,6 @@ void VirtualMachineManager::timer_action()
|
||||
// Clear the expired monitoring records
|
||||
vmpool->clean_expired_monitoring();
|
||||
|
||||
// Skip monitoring the first poll_period to allow the Host monitoring to
|
||||
// gather the VM info
|
||||
if ( timer_start + poll_period > thetime )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Monitor only VMs that hasn't been monitored for 'poll_period' seconds.
|
||||
rc = vmpool->get_running(oids, vm_limit, thetime - poll_period);
|
||||
|
||||
@ -1517,6 +1509,14 @@ void VirtualMachineManager::timer_action()
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip monitoring the first poll_period to allow the Host monitoring to
|
||||
// gather the VM info
|
||||
if (vm->get_running_stime() + poll_period > thetime)
|
||||
{
|
||||
vm->unlock();
|
||||
continue;
|
||||
}
|
||||
|
||||
os.str("");
|
||||
|
||||
os << "Monitoring VM " << *it << ".";
|
||||
|
Loading…
Reference in New Issue
Block a user