]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make fcgi optional during build 12345/head
authorBassam Tabbara <bassam.tabbara@quantum.com>
Mon, 5 Dec 2016 04:56:35 +0000 (20:56 -0800)
committerBassam Tabbara <bassam.tabbara@quantum.com>
Wed, 11 Jan 2017 22:06:08 +0000 (14:06 -0800)
fcgi can now be compiled out of the binary. this reduces the system
dependencies when fcgi is not needed or used.

Signed-off-by: Bassam Tabbara <bassam.tabbara@quantum.com>
CMakeLists.txt
src/include/config-h.in.cmake
src/rgw/CMakeLists.txt
src/rgw/rgw_main.cc
src/rgw/rgw_request.h

index 898e4abdbc5f9befa325c0cf9081889d6922abd2..b6a3a249de4864457540a11677006d966ca21e74 100644 (file)
@@ -337,12 +337,15 @@ endif(WITH_DPDK)
 
 #option for RGW
 option(WITH_RADOSGW "Rados Gateway is enabled" ON)
+option(WITH_RADOSGW_FCGI_FRONTEND "Rados Gateway's FCGI frontend is enabled" ON)
+option(WITH_RADOSGW_ASIO_FRONTEND "Rados Gateway's ASIO frontend is enabled" ON)
 if(WITH_RADOSGW)
   find_package(EXPAT REQUIRED)
-  find_package(fcgi REQUIRED)
+  if(WITH_RADOSGW_FCGI_FRONTEND)
+    find_package(fcgi REQUIRED)
+  endif()
 endif(WITH_RADOSGW)
 
-option(WITH_RADOSGW_ASIO_FRONTEND "Rados Gateway's ASIO frontend is enabled" ON)
 
 if (WITH_RADOSGW)
   if (NOT DEFINED OPENSSL_FOUND)
index dd92974c4492c23166ac257fadc88d2e3ce154ec..1ce47083bb3be1d2a4cadc62e4eea5f6d646226f 100644 (file)
 /* define if radosgw enabled */
 #cmakedefine WITH_RADOSGW
 
+/* define if radosgw enabled */
+#cmakedefine WITH_RADOSGW_FCGI_FRONTEND
+
 /* define if leveldb is enabled */
 #cmakedefine WITH_LEVELDB
 
index cd8a8f5193157c4e0396078efc5004f5713183eb..1bce3aea98da09613f8a94f344d9099334642661 100644 (file)
@@ -41,7 +41,6 @@ set(rgw_a_srcs
   rgw_cors_s3.cc
   rgw_dencoder.cc
   rgw_env.cc
-  rgw_fcgi.cc
   rgw_formats.cc
   rgw_frontend.cc
   rgw_gc.cc
@@ -101,6 +100,10 @@ set(rgw_a_srcs
   rgw_xml_enc.cc
   rgw_torrent.cc)
 
+if (WITH_RADOSGW_FCGI_FRONTEND)
+  list(APPEND rgw_a_srcs rgw_fcgi.cc)
+endif()
+
 add_library(rgw_a STATIC ${rgw_a_srcs})
 
 add_dependencies(rgw_a civetweb_h)
@@ -117,12 +120,15 @@ target_link_libraries(rgw_a librados cls_lock_client cls_rgw_client cls_refcount
   ${OPENLDAP_LIBRARIES} ${CRYPTO_LIBS})
 
 set(radosgw_srcs
-  rgw_fcgi_process.cc
   rgw_loadgen_process.cc
   rgw_civetweb.cc
   rgw_civetweb_frontend.cc
   rgw_civetweb_log.cc)
 
+if (WITH_RADOSGW_FCGI_FRONTEND)
+  list(APPEND radosgw_srcs rgw_fcgi_process.cc)
+endif()
+
 if (WITH_RADOSGW_ASIO_FRONTEND)
   list(APPEND radosgw_srcs
     rgw_asio_client.cc
@@ -138,7 +144,7 @@ target_link_libraries(radosgw radosgw_a librados
   cls_rgw_client cls_lock_client cls_refcount_client
   cls_log_client cls_statelog_client cls_timeindex_client
   cls_version_client cls_replica_log_client cls_user_client
-  global fcgi ${LIB_RESOLV}
+  global ${FCGI_LIBRARY} ${LIB_RESOLV}
   ${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${SSL_LIBRARIES} ${BLKID_LIBRARIES}
   ${ALLOC_LIBS})
 # radosgw depends on cls libraries at runtime, but not as link dependencies
@@ -155,7 +161,7 @@ target_link_libraries(radosgw-admin rgw_a librados
   cls_rgw_client cls_lock_client cls_refcount_client
   cls_log_client cls_statelog_client cls_timeindex_client
   cls_version_client cls_replica_log_client cls_user_client
-  global fcgi ${LIB_RESOLV}
+  global ${FCGI_LIBRARY} ${LIB_RESOLV}
   ${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${SSL_LIBRARIES} ${BLKID_LIBRARIES})
 install(TARGETS radosgw-admin DESTINATION bin)
 
@@ -173,7 +179,7 @@ target_link_libraries(radosgw-object-expirer rgw_a librados
   cls_rgw_client cls_lock_client cls_refcount_client
   cls_log_client cls_statelog_client cls_timeindex_client
   cls_version_client cls_replica_log_client cls_user_client
-  global fcgi ${LIB_RESOLV}
+  global ${FCGI_LIBRARY} ${LIB_RESOLV}
   ${CURL_LIBRARIES} ${EXPAT_LIBRARIES})
 install(TARGETS radosgw-object-expirer DESTINATION bin)
 
@@ -206,5 +212,5 @@ if(WITH_EMBEDDED)
   add_library(cephd_rgw_base STATIC rgw_main.cc ${radosgw_admin_srcs})
   set_target_properties(cephd_rgw_base PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
   merge_static_libraries(cephd_rgw cephd_rgw_base rgw_a radosgw_a)
-  target_link_libraries(cephd_rgw fcgi)
+  target_link_libraries(cephd_rgw ${FCGI_LIBRARY})
 endif()
index 88be22651f101eb3c7021d2069b9d89c5bc8f57b..363807617318a0ffe3784325a6ac1f4f7c046053 100644 (file)
@@ -110,7 +110,9 @@ static void signal_fd_finalize()
 static void handle_sigterm(int signum)
 {
   dout(1) << __func__ << dendl;
+#if defined(WITH_RADOSGW_FCGI_FRONTEND)
   FCGX_ShutdownPending();
+#endif
 
   // send a signal to make fcgi's accept(2) wake up.  unfortunately the
   // initial signal often isn't sufficient because we race with accept's
@@ -319,7 +321,9 @@ int main(int argc, const char **argv)
   
   curl_global_init(CURL_GLOBAL_ALL);
   
+#if defined(WITH_RADOSGW_FCGI_FRONTEND)
   FCGX_Init();
+#endif
 
   RGWRados *store = RGWStoreManager::get_storage(g_ceph_context,
       g_conf->rgw_enable_gc_threads, g_conf->rgw_enable_lc_threads, g_conf->rgw_enable_quota_threads,
@@ -453,7 +457,7 @@ int main(int argc, const char **argv)
        fiter != fe_map.end(); ++fiter) {
     RGWFrontendConfig *config = fiter->second;
     string framework = config->get_framework();
-    RGWFrontend *fe;
+    RGWFrontend *fe = NULL;
 #if defined(WITH_RADOSGW_ASIO_FRONTEND)
     if ((framework == "asio") &&
        cct->check_experimental_feature_enabled("rgw-asio-frontend")) {
@@ -463,23 +467,28 @@ int main(int argc, const char **argv)
       config->get_val("prefix", "", &uri_prefix);
       RGWProcessEnv env{ store, &rest, olog, port, uri_prefix };
       fe = new RGWAsioFrontend(env);
-    } else if (framework == "fastcgi" || framework == "fcgi") {
-#else
-    if (framework == "fastcgi" || framework == "fcgi") {
+    }
 #endif /* WITH_RADOSGW_ASIO_FRONTEND */
+#if defined(WITH_RADOSGW_FCGI_FRONTEND)
+    if (framework == "fastcgi" || framework == "fcgi") {
       std::string uri_prefix;
       config->get_val("prefix", "", &uri_prefix);
       RGWProcessEnv fcgi_pe = { store, &rest, olog, 0, uri_prefix };
 
       fe = new RGWFCGXFrontend(fcgi_pe, config);
-    } else if (framework == "civetweb" || framework == "mongoose") {
+    }
+#endif /* WITH_RADOSGW_FCGI_FRONTEND */
+    if (framework == "civetweb" || framework == "mongoose") {
+      int port;
+      config->get_val("port", 80, &port);
       std::string uri_prefix;
       config->get_val("prefix", "", &uri_prefix);
 
       RGWProcessEnv env = { store, &rest, olog, 0, uri_prefix };
 
       fe = new RGWCivetWebFrontend(env, config);
-    } else if (framework == "loadgen") {
+    }
+    if (framework == "loadgen") {
       int port;
       config->get_val("port", 80, &port);
       std::string uri_prefix;
@@ -488,7 +497,8 @@ int main(int argc, const char **argv)
       RGWProcessEnv env = { store, &rest, olog, port, uri_prefix };
 
       fe = new RGWLoadGenFrontend(env, config);
-    } else {
+    }
+    if (fe == NULL) {
       dout(0) << "WARNING: skipping unknown framework: " << framework << dendl;
       continue;
     }
index 29060d010c0259293701e93eb4a90468d83ceb9c..08b3717decdec677aa296627c238552c4d16456d 100644 (file)
@@ -9,8 +9,9 @@
 #include "rgw_acl.h"
 #include "rgw_user.h"
 #include "rgw_op.h"
+#if defined(WITH_RADOSGW_FCGI_FRONTEND)
 #include "rgw_fcgi.h"
-
+#endif
 #include "common/QueueRing.h"
 
 struct RGWRequest
@@ -34,6 +35,7 @@ struct RGWRequest
   void log(struct req_state *s, const char *msg);
 }; /* RGWRequest */
 
+#if defined(WITH_RADOSGW_FCGI_FRONTEND)
 struct RGWFCGXRequest : public RGWRequest {
   FCGX_Request *fcgx;
   QueueRing<FCGX_Request *> *qr;
@@ -48,6 +50,7 @@ struct RGWFCGXRequest : public RGWRequest {
     qr->enqueue(fcgx);
   }
 };
+#endif
 
 struct RGWLoadGenRequest : public RGWRequest {
        string method;