mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-28 14:50:08 +03:00
:im-threads: Add oned.conf configuration attribute. Moved thread pool to IM
(cherry picked from commit 3ab3b92de2c054f63e3c9b40246082d24b451e1e)
This commit is contained in:
parent
9f691779cd
commit
78171a42a2
@ -20,6 +20,7 @@
|
||||
#include "MadManager.h"
|
||||
#include "ActionManager.h"
|
||||
#include "InformationManagerDriver.h"
|
||||
#include "MonitorThread.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -38,6 +39,7 @@ public:
|
||||
time_t _timer_period,
|
||||
time_t _monitor_period,
|
||||
int _host_limit,
|
||||
int _monitor_threads,
|
||||
const string& _remotes_location,
|
||||
vector<const Attribute*>& _mads)
|
||||
:MadManager(_mads),
|
||||
@ -46,7 +48,8 @@ public:
|
||||
timer_period(_timer_period),
|
||||
monitor_period(_monitor_period),
|
||||
host_limit(_host_limit),
|
||||
remotes_location(_remotes_location)
|
||||
remotes_location(_remotes_location),
|
||||
mtpool(_monitor_threads)
|
||||
{
|
||||
am.addListener(this);
|
||||
};
|
||||
@ -141,6 +144,11 @@ private:
|
||||
*/
|
||||
ActionManager am;
|
||||
|
||||
/**
|
||||
* Pool of threads to process each monitor message
|
||||
*/
|
||||
MonitorThreadPool mtpool;
|
||||
|
||||
/**
|
||||
* Function to execute the Manager action loop method within a new pthread
|
||||
* (requires C linkage)
|
||||
|
@ -40,7 +40,8 @@ public:
|
||||
InformationManagerDriver(
|
||||
int userid,
|
||||
const map<string,string>& attrs,
|
||||
bool sudo);
|
||||
bool sudo,
|
||||
MonitorThreadPool * mtpool);
|
||||
|
||||
virtual ~InformationManagerDriver();
|
||||
|
||||
@ -75,6 +76,9 @@ public:
|
||||
private:
|
||||
friend class InformationManager;
|
||||
|
||||
/**
|
||||
* Pointer to the Monitor Thread Pool to process monitor messages
|
||||
*/
|
||||
MonitorThreadPool * mtpool;
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#
|
||||
# MONITORING_INTERVAL: Time in seconds between host and VM monitorization.
|
||||
#
|
||||
# MONITORING_THREADS: Max. number of threads used to process monitor messages
|
||||
#
|
||||
# HOST_PER_INTERVAL: Number of hosts monitored in each interval.
|
||||
# HOST_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring
|
||||
# information. Use 0 to disable HOST monitoring recording.
|
||||
@ -52,7 +54,8 @@ LOG = [
|
||||
|
||||
#MANAGER_TIMER = 30
|
||||
|
||||
MONITORING_INTERVAL = 60
|
||||
MONITORING_INTERVAL = 60
|
||||
MONITORING_THREADS = 50
|
||||
|
||||
#HOST_PER_INTERVAL = 15
|
||||
#HOST_MONITORING_EXPIRATION_TIME = 43200
|
||||
|
@ -71,7 +71,7 @@ int InformationManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("InM",Log::INFO,oss);
|
||||
|
||||
im_mad = new InformationManagerDriver(0,vattr->value(),false);
|
||||
im_mad = new InformationManagerDriver(0,vattr->value(),false,&mtpool);
|
||||
|
||||
rc = add(im_mad);
|
||||
|
||||
|
@ -27,21 +27,13 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
InformationManagerDriver::InformationManagerDriver(
|
||||
int userid,
|
||||
const map<string,string>& attrs,
|
||||
bool sudo):
|
||||
Mad(userid,attrs,sudo)
|
||||
{
|
||||
mtpool = new MonitorThreadPool(100);
|
||||
};
|
||||
int userid,
|
||||
const map<string,string>& attrs,
|
||||
bool sudo,
|
||||
MonitorThreadPool * _mtpool):
|
||||
Mad(userid,attrs,sudo), mtpool(_mtpool){};
|
||||
|
||||
InformationManagerDriver::~InformationManagerDriver()
|
||||
{
|
||||
if (mtpool != 0)
|
||||
{
|
||||
delete mtpool;
|
||||
}
|
||||
};
|
||||
InformationManagerDriver::~InformationManagerDriver(){};
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Driver ASCII Protocol Implementation */
|
||||
|
@ -724,10 +724,14 @@ void Nebula::start(bool bootstrap_only)
|
||||
try
|
||||
{
|
||||
vector<const Attribute *> im_mads;
|
||||
int host_limit;
|
||||
|
||||
int host_limit;
|
||||
int monitor_threads;
|
||||
|
||||
nebula_configuration->get("HOST_PER_INTERVAL", host_limit);
|
||||
|
||||
nebula_configuration->get("MONITORING_THREADS", monitor_threads);
|
||||
|
||||
nebula_configuration->get("IM_MAD", im_mads);
|
||||
|
||||
im = new InformationManager(hpool,
|
||||
@ -735,6 +739,7 @@ void Nebula::start(bool bootstrap_only)
|
||||
timer_period,
|
||||
monitor_period,
|
||||
host_limit,
|
||||
monitor_threads,
|
||||
remotes_location,
|
||||
im_mads);
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
# Daemon configuration attributes
|
||||
#-------------------------------------------------------------------------------
|
||||
# MONITORING_INTERVAL
|
||||
# MONITORING_THREADS
|
||||
# HOST_PER_INTERVAL
|
||||
# HOST_MONITORING_EXPIRATION_TIME
|
||||
# VM_PER_INTERVAL
|
||||
@ -107,6 +108,12 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
attribute = new SingleAttribute("MONITORING_INTERVAL",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// MONITORING_THREADS
|
||||
value = "50";
|
||||
|
||||
attribute = new SingleAttribute("MONITORING_THREADS",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// HOST_PER_INTERVAL
|
||||
value = "15";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user