diff --git a/share/etc/oned.conf b/share/etc/oned.conf index a4df04a6bc..18eb97706f 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -101,13 +101,17 @@ VNC_BASE_PORT = 5900 # # TIMEOUT: Maximum time in seconds the server will wait for the client to # do anything while processing an RPC +# +# RPC_LOG: Create a separated log file for xml-rpc requests, in +# "/var/log/one/one_xmlrpc.log". #******************************************************************************* -#MAX_CONN = 15 -#MAX_CONN_BACKLOG = 15 -#KEEPALIVE_TIMEOUT = 15 -#KEEPALIVE_MAX_CONN = 30 -#TIMEOUT = 15 +#MAX_CONN = 15 +#MAX_CONN_BACKLOG = 15 +#KEEPALIVE_TIMEOUT = 15 +#KEEPALIVE_MAX_CONN = 30 +#TIMEOUT = 15 +#RPC_LOG = NO #******************************************************************************* # Physical Networks configuration diff --git a/src/nebula/Nebula.cc b/src/nebula/Nebula.cc index 312c7b956e..8d936f6f86 100644 --- a/src/nebula/Nebula.cc +++ b/src/nebula/Nebula.cc @@ -931,12 +931,15 @@ void Nebula::start(bool bootstrap_only) // ---- Request Manager ---- try { - int rm_port = 0; - int max_conn; - int max_conn_backlog; - int keepalive_timeout; - int keepalive_max_conn; - int timeout; + int rm_port = 0; + int max_conn; + int max_conn_backlog; + int keepalive_timeout; + int keepalive_max_conn; + int timeout; + bool rpc_log; + + string rpc_filename = ""; nebula_configuration->get("PORT", rm_port); nebula_configuration->get("MAX_CONN", max_conn); @@ -944,10 +947,15 @@ void Nebula::start(bool bootstrap_only) nebula_configuration->get("KEEPALIVE_TIMEOUT", keepalive_timeout); nebula_configuration->get("KEEPALIVE_MAX_CONN", keepalive_max_conn); nebula_configuration->get("TIMEOUT", timeout); + nebula_configuration->get("RPC_LOG", rpc_log); + + if (rpc_log) + { + rpc_filename = 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"); + keepalive_timeout, keepalive_max_conn, timeout, rpc_filename); } catch (bad_alloc&) { diff --git a/src/nebula/NebulaTemplate.cc b/src/nebula/NebulaTemplate.cc index 825781cbb1..d1b50534d2 100644 --- a/src/nebula/NebulaTemplate.cc +++ b/src/nebula/NebulaTemplate.cc @@ -190,6 +190,7 @@ void OpenNebulaTemplate::set_conf_default() # KEEPALIVE_TIMEOUT # KEEPALIVE_MAX_CONN # TIMEOUT +# RPC_LOG #******************************************************************************* */ // MAX_CONN @@ -222,6 +223,11 @@ void OpenNebulaTemplate::set_conf_default() attribute = new SingleAttribute("TIMEOUT",value); conf_default.insert(make_pair(attribute->name(),attribute)); + // RPC_LOG + value = "NO"; + + attribute = new SingleAttribute("RPC_LOG",value); + conf_default.insert(make_pair(attribute->name(),attribute)); /* #******************************************************************************* # Physical Networks configuration diff --git a/src/rm/RequestManager.cc b/src/rm/RequestManager.cc index bdd4b5e3f9..6e544df20c 100644 --- a/src/rm/RequestManager.cc +++ b/src/rm/RequestManager.cc @@ -94,25 +94,25 @@ extern "C" void * rm_xml_server_loop(void *arg) //Start the server -#ifdef OLD_XMLRPC - rm->AbyssServer = new xmlrpc_c::serverAbyss(xmlrpc_c::serverAbyss::constrOpt() - .registryP(&rm->RequestManagerRegistry) - .logFileName(rm->xml_log_file) - .keepaliveTimeout(rm->keepalive_timeout) - .keepaliveMaxConn(rm->keepalive_max_conn) - .timeout(rm->timeout) - .socketFd(rm->socket_fd)); -#else - rm->AbyssServer = new xmlrpc_c::serverAbyss(xmlrpc_c::serverAbyss::constrOpt() - .registryP(&rm->RequestManagerRegistry) - .logFileName(rm->xml_log_file) - .maxConn(rm->max_conn) - .maxConnBacklog(rm->max_conn_backlog) - .keepaliveTimeout(rm->keepalive_timeout) - .keepaliveMaxConn(rm->keepalive_max_conn) - .timeout(rm->timeout) - .socketFd(rm->socket_fd)); -#endif /* OLD_XMLRPC */ + xmlrpc_c::serverAbyss::constrOpt opt = xmlrpc_c::serverAbyss::constrOpt(); + + opt.registryP(&rm->RequestManagerRegistry); + opt.keepaliveTimeout(rm->keepalive_timeout); + opt.keepaliveMaxConn(rm->keepalive_max_conn); + opt.timeout(rm->timeout); + opt.socketFd(rm->socket_fd); + + if (!rm->xml_log_file.empty()) + { + opt.logFileName(rm->xml_log_file); + } + +#ifndef OLD_XMLRPC + opt.maxConn(rm->max_conn); + opt.maxConnBacklog(rm->max_conn_backlog); +#endif + + rm->AbyssServer = new xmlrpc_c::serverAbyss(opt); rm->AbyssServer->run();