1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-14 19:24:10 +03:00

feature #261: VM_POLLING_INTERVAL set to 0 disables VM monitoring

This commit is contained in:
Ruben S. Montero 2010-06-18 00:23:56 +02:00
parent d175a07831
commit 3ca2d5c755
3 changed files with 22 additions and 24 deletions

View File

@ -7,7 +7,8 @@
#-------------------------------------------------------------------------------
# HOST_MONITORING_INTERVAL: Time in seconds between host monitorization
#
# VM_POLLING_INTERVAL: Time in seconds between virtual machine monitorization
# VM_POLLING_INTERVAL: Time in seconds between virtual machine monitorization.
# (use 0 to disable VM monitoring).
#
# VM_DIR: Remote path to store the VM images, it should be shared between all
# the cluster nodes to perform live migrations. This variable is the default
@ -25,9 +26,9 @@
# DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
#*******************************************************************************
HOST_MONITORING_INTERVAL = 60
HOST_MONITORING_INTERVAL = 600
VM_POLLING_INTERVAL = 60
VM_POLLING_INTERVAL = 600
#VM_DIR=/srv/cloud/one/var

View File

@ -260,14 +260,10 @@ int VirtualMachinePool::get_running(
ostringstream os;
string where;
// Get all machines that have been monitored ( > 0 ),
// but not recently ( <= last_poll ) and...
os << "last_poll > 0 and last_poll <= " << last_poll << " and "
// ... are running
<< "state = " << VirtualMachine::ACTIVE
os << "last_poll > 0 and last_poll <= " << last_poll << " and"
<< " state = " << VirtualMachine::ACTIVE
<< " and ( lcm_state = " << VirtualMachine::RUNNING
<< " or lcm_state = " << VirtualMachine::UNKNOWN << " )"
// order the results by last_poll, and return only the first 'vm_limit' rows
<< " ORDER BY last_poll ASC LIMIT " << vm_limit;
where = os.str();

View File

@ -60,7 +60,15 @@ extern "C" void * vmm_action_loop(void *arg)
NebulaLog::log("VMM",Log::INFO,"Virtual Machine Manager started.");
vmm->am.loop(vmm->timer_period,0);
if ( vmm->poll_period == 0 )
{
NebulaLog::log("VMM",Log::INFO,"VM monitoring is disabled.");
vmm->am.loop(0,0);
}
else
{
vmm->am.loop(vmm->timer_period,0);
}
NebulaLog::log("VMM",Log::INFO,"Virtual Machine Manager stopped.");
@ -804,12 +812,16 @@ void VirtualMachineManager::timer_action()
vector<int> oids;
vector<int>::iterator it;
int rc;
time_t thetime;
time_t last_poll;
ostringstream os;
time_t thetime = time(0);
const VirtualMachineManagerDriver * vmd;
// -------------- Max. number of VMs to monitor. ---------------------
int vm_limit = 5;
mark = mark + timer_period;
if ( mark >= 600 )
@ -818,24 +830,14 @@ void VirtualMachineManager::timer_action()
mark = 0;
}
// TODO: Move this to oned.conf
// Max. number of VMs to monitor.
int vm_limit = 10;
thetime = time(0);
// Monitor only VMs that hasn't been monitored for 'poll_period' seconds.
last_poll = thetime - poll_period;
rc = vmpool->get_running(oids, vm_limit, last_poll);
rc = vmpool->get_running(oids, vm_limit, thetime - poll_period);
if ( rc != 0 || oids.empty() )
{
return;
}
for ( it = oids.begin(); it != oids.end(); it++ )
{
vm = vmpool->get(*it,true);
@ -874,7 +876,6 @@ void VirtualMachineManager::timer_action()
vmpool->update(vm);
vm->unlock();
}
}