1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

Feature #1739: Skip VMM monitoring the first period

This commit is contained in:
Carlos Martín 2013-02-14 16:31:13 +01:00
parent c5f28d8a03
commit fd1a2d165a
2 changed files with 15 additions and 0 deletions

View File

@ -121,6 +121,11 @@ private:
*/
time_t timer_period;
/**
* Time when the VMM was started
*/
time_t timer_start;
/**
* Virtual Machine polling interval
*/

View File

@ -40,6 +40,7 @@ VirtualMachineManager::VirtualMachineManager(
vmpool(_vmpool),
hpool(_hpool),
timer_period(_timer_period),
timer_start(0),
poll_period(_poll_period),
vm_limit(_vm_limit)
{
@ -63,6 +64,8 @@ extern "C" void * vmm_action_loop(void *arg)
NebulaLog::log("VMM",Log::INFO,"Virtual Machine Manager started.");
vmm->timer_start = time(0);
if ( vmm->poll_period == 0 )
{
NebulaLog::log("VMM",Log::INFO,"VM monitoring is disabled.");
@ -1445,6 +1448,13 @@ 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);