Skip to content

Commit 263264a

Browse files
committed
RGW/standalone: fixed teuthology issues
Signed-off-by: Ali Masarwa <[email protected]>
1 parent 9342ae6 commit 263264a

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

src/rgw/driver/rados/rgw_service.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ int RGWServices_Def::init(CephContext *cct,
5454
bool background_tasks,
5555
optional_yield y,
5656
const DoutPrefixProvider *dpp,
57-
rgw::sal::ConfigStore* cfgstore)
57+
rgw::sal::ConfigStore* cfgstore,
58+
const rgw::SiteConfig* site)
5859
{
5960
finisher = std::make_unique<RGWSI_Finisher>(cct);
6061
bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(cct);
@@ -66,7 +67,7 @@ int RGWServices_Def::init(CephContext *cct,
6667
datalog_rados = std::make_unique<RGWDataChangesLog>(cct);
6768
mdlog = std::make_unique<RGWSI_MDLog>(cct, run_sync, cfgstore);
6869
notify = std::make_unique<RGWSI_Notify>(cct);
69-
zone = std::make_unique<RGWSI_Zone>(cct, cfgstore);
70+
zone = std::make_unique<RGWSI_Zone>(cct, cfgstore, site);
7071
zone_utils = std::make_unique<RGWSI_ZoneUtils>(cct);
7172
quota = std::make_unique<RGWSI_Quota>(cct);
7273
sync_modules = std::make_unique<RGWSI_SyncModules>(cct);
@@ -268,7 +269,7 @@ int RGWServices::do_init(CephContext *_cct, rgw::sal::RadosStore* driver, bool h
268269
cct = _cct;
269270
site = &_site;
270271

271-
int r = _svc.init(cct, driver, have_cache, raw, run_sync, background_tasks, y, dpp, cfgstore);
272+
int r = _svc.init(cct, driver, have_cache, raw, run_sync, background_tasks, y, dpp, cfgstore, site);
272273
if (r < 0) {
273274
return r;
274275
}

src/rgw/driver/rados/rgw_service.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111

1212
#include "rgw_common.h"
1313

14-
namespace rgw::sal {
15-
class RadosStore;
14+
namespace rgw {
15+
class SiteConfig;
16+
namespace sal {
17+
class RadosStore;
18+
}
1619
}
1720

1821
struct RGWServices_Def;
@@ -106,7 +109,7 @@ struct RGWServices_Def
106109

107110
int init(CephContext *cct, rgw::sal::RadosStore* store, bool have_cache,
108111
bool raw_storage, bool run_sync, bool background_tasks,
109-
optional_yield y, const DoutPrefixProvider *dpp, rgw::sal::ConfigStore* cfgstore);
112+
optional_yield y, const DoutPrefixProvider *dpp, rgw::sal::ConfigStore* cfgstore, const rgw::SiteConfig* site);
110113
void shutdown();
111114
};
112115

src/rgw/services/svc_zone.cc

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
using namespace std;
2121
using namespace rgw_zone_defaults;
2222

23-
RGWSI_Zone::RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* _cfgstore) : RGWServiceInstance(cct), cfgstore(_cfgstore)
23+
RGWSI_Zone::RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* _cfgstore, const rgw::SiteConfig* _site)
24+
: RGWServiceInstance(cct), cfgstore(_cfgstore), site(_site)
2425
{
2526
}
2627

@@ -137,26 +138,18 @@ int RGWSI_Zone::do_start(optional_yield y, const DoutPrefixProvider *dpp)
137138

138139
assert(sysobj_svc->is_started()); /* if not then there's ordering issue */
139140

140-
ret = rgw::read_realm(dpp, y, cfgstore, realm->get_id(), realm->get_name(), *realm);
141-
if (ret < 0 && ret != -ENOENT) {
142-
ldpp_dout(dpp, 0) << "failed reading realm info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
143-
return ret;
141+
if (site->get_realm().has_value()) {
142+
*realm = site->get_realm().value();
144143
}
145144

146145
ldpp_dout(dpp, 20) << "realm " << realm->get_name() << " " << realm->get_id() << dendl;
147-
current_period->set_realm_id(realm->get_id());
148-
ret = cfgstore->read_period(dpp, y, current_period->get_id(), current_period->epoch, *current_period);
149-
if (ret < 0 && ret != -ENOENT) {
150-
ldpp_dout(dpp, 0) << "failed reading current period info: " << " " << cpp_strerror(-ret) << dendl;
151-
return ret;
146+
if (site->get_period().has_value()) {
147+
*current_period = site->get_period().value();
152148
}
149+
current_period->set_realm_id(realm->get_id());
153150

154-
ret = cfgstore->read_default_zone(dpp, y, realm->get_id(), *zone_params, nullptr);
155-
bool found_zone = (ret == 0);
156-
if (ret < 0 && ret != -ENOENT) {
157-
lderr(cct) << "failed reading zone info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
158-
return ret;
159-
}
151+
*zone_params = site->get_zone_params();
152+
bool found_zone = true;
160153

161154
cur_zone_id = rgw_zone_id(zone_params->get_id());
162155

src/rgw/services/svc_zone.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class RGWSI_Zone : public RGWServiceInstance
5656

5757
std::unique_ptr<rgw_sync_policy_info> sync_policy;
5858
rgw::sal::ConfigStore *cfgstore{nullptr};
59+
const rgw::SiteConfig* site{nullptr};
5960

6061
void init(RGWSI_SysObj *_sysobj_svc,
6162
librados::Rados* rados_,
@@ -79,7 +80,7 @@ class RGWSI_Zone : public RGWServiceInstance
7980
rgw::sal::ConfigStore* cfgstore,
8081
optional_yield y);
8182
public:
82-
RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* cfgstore);
83+
RGWSI_Zone(CephContext *cct, rgw::sal::ConfigStore* cfgstore, const rgw::SiteConfig* _site);
8384
~RGWSI_Zone();
8485

8586
const RGWZoneParams& get_zone_params() const;

0 commit comments

Comments
 (0)