mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Feature #2245: Add new xmlrpc config params to oned.conf
(cherry picked from commit b84158f98d
)
This commit is contained in:
parent
09a10e3dcc
commit
4926f60fdb
@ -42,8 +42,22 @@ class RequestManager : public ActionListener
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RequestManager(int _port, const string _xml_log_file)
|
RequestManager(
|
||||||
:port(_port), socket_fd(-1), xml_log_file(_xml_log_file)
|
int _port,
|
||||||
|
int _max_conn,
|
||||||
|
int _max_conn_backlog,
|
||||||
|
int _keepalive_timeout,
|
||||||
|
int _keepalive_max_conn,
|
||||||
|
int _timeout,
|
||||||
|
const string _xml_log_file):
|
||||||
|
port(_port),
|
||||||
|
socket_fd(-1),
|
||||||
|
max_conn(_max_conn),
|
||||||
|
max_conn_backlog(_max_conn_backlog),
|
||||||
|
keepalive_timeout(_keepalive_timeout),
|
||||||
|
keepalive_max_conn(_keepalive_max_conn),
|
||||||
|
timeout(_timeout),
|
||||||
|
xml_log_file(_xml_log_file)
|
||||||
{
|
{
|
||||||
am.addListener(this);
|
am.addListener(this);
|
||||||
};
|
};
|
||||||
|
@ -78,6 +78,34 @@ VNC_BASE_PORT = 5900
|
|||||||
|
|
||||||
#VM_SUBMIT_ON_HOLD = "NO"
|
#VM_SUBMIT_ON_HOLD = "NO"
|
||||||
|
|
||||||
|
#*******************************************************************************
|
||||||
|
# XML-RPC server configuration
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# These are configuration parameters for oned's xmlrpc-c server
|
||||||
|
#
|
||||||
|
# MAX_CONN: Maximum number of simultaneous TCP connections the server
|
||||||
|
# will maintain
|
||||||
|
#
|
||||||
|
# MAX_CONN_BACKLOG: Maximum number of TCP connections the operating system
|
||||||
|
# will accept on the server's behalf without the server accepting them from
|
||||||
|
# the operating system
|
||||||
|
#
|
||||||
|
# KEEPALIVE_TIMEOUT: Maximum time in seconds that the server allows a
|
||||||
|
# connection to be open between RPCs
|
||||||
|
#
|
||||||
|
# KEEPALIVE_MAX_CONN: Maximum number of RPCs that the server will execute on
|
||||||
|
# a single connection
|
||||||
|
#
|
||||||
|
# TIMEOUT: Maximum time in seconds the server will wait for the client to
|
||||||
|
# do anything while processing an RPC
|
||||||
|
#*******************************************************************************
|
||||||
|
|
||||||
|
#MAX_CONN = 15
|
||||||
|
#MAX_CONN_BACKLOG = 15
|
||||||
|
#KEEPALIVE_TIMEOUT = 15
|
||||||
|
#KEEPALIVE_MAX_CONN = 30
|
||||||
|
#TIMEOUT = 15
|
||||||
|
|
||||||
#*******************************************************************************
|
#*******************************************************************************
|
||||||
# Physical Networks configuration
|
# Physical Networks configuration
|
||||||
#*******************************************************************************
|
#*******************************************************************************
|
||||||
|
@ -875,11 +875,23 @@ void Nebula::start()
|
|||||||
// ---- Request Manager ----
|
// ---- Request Manager ----
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int rm_port = 0;
|
int rm_port = 0;
|
||||||
|
int max_conn;
|
||||||
|
int max_conn_backlog;
|
||||||
|
int keepalive_timeout;
|
||||||
|
int keepalive_max_conn;
|
||||||
|
int timeout;
|
||||||
|
|
||||||
nebula_configuration->get("PORT", rm_port);
|
nebula_configuration->get("PORT", rm_port);
|
||||||
|
nebula_configuration->get("MAX_CONN", max_conn);
|
||||||
|
nebula_configuration->get("MAX_CONN_BACKLOG", max_conn_backlog);
|
||||||
|
nebula_configuration->get("KEEPALIVE_TIMEOUT", keepalive_timeout);
|
||||||
|
nebula_configuration->get("KEEPALIVE_MAX_CONN", keepalive_max_conn);
|
||||||
|
nebula_configuration->get("TIMEOUT", timeout);
|
||||||
|
|
||||||
rm = new RequestManager(rm_port, log_location + "one_xmlrpc.log");
|
rm = new RequestManager(rm_port, max_conn, max_conn_backlog,
|
||||||
|
keepalive_timeout, keepalive_max_conn, timeout,
|
||||||
|
log_location + "one_xmlrpc.log");
|
||||||
}
|
}
|
||||||
catch (bad_alloc&)
|
catch (bad_alloc&)
|
||||||
{
|
{
|
||||||
|
@ -176,6 +176,47 @@ void OpenNebulaTemplate::set_conf_default()
|
|||||||
conf_default.insert(make_pair(vattribute->name(),vattribute));
|
conf_default.insert(make_pair(vattribute->name(),vattribute));
|
||||||
/*
|
/*
|
||||||
#*******************************************************************************
|
#*******************************************************************************
|
||||||
|
# XML-RPC server configuration
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# MAX_CONN
|
||||||
|
# MAX_CONN_BACKLOG
|
||||||
|
# KEEPALIVE_TIMEOUT
|
||||||
|
# KEEPALIVE_MAX_CONN
|
||||||
|
# TIMEOUT
|
||||||
|
#*******************************************************************************
|
||||||
|
*/
|
||||||
|
// MAX_CONN
|
||||||
|
value = "15";
|
||||||
|
|
||||||
|
attribute = new SingleAttribute("MAX_CONN",value);
|
||||||
|
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||||
|
|
||||||
|
// MAX_CONN_BACKLOG
|
||||||
|
value = "15";
|
||||||
|
|
||||||
|
attribute = new SingleAttribute("MAX_CONN_BACKLOG",value);
|
||||||
|
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||||
|
|
||||||
|
// KEEPALIVE_TIMEOUT
|
||||||
|
value = "15";
|
||||||
|
|
||||||
|
attribute = new SingleAttribute("KEEPALIVE_TIMEOUT",value);
|
||||||
|
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||||
|
|
||||||
|
// KEEPALIVE_MAX_CONN
|
||||||
|
value = "30";
|
||||||
|
|
||||||
|
attribute = new SingleAttribute("KEEPALIVE_MAX_CONN",value);
|
||||||
|
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||||
|
|
||||||
|
// TIMEOUT
|
||||||
|
value = "15";
|
||||||
|
|
||||||
|
attribute = new SingleAttribute("TIMEOUT",value);
|
||||||
|
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||||
|
|
||||||
|
/*
|
||||||
|
#*******************************************************************************
|
||||||
# Physical Networks configuration
|
# Physical Networks configuration
|
||||||
#*******************************************************************************
|
#*******************************************************************************
|
||||||
# NETWORK_SIZE
|
# NETWORK_SIZE
|
||||||
|
@ -78,14 +78,6 @@ extern "C" void * rm_action_loop(void *arg)
|
|||||||
extern "C" void * rm_xml_server_loop(void *arg)
|
extern "C" void * rm_xml_server_loop(void *arg)
|
||||||
{
|
{
|
||||||
RequestManager * rm;
|
RequestManager * rm;
|
||||||
Nebula& nd = Nebula::instance();
|
|
||||||
string str;
|
|
||||||
ostringstream oss;
|
|
||||||
unsigned int max_conn = 15;
|
|
||||||
unsigned int max_conn_backlog = 15;
|
|
||||||
unsigned int keepalive_timeout = 15;
|
|
||||||
unsigned int keepalive_max_conn = 30;
|
|
||||||
unsigned int timeout = 15;
|
|
||||||
|
|
||||||
if ( arg == 0 )
|
if ( arg == 0 )
|
||||||
{
|
{
|
||||||
@ -94,62 +86,6 @@ extern "C" void * rm_xml_server_loop(void *arg)
|
|||||||
|
|
||||||
rm = static_cast<RequestManager *>(arg);
|
rm = static_cast<RequestManager *>(arg);
|
||||||
|
|
||||||
// Get configuration parameters
|
|
||||||
|
|
||||||
// MAX_CONN
|
|
||||||
nd.get_configuration_attribute("MAX_CONN", str);
|
|
||||||
if (!str.empty())
|
|
||||||
{
|
|
||||||
max_conn = atoi(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
oss << "max_conn: " << max_conn;
|
|
||||||
NebulaLog::log("ReM",Log::DEBUG, oss);
|
|
||||||
|
|
||||||
// MAX_CONN_BACKLOG
|
|
||||||
nd.get_configuration_attribute("MAX_CONN_BACKLOG", str);
|
|
||||||
if (!str.empty())
|
|
||||||
{
|
|
||||||
max_conn_backlog = atoi(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
oss.str("");
|
|
||||||
oss << "max_conn_backlog: " << max_conn_backlog;
|
|
||||||
NebulaLog::log("ReM",Log::DEBUG, oss);
|
|
||||||
|
|
||||||
// KEEPALIVE_TIMEOUT
|
|
||||||
nd.get_configuration_attribute("KEEPALIVE_TIMEOUT", str);
|
|
||||||
if (!str.empty())
|
|
||||||
{
|
|
||||||
keepalive_timeout = atoi(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
oss.str("");
|
|
||||||
oss << "keepalive_timeout: " << keepalive_timeout;
|
|
||||||
NebulaLog::log("ReM",Log::DEBUG, oss);
|
|
||||||
|
|
||||||
// KEEPALIVE_MAX_CONN
|
|
||||||
nd.get_configuration_attribute("KEEPALIVE_MAX_CONN", str);
|
|
||||||
if (!str.empty())
|
|
||||||
{
|
|
||||||
keepalive_max_conn = atoi(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
oss.str("");
|
|
||||||
oss << "keepalive_max_conn: " << keepalive_max_conn;
|
|
||||||
NebulaLog::log("ReM",Log::DEBUG, oss);
|
|
||||||
|
|
||||||
// TIMEOUT
|
|
||||||
nd.get_configuration_attribute("TIMEOUT", str);
|
|
||||||
if (!str.empty())
|
|
||||||
{
|
|
||||||
timeout = atoi(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
oss.str("");
|
|
||||||
oss << "timeout: " << timeout;
|
|
||||||
NebulaLog::log("ReM",Log::DEBUG, oss);
|
|
||||||
|
|
||||||
// Set cancel state for the thread
|
// Set cancel state for the thread
|
||||||
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0);
|
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0);
|
||||||
@ -161,11 +97,11 @@ extern "C" void * rm_xml_server_loop(void *arg)
|
|||||||
rm->AbyssServer = new xmlrpc_c::serverAbyss(xmlrpc_c::serverAbyss::constrOpt()
|
rm->AbyssServer = new xmlrpc_c::serverAbyss(xmlrpc_c::serverAbyss::constrOpt()
|
||||||
.registryP(&rm->RequestManagerRegistry)
|
.registryP(&rm->RequestManagerRegistry)
|
||||||
.logFileName(rm->xml_log_file)
|
.logFileName(rm->xml_log_file)
|
||||||
.maxConn(max_conn)
|
.maxConn(rm->max_conn)
|
||||||
.maxConnBacklog(max_conn_backlog)
|
.maxConnBacklog(rm->max_conn_backlog)
|
||||||
.keepaliveTimeout(keepalive_timeout)
|
.keepaliveTimeout(rm->keepalive_timeout)
|
||||||
.keepaliveMaxConn(keepalive_max_conn)
|
.keepaliveMaxConn(rm->keepalive_max_conn)
|
||||||
.timeout(timeout)
|
.timeout(rm->timeout)
|
||||||
.socketFd(rm->socket_fd));
|
.socketFd(rm->socket_fd));
|
||||||
|
|
||||||
rm->AbyssServer->run();
|
rm->AbyssServer->run();
|
||||||
|
Loading…
Reference in New Issue
Block a user