From 6b63fd4fe0228d424815341f9b83336467af3838 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 16 Aug 2011 18:12:45 +0200 Subject: [PATCH] feature: New configuration attribute for the the number of HOSTs and VMs to be monitored per interval. --- include/InformationManager.h | 7 +++++++ include/VirtualMachineManager.h | 6 ++++++ share/etc/oned.conf | 10 +++++++--- src/im/InformationManager.cc | 3 --- src/lcm/test/DummyManager.h | 2 +- src/nebula/Nebula.cc | 8 ++++++++ src/nebula/NebulaTemplate.cc | 14 ++++++++++++++ src/test/NebulaTest.cc | 2 ++ src/vmm/VirtualMachineManager.cc | 8 +++----- 9 files changed, 48 insertions(+), 12 deletions(-) diff --git a/include/InformationManager.h b/include/InformationManager.h index 2fbac3c78d..55ed449804 100644 --- a/include/InformationManager.h +++ b/include/InformationManager.h @@ -34,12 +34,14 @@ public: HostPool * _hpool, time_t _timer_period, time_t _monitor_period, + int _host_limit, const string& _remotes_location, vector& _mads) :MadManager(_mads), hpool(_hpool), timer_period(_timer_period), monitor_period(_monitor_period), + host_limit(_host_limit), remotes_location(_remotes_location) { am.addListener(this); @@ -98,6 +100,11 @@ private: */ time_t monitor_period; + /** + * Host monitoring limit + */ + int host_limit; + /** * Path for the remote action programs */ diff --git a/include/VirtualMachineManager.h b/include/VirtualMachineManager.h index 92b35c6407..03fea34a94 100644 --- a/include/VirtualMachineManager.h +++ b/include/VirtualMachineManager.h @@ -37,6 +37,7 @@ public: HostPool * _hpool, time_t _timer_period, time_t _poll_period, + int _vm_limit, vector& _mads); ~VirtualMachineManager(){}; @@ -118,6 +119,11 @@ private: */ time_t poll_period; + /** + * Virtual Machine polling limit + */ + int vm_limit; + /** * Action engine for the Manager */ diff --git a/share/etc/oned.conf b/share/etc/oned.conf index e7d872cc0a..af3757c9bf 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -10,9 +10,11 @@ # than MANAGER_TIMER. # # HOST_MONITORING_INTERVAL: Time in seconds between host monitorization. +# HOST_PER_INTERVAL: Number of hosts monitored in each interval. # # VM_POLLING_INTERVAL: Time in seconds between virtual machine monitorization. # (use 0 to disable VM monitoring). +# VM_PER_INTERVAL: Number of VMs monitored in each interval. # # 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 @@ -39,17 +41,19 @@ # DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG #******************************************************************************* -#MANAGER_TIMER=30 +#MANAGER_TIMER = 30 HOST_MONITORING_INTERVAL = 600 +#HOST_PER_INTERVAL = 15 VM_POLLING_INTERVAL = 600 +#VM_PER_INTERVAL = 5 #VM_DIR=/srv/cloud/one/var SCRIPTS_REMOTE_DIR=/var/tmp/one -PORT=2633 +PORT = 2633 DB = [ backend = "sqlite" ] @@ -63,7 +67,7 @@ DB = [ backend = "sqlite" ] VNC_BASE_PORT = 5900 -DEBUG_LEVEL=3 +DEBUG_LEVEL = 3 #******************************************************************************* # Physical Networks configuration diff --git a/src/im/InformationManager.cc b/src/im/InformationManager.cc index fc662ed910..34d7030137 100644 --- a/src/im/InformationManager.cc +++ b/src/im/InformationManager.cc @@ -147,9 +147,6 @@ void InformationManager::timer_action() Host * host; istringstream iss; - // -------------- Max. number of hosts to monitor. --------------------- - int host_limit = 15; - mark = mark + timer_period; if ( mark >= 600 ) diff --git a/src/lcm/test/DummyManager.h b/src/lcm/test/DummyManager.h index 26dd3a04af..25cc7c7721 100644 --- a/src/lcm/test/DummyManager.h +++ b/src/lcm/test/DummyManager.h @@ -93,7 +93,7 @@ public: time_t _poll_period, vector& _mads): VirtualMachineManager( _vmpool, _hpool, _timer_period, - _poll_period, _mads){} + _poll_period, 5, _mads){} void trigger(Actions action, int _vid) { diff --git a/src/nebula/Nebula.cc b/src/nebula/Nebula.cc index e5fd6bc7e3..685e93cf22 100644 --- a/src/nebula/Nebula.cc +++ b/src/nebula/Nebula.cc @@ -339,9 +339,12 @@ void Nebula::start() { time_t poll_period; vector vmm_mads; + int vm_limit; nebula_configuration->get("VM_POLLING_INTERVAL", poll_period); + nebula_configuration->get("VM_PER_INTERVAL", vm_limit); + nebula_configuration->get("VM_MAD", vmm_mads); vmm = new VirtualMachineManager( @@ -349,6 +352,7 @@ void Nebula::start() hpool, timer_period, poll_period, + vm_limit, vmm_mads); } catch (bad_alloc&) @@ -385,14 +389,18 @@ void Nebula::start() { vector im_mads; time_t monitor_period; + int host_limit; nebula_configuration->get("HOST_MONITORING_INTERVAL", monitor_period); + nebula_configuration->get("HOST_PER_INTERVAL", host_limit); + nebula_configuration->get("IM_MAD", im_mads); im = new InformationManager(hpool, timer_period, monitor_period, + host_limit, remotes_location, im_mads); } diff --git a/src/nebula/NebulaTemplate.cc b/src/nebula/NebulaTemplate.cc index 91c0f29812..4e7e87b8b6 100644 --- a/src/nebula/NebulaTemplate.cc +++ b/src/nebula/NebulaTemplate.cc @@ -47,7 +47,9 @@ NebulaTemplate::NebulaTemplate(string& etc_location, string& var_location) # Daemon configuration attributes #------------------------------------------------------------------------------- # HOST_MONITORING_INTERVAL +# HOST_PER_INTERVAL # VM_POLLING_INTERVAL +# VM_PER_INTERVAL # VM_DIR # PORT # DB @@ -61,12 +63,24 @@ NebulaTemplate::NebulaTemplate(string& etc_location, string& var_location) attribute = new SingleAttribute("HOST_MONITORING_INTERVAL",value); conf_default.insert(make_pair(attribute->name(),attribute)); + // HOST_PER_INTERVAL + value = "15"; + + attribute = new SingleAttribute("HOST_PER_INTERVAL",value); + conf_default.insert(make_pair(attribute->name(),attribute)); + // POLL_INTERVAL value = "600"; attribute = new SingleAttribute("VM_POLLING_INTERVAL",value); conf_default.insert(make_pair(attribute->name(),attribute)); + // VM_PER_INTERVAL + value = "5"; + + attribute = new SingleAttribute("VM_PER_INTERVAL",value); + conf_default.insert(make_pair(attribute->name(),attribute)); + //VM_DIR attribute = new SingleAttribute("VM_DIR",var_location); conf_default.insert(make_pair(attribute->name(),attribute)); diff --git a/src/test/NebulaTest.cc b/src/test/NebulaTest.cc index d25c93adbb..1949fba438 100644 --- a/src/test/NebulaTest.cc +++ b/src/test/NebulaTest.cc @@ -71,6 +71,7 @@ VirtualMachineManager* NebulaTest::create_vmm(VirtualMachinePool* vmpool, hpool, timer_period, poll_period, + 5, vmm_mads); } @@ -90,6 +91,7 @@ InformationManager* NebulaTest::create_im(HostPool* hpool, return new InformationManager(hpool, timer_period, monitor_period, + 15, remotes_location, im_mads); } diff --git a/src/vmm/VirtualMachineManager.cc b/src/vmm/VirtualMachineManager.cc index 5aec753989..fc43d3380f 100644 --- a/src/vmm/VirtualMachineManager.cc +++ b/src/vmm/VirtualMachineManager.cc @@ -33,12 +33,14 @@ VirtualMachineManager::VirtualMachineManager( HostPool * _hpool, time_t _timer_period, time_t _poll_period, + int _vm_limit, vector& _mads): MadManager(_mads), vmpool(_vmpool), hpool(_hpool), timer_period(_timer_period), - poll_period(_poll_period) + poll_period(_poll_period), + vm_limit(_vm_limit) { am.addListener(this); }; @@ -822,10 +824,6 @@ void VirtualMachineManager::timer_action() const VirtualMachineManagerDriver * vmd; - // -------------- Max. number of VMs to monitor. --------------------- - int vm_limit = 5; - - mark = mark + timer_period; if ( mark >= 600 )