]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW/standalone: fixed teuthology issues
authorAli Masarwa <amasarwa@redhat.com>
Sun, 20 Apr 2025 07:21:24 +0000 (10:21 +0300)
committerAli Masarwa <amasarwa@redhat.com>
Tue, 29 Apr 2025 12:31:09 +0000 (15:31 +0300)
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
src/rgw/driver/rados/rgw_service.cc
src/rgw/driver/rados/rgw_service.h
src/rgw/services/svc_zone.cc
src/rgw/services/svc_zone.h

index bc3e92c7e6bc56e881f831e5f8eba6f8be5ced31..b1c9a40bf0e13bb29a23808c2a301f555e879fef 100644 (file)
@@ -54,7 +54,8 @@ int RGWServices_Def::init(CephContext *cct,
                          bool background_tasks,
                          optional_yield y,
                           const DoutPrefixProvider *dpp,
-                          rgw::sal::ConfigStore* cfgstore)
+                          rgw::sal::ConfigStore* cfgstore,
+                          const rgw::SiteConfig* site)
 {
   finisher = std::make_unique<RGWSI_Finisher>(cct);
   bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(cct);
@@ -66,7 +67,7 @@ int RGWServices_Def::init(CephContext *cct,
   datalog_rados = std::make_unique<RGWDataChangesLog>(cct);
   mdlog = std::make_unique<RGWSI_MDLog>(cct, run_sync, cfgstore);
   notify = std::make_unique<RGWSI_Notify>(cct);
-  zone = std::make_unique<RGWSI_Zone>(cct, cfgstore);
+  zone = std::make_unique<RGWSI_Zone>(cct, cfgstore, site);
   zone_utils = std::make_unique<RGWSI_ZoneUtils>(cct);
   quota = std::make_unique<RGWSI_Quota>(cct);
   sync_modules = std::make_unique<RGWSI_SyncModules>(cct);
@@ -268,7 +269,7 @@ int RGWServices::do_init(CephContext *_cct, rgw::sal::RadosStore* driver, bool h
   cct = _cct;
   site = &_site;
 
-  int r = _svc.init(cct, driver, have_cache, raw, run_sync, background_tasks, y, dpp, cfgstore);
+  int r = _svc.init(cct, driver, have_cache, raw, run_sync, background_tasks, y, dpp, cfgstore, site);
   if (r < 0) {
     return r;
   }
index f0c9f6cfe4b93f64dcc817603d0da04588f53a08..e4d3df4f911051bb012878b1a8b157c42060ae5e 100644 (file)
 
 #include "rgw_common.h"
 
-namespace rgw::sal {
-class RadosStore;
+namespace rgw {
+  class SiteConfig;
+  namespace sal {
+    class RadosStore;
+  }
 }
 
 struct RGWServices_Def;
@@ -106,7 +109,7 @@ struct RGWServices_Def
 
   int init(CephContext *cct, rgw::sal::RadosStore* store, bool have_cache,
           bool raw_storage, bool run_sync, bool background_tasks,
-          optional_yield y, const DoutPrefixProvider *dpp, rgw::sal::ConfigStore* cfgstore);
+          optional_yield y, const DoutPrefixProvider *dpp, rgw::sal::ConfigStore* cfgstore, const rgw::SiteConfig* site);
   void shutdown();
 };
 
index 3303a38aef30eabd5921ead5138d6a5610193bf7..056309f0bc2f1a336dc1c416de4913ca6022dde6 100644 (file)
@@ -20,7 +20,8 @@
 using namespace std;
 using namespace rgw_zone_defaults;
 
-RGWSI_Zone::RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* _cfgstore) : RGWServiceInstance(cct), cfgstore(_cfgstore)
+RGWSI_Zone::RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* _cfgstore, const rgw::SiteConfig* _site)
+        : RGWServiceInstance(cct), cfgstore(_cfgstore), site(_site)
 {
 }
 
@@ -137,26 +138,18 @@ int RGWSI_Zone::do_start(optional_yield y, const DoutPrefixProvider *dpp)
 
   assert(sysobj_svc->is_started()); /* if not then there's ordering issue */
 
-  ret = rgw::read_realm(dpp, y, cfgstore, realm->get_id(), realm->get_name(), *realm);
-  if (ret < 0 && ret != -ENOENT) {
-    ldpp_dout(dpp, 0) << "failed reading realm info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
-    return ret;
+  if (site->get_realm().has_value()) {
+    *realm = site->get_realm().value();
   }
 
   ldpp_dout(dpp, 20) << "realm  " << realm->get_name() << " " << realm->get_id() << dendl;
-  current_period->set_realm_id(realm->get_id());
-  ret = cfgstore->read_period(dpp, y, current_period->get_id(), current_period->epoch, *current_period);
-  if (ret < 0 && ret != -ENOENT) {
-    ldpp_dout(dpp, 0) << "failed reading current period info: " << " " << cpp_strerror(-ret) << dendl;
-    return ret;
+  if (site->get_period().has_value()) {
+    *current_period = site->get_period().value();
   }
+  current_period->set_realm_id(realm->get_id());
 
-  ret = cfgstore->read_default_zone(dpp, y, realm->get_id(), *zone_params, nullptr);
-  bool found_zone = (ret == 0);
-  if (ret < 0 && ret != -ENOENT) {
-    lderr(cct) << "failed reading zone info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
-    return ret;
-  }
+  *zone_params = site->get_zone_params();
+  bool found_zone = true;
 
   cur_zone_id = rgw_zone_id(zone_params->get_id());
 
index 20e357919c498e7af608c4a512417e4da09b5ae1..0b793d670c54e18b48c1ab79572d35a8412cac60 100644 (file)
@@ -56,6 +56,7 @@ class RGWSI_Zone : public RGWServiceInstance
 
   std::unique_ptr<rgw_sync_policy_info> sync_policy;
   rgw::sal::ConfigStore *cfgstore{nullptr};
+  const rgw::SiteConfig* site{nullptr};
 
   void init(RGWSI_SysObj *_sysobj_svc,
            librados::Rados* rados_,
@@ -79,7 +80,7 @@ class RGWSI_Zone : public RGWServiceInstance
                              rgw::sal::ConfigStore* cfgstore,
                              optional_yield y);
 public:
-  RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* cfgstore);
+  RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* cfgstore, const rgw::SiteConfig* _site);
   ~RGWSI_Zone();
 
   const RGWZoneParams& get_zone_params() const;