From: Guilhem Lettron Date: Wed, 6 Feb 2013 21:38:52 +0000 (+0100) Subject: rgw: user can specify 'rgw port' to listen on a tcp port. X-Git-Tag: v0.58~63 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a14bae6049c234fc7b61d6b4479e9380901cb150;p=ceph.git rgw: user can specify 'rgw port' to listen on a tcp port. 'rgw socket path' overrides 'rgw port'. An 'rgw host' can be set to listen on a specific ip (default is 0.0.0.0) Signed-off-by: Guilhem Lettron Reviewed-by: Yehuda Sadeh --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 0d08132d8965..58606d3c77fa 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -461,6 +461,8 @@ OPTION(rgw_enable_apis, OPT_STR, "s3, swift, swift_auth, admin") OPTION(rgw_cache_enabled, OPT_BOOL, true) // rgw cache enabled OPTION(rgw_cache_lru_size, OPT_INT, 10000) // num of entries in rgw cache OPTION(rgw_socket_path, OPT_STR, "") // path to unix domain socket, if not specified, rgw will not run as external fcgi +OPTION(rgw_host, OPT_STR, "") // host for radosgw, can be an IP, default is 0.0.0.0 +OPTION(rgw_port, OPT_STR, "") // port TCP to listen, format as "8080" "5000", if not specified, rgw will not run as external fcgi OPTION(rgw_dns_name, OPT_STR, "") OPTION(rgw_script_uri, OPT_STR, "") // alternative value for SCRIPT_URI if not set in request OPTION(rgw_request_uri, OPT_STR, "") // alternative value for REQUEST_URI if not set in request diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 7af558f57e95..3d4459cb576b 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -223,6 +223,13 @@ void RGWProcess::run() if (chmod(path, 0777) < 0) { dout(0) << "WARNING: couldn't set permissions on unix domain socket" << dendl; } + } else if (!g_conf->rgw_port.empty()) { + string bind = g_conf->rgw_host + ":" + g_conf->rgw_port; + sock_fd = FCGX_OpenSocket(bind.c_str(), SOCKET_BACKLOG); + if (sock_fd < 0) { + dout(0) << "ERROR: FCGX_OpenSocket (" << bind.c_str() << ") returned " << sock_fd << dendl; + return; + } } m_tp.start(); @@ -398,8 +405,8 @@ int main(int argc, const char **argv) CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS); if (g_conf->daemonize) { - if (g_conf->rgw_socket_path.empty()) { - cerr << "radosgw: must specify 'rgw socket path' to run as a daemon" << std::endl; + if (g_conf->rgw_socket_path.empty() and g_conf->rgw_port.empty()) { + cerr << "radosgw: must specify 'rgw socket path' or 'rgw port' to run as a daemon" << std::endl; exit(1); }