From e32104ef1a23fbf00e21137fe7c10d84ca7b0d89 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 20 Nov 2018 03:29:28 -0800 Subject: [PATCH] rgw: sync module can specify whether write ops supported Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_data_sync.h | 1 + src/rgw/rgw_sync_module.h | 3 +++ src/rgw/services/svc_zone.cc | 9 +++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index a31307acc9c..4b253f7e985 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -589,6 +589,7 @@ int rgw_bucket_sync_status(const DoutPrefixProvider *dpp, RGWRados *store, const class RGWDefaultSyncModule : public RGWSyncModule { public: RGWDefaultSyncModule() {} + bool supports_writes() override { return true; } bool supports_data_export() override { return true; } int create_instance(CephContext *cct, const JSONFormattable& config, RGWSyncModuleInstanceRef *instance) override; }; diff --git a/src/rgw/rgw_sync_module.h b/src/rgw/rgw_sync_module.h index f626489ec54..e3f59e1543e 100644 --- a/src/rgw/rgw_sync_module.h +++ b/src/rgw/rgw_sync_module.h @@ -57,6 +57,9 @@ public: RGWSyncModule() {} virtual ~RGWSyncModule() {} + virtual bool supports_writes() { + return false; + } virtual bool supports_data_export() = 0; virtual int create_instance(CephContext *cct, const JSONFormattable& config, RGWSyncModuleInstanceRef *instance) = 0; }; diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index 13dbdd2a0e1..013a3c2d1cd 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -151,8 +151,13 @@ int RGWSI_Zone::do_start() zone_short_id = current_period->get_map().get_zone_short_id(zone_params->get_id()); -#warning FIXME - writeable_zone = (zone_public_config->tier_type.empty() || zone_public_config->tier_type == "rgw"); + RGWSyncModuleRef sm; + if (!sync_modules_svc->get_manager()->get_module(zone_public_config->tier_type, &sm)) { + lderr(cct) << "ERROR: tier type not found: " << zone_public_config->tier_type << dendl; + return -EINVAL; + } + + writeable_zone = sm->supports_writes(); /* first build all zones index */ for (auto ziter : zonegroup->zones) { -- 2.47.3