]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW - Zipper - Allow per-store admin APIs 48003/head
authorDaniel Gryniewicz <dang@redhat.com>
Thu, 1 Sep 2022 17:52:26 +0000 (13:52 -0400)
committerDaniel Gryniewicz <dang@redhat.com>
Thu, 8 Sep 2022 16:38:57 +0000 (12:38 -0400)
Some of the existing admin APIs are rados-specific, and other stores
will want to add specific APIs.  Allow this by having a function to add
store-specific APIs.

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
src/rgw/CMakeLists.txt
src/rgw/rgw_main.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.h
src/rgw/rgw_sal_motr.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h

index 01a4e6c3fe654451362160a1cca39d01337dd52a..6206db6ff1844aa4650aa2c877c5295c2aa6656b 100644 (file)
@@ -121,12 +121,15 @@ set(librgw_common_srcs
   rgw_rados.cc
   rgw_resolve.cc
   rgw_rest.cc
+  rgw_rest_bucket.cc
   rgw_rest_client.cc
+  rgw_rest_config.cc
   rgw_rest_conn.cc
   rgw_rest_log.cc
   rgw_rest_metadata.cc
   rgw_rest_pubsub.cc
   rgw_rest_pubsub_common.cc
+  rgw_rest_ratelimit.cc
   rgw_rest_realm.cc
   rgw_rest_role.cc
   rgw_rest_s3.cc
@@ -283,16 +286,10 @@ set(rgw_a_srcs
   rgw_realm_watcher.cc
   rgw_os_lib.cc
   rgw_process.cc
-  rgw_rest_bucket.cc
-  rgw_rest_config.cc
-  rgw_rest_log.cc
-  rgw_rest_metadata.cc
-  rgw_rest_realm.cc
   rgw_rest_swift.cc
   rgw_rest_usage.cc
   rgw_rest_info.cc
   rgw_rest_user.cc
-  rgw_rest_ratelimit.cc
   rgw_swift_auth.cc
   rgw_usage.cc
   rgw_opa.cc
index eb9ed5a63ef200bf7cffb71bcb1eb836657a4e74..2b6e66e3806f1dd7398e2ee4682570ed9ba26759 100644 (file)
 #include "rgw_rest_info.h"
 #include "rgw_rest_usage.h"
 #include "rgw_rest_user.h"
-#include "rgw_rest_bucket.h"
-#include "rgw_rest_metadata.h"
-#include "rgw_rest_log.h"
-#include "rgw_rest_config.h"
-#include "rgw_rest_realm.h"
 #include "rgw_rest_sts.h"
-#include "rgw_rest_ratelimit.h"
 #include "rgw_swift_auth.h"
 #include "rgw_log.h"
 #include "rgw_tools.h"
@@ -501,16 +495,9 @@ int main(int argc, const char **argv)
     admin_resource->register_resource("info", new RGWRESTMgr_Info);
     admin_resource->register_resource("usage", new RGWRESTMgr_Usage);
     admin_resource->register_resource("user", new RGWRESTMgr_User);
-    /* XXX dang part of this is RADOS specific */
-    admin_resource->register_resource("bucket", new RGWRESTMgr_Bucket);
   
-    /*Registering resource for /admin/metadata */
-    admin_resource->register_resource("metadata", new RGWRESTMgr_Metadata);
-    /* XXX dang ifdef these RADOS ? */
-    admin_resource->register_resource("log", new RGWRESTMgr_Log);
-    admin_resource->register_resource("config", new RGWRESTMgr_Config);
-    admin_resource->register_resource("realm", new RGWRESTMgr_Realm);
-    admin_resource->register_resource("ratelimit", new RGWRESTMgr_Ratelimit);
+    /* Register store-specific admin APIs */
+    store->register_admin_apis(admin_resource);
     rest.register_resource(g_conf()->rgw_admin_entry, admin_resource);
   }
 
index 46280e66623978fe13ee93f536c9b58d69b586cf..1152a1242cf08ffce7cdbbfc3bb38c6f4eec1469 100644 (file)
@@ -23,6 +23,7 @@
 #include "rgw_datalog_notify.h"
 #include "include/random.h"
 
+class RGWRESTMgr;
 class RGWAccessListFilter;
 class RGWLC;
 struct rgw_user_bucket;
@@ -451,6 +452,8 @@ class Store {
     virtual const std::string& get_luarocks_path() const = 0;
     /** Set the location of where lua packages are installed */
     virtual void set_luarocks_path(const std::string& path) = 0;
+    /** Register admin APIs unique to this store */
+    virtual void register_admin_apis(RGWRESTMgr* mgr) = 0;
 };
 
 /**
index 85c320432bb6b76236be8c2ccdab1e1a0b3e4fcb..d70da2b497c63ee52105dea8426c68e355f65720 100644 (file)
@@ -899,6 +899,7 @@ public:
       virtual void set_luarocks_path(const std::string& path) override {
         luarocks_path = path;
       }
+      virtual void register_admin_apis(RGWRESTMgr* mgr) override { };
 
       /* Unique to DBStore */
       void setDBStoreManager(DBStoreManager *stm) { dbsm = stm; }
index a422d2b4c23610d3c7ae4cb9adadffaeb8f3d4bd..501b380daaa7c904241d341aa9079601421d991c 100644 (file)
@@ -307,6 +307,9 @@ public:
 
   virtual const std::string& get_luarocks_path() const override;
   virtual void set_luarocks_path(const std::string& path) override;
+  virtual void  register_admin_apis(RGWRESTMgr* mgr)override {
+      return next->register_admin_apis(mgr);
+  }
 };
 
 class FilterUser : public User {
index b773d0eab102ff71ed229cf9824b51ceb72daad9..00e260d293d572e2fdb2dfdd8a2fd7e3bcab559b 100644 (file)
@@ -1029,6 +1029,7 @@ class MotrStore : public StoreStore {
     virtual void set_luarocks_path(const std::string& path) override {
       luarocks_path = path;
     }
+    virtual void register_admin_apis(RGWRESTMgr* mgr) override { };
 
     int open_idx(struct m0_uint128 *id, bool create, struct m0_idx *out);
     void close_idx(struct m0_idx *idx) { m0_idx_fini(idx); }
index 79b3915e5660283a7acba5ebfb92a3f03f3cee04..8f72e222c7c6e41f8e1a01710774221b7d57e3e5 100644 (file)
 #include "rgw_service.h"
 #include "rgw_lc.h"
 #include "rgw_lc_tier.h"
+#include "rgw_rest_admin.h"
+#include "rgw_rest_bucket.h"
+#include "rgw_rest_metadata.h"
+#include "rgw_rest_log.h"
+#include "rgw_rest_config.h"
+#include "rgw_rest_ratelimit.h"
+#include "rgw_rest_realm.h"
 #include "services/svc_sys_obj.h"
 #include "services/svc_meta.h"
 #include "services/svc_meta_be_sobj.h"
@@ -1420,6 +1427,18 @@ void RadosStore::finalize(void)
     rados->finalize();
 }
 
+void RadosStore::register_admin_apis(RGWRESTMgr* mgr)
+{
+  mgr->register_resource("bucket", new RGWRESTMgr_Bucket);
+  /*Registering resource for /admin/metadata */
+  mgr->register_resource("metadata", new RGWRESTMgr_Metadata);
+  mgr->register_resource("log", new RGWRESTMgr_Log);
+  /* XXX These may become global when cbodley is done with his zone work */
+  mgr->register_resource("config", new RGWRESTMgr_Config);
+  mgr->register_resource("realm", new RGWRESTMgr_Realm);
+  mgr->register_resource("ratelimit", new RGWRESTMgr_Ratelimit);
+}
+
 std::unique_ptr<LuaManager> RadosStore::get_lua_manager()
 {
   return std::make_unique<RadosLuaManager>(this);
index 732a7ea977542ebbb82583d66c309146c6914ee1..0771b9ad974b9d6fe7e516ced3bb7cf0676917d3 100644 (file)
@@ -248,6 +248,7 @@ class RadosStore : public StoreStore {
     virtual void set_luarocks_path(const std::string& path) override {
       luarocks_path = path;
     }
+    virtual void register_admin_apis(RGWRESTMgr* mgr) override;
 
     /* Unique to RadosStore */
     int get_obj_head_ioctx(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, const rgw_obj& obj,