]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: user can specify 'rgw port' to listen on a tcp port.
authorGuilhem Lettron <guilhem+github@lettron.fr>
Wed, 6 Feb 2013 21:38:52 +0000 (22:38 +0100)
committerSage Weil <sage@inktank.com>
Thu, 14 Feb 2013 20:38:55 +0000 (12:38 -0800)
'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 <guilhem.lettron@youscribe.com>
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
src/common/config_opts.h
src/rgw/rgw_main.cc

index 0d08132d89651d38260257bac84331b91c68ae77..58606d3c77fa74fa34db6095e9417739461faa86 100644 (file)
@@ -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
index 7af558f57e956a061b29bd28a943fe74d31080fa..3d4459cb576be783ad0c20446852cd2403423df2 100644 (file)
@@ -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);
     }