]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: svc: support raw storage init
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 16 Oct 2018 14:17:04 +0000 (07:17 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 8 Nov 2018 17:19:30 +0000 (09:19 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_service.cc
src/rgw/rgw_service.h

index 3f743eac40e0b78f41ed695fa31719870f89297c..d7d59850201eebec4b51eee78b9c2ed15819efad 100644 (file)
@@ -1647,6 +1647,15 @@ int RGWRados::init_complete()
   return ret;
 }
 
+int RGWRados::init_svc(bool raw)
+{
+  if (raw) {
+    return svc.init_raw(cct, use_cache);
+  }
+
+  return svc.init(cct, use_cache);
+}
+
 /** 
  * Initialize the RADOS instance and prepare to do other ops
  * Returns 0 on success, -ERR# on failure.
@@ -1659,7 +1668,7 @@ int RGWRados::initialize()
     cct->_conf.get_val<double>("rgw_inject_notify_timeout_probability");
   max_notify_retries = cct->_conf.get_val<uint64_t>("rgw_max_notify_retries");
 
-  ret = svc.init(cct, use_cache);
+  ret = init_svc(false);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl;
     return ret;
@@ -9892,9 +9901,15 @@ RGWRados *RGWStoreManager::init_raw_storage_provider(CephContext *cct)
 
   store->set_context(cct);
 
+  int ret = store->init_svc(true);
+  if (ret < 0) {
+    ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl;
+    return nullptr;
+  }
+
   if (store->init_rados() < 0) {
     delete store;
-    return NULL;
+    return nullptr;
   }
 
   return store;
index 14013412bb8d57878074ae271fda8653c31a21f2..a58f50bed251655028ff65f032f6fb3f5eab6886 100644 (file)
@@ -1412,6 +1412,7 @@ public:
     return initialize();
   }
   /** Initialize the RADOS instance and prepare to do other ops */
+  int init_svc(bool raw);
   int init_rados();
   int init_complete();
   int initialize();
index 9324d6418150d26cd3ca5b1dff00528d07f2a25c..ea5d6520e4593b56cf877d5b2d91d43439f26dfb 100644 (file)
@@ -23,7 +23,8 @@ RGWServices_Def::~RGWServices_Def()
 }
 
 int RGWServices_Def::init(CephContext *cct,
-                         bool have_cache)
+                         bool have_cache,
+                          bool raw)
 {
   finisher = std::make_unique<RGWSI_Finisher>(cct);
   notify = std::make_unique<RGWSI_Notify>(cct);
@@ -60,10 +61,12 @@ int RGWServices_Def::init(CephContext *cct,
     return r;
   }
 
-  r = notify->start();
-  if (r < 0) {
-    ldout(cct, 0) << "ERROR: failed to start notify service (" << cpp_strerror(-r) << dendl;
-    return r;
+  if (!raw) {
+    r = notify->start();
+    if (r < 0) {
+      ldout(cct, 0) << "ERROR: failed to start notify service (" << cpp_strerror(-r) << dendl;
+      return r;
+    }
   }
 
   r = rados->start();
@@ -72,10 +75,12 @@ int RGWServices_Def::init(CephContext *cct,
     return r;
   }
 
-  r = zone->start();
-  if (r < 0) {
-    ldout(cct, 0) << "ERROR: failed to start zone service (" << cpp_strerror(-r) << dendl;
-    return r;
+  if (!raw) {
+    r = zone->start();
+    if (r < 0) {
+      ldout(cct, 0) << "ERROR: failed to start zone service (" << cpp_strerror(-r) << dendl;
+      return r;
+    }
   }
 
   r = zone_utils->start();
@@ -137,9 +142,9 @@ void RGWServices_Def::shutdown()
 }
 
 
-int RGWServices::init(CephContext *cct, bool have_cache)
+int RGWServices::do_init(CephContext *cct, bool have_cache, bool raw)
 {
-  int r = _svc.init(cct, have_cache);
+  int r = _svc.init(cct, have_cache, raw);
   if (r < 0) {
     return r;
   }
index abcb050d26e698397a1d92a6f8c5c9ad486ba398..16ded3255ac65dd694277eb1e2164768f051b29b 100644 (file)
@@ -70,7 +70,7 @@ struct RGWServices_Def
   RGWServices_Def();
   ~RGWServices_Def();
 
-  int init(CephContext *cct, bool have_cache);
+  int init(CephContext *cct, bool have_cache, bool raw_storage);
   void shutdown();
 };
 
@@ -90,7 +90,15 @@ struct RGWServices
   RGWSI_SysObj_Cache *cache{nullptr};
   RGWSI_SysObj_Core *core{nullptr};
 
-  int init(CephContext *cct, bool have_cache);
+  int do_init(CephContext *cct, bool have_cache, bool raw_storage);
+
+  int init(CephContext *cct, bool have_cache) {
+    return do_init(cct, have_cache, false);
+  }
+
+  int init_raw(CephContext *cct, bool have_cache) {
+    return do_init(cct, have_cache, true);
+  }
   void shutdown() {
     _svc.shutdown();
   }