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);
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);
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;
}
#include "rgw_common.h"
-namespace rgw::sal {
-class RadosStore;
+namespace rgw {
+ class SiteConfig;
+ namespace sal {
+ class RadosStore;
+ }
}
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();
};
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)
{
}
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());
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_,
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;