From 96db3d7fd026a4cf6846537d413f36a0db280fc2 Mon Sep 17 00:00:00 2001 From: Jiaying Ren Date: Thu, 25 May 2017 19:55:32 +0800 Subject: [PATCH] rgw/multisite: unify zg is_master judge Signed-off-by: Jiaying Ren --- src/rgw/rgw_op.cc | 6 +++--- src/rgw/rgw_rados.cc | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 58c700993f703..3a2fbdfee3b88 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -490,7 +490,7 @@ int rgw_build_bucket_policies(RGWRados* store, struct req_state* s) /* we now need to make sure that the operation actually requires copy source, that is * it's a copy operation */ - if (store->get_zonegroup().is_master && s->system_request) { + if (store->get_zonegroup().is_master_zonegroup() && s->system_request) { /*If this is the master, don't redirect*/ } else if (!s->local_source || (s->op != OP_PUT && s->op != OP_COPY) || @@ -2394,7 +2394,7 @@ void RGWCreateBucket::execute() if (op_ret < 0) return; - if (!store->get_zonegroup().is_master && + if (!store->get_zonegroup().is_master_zonegroup() && store->get_zonegroup().api_name != location_constraint) { ldout(s->cct, 0) << "location constraint (" << location_constraint << ")" << " doesn't match zonegroup" << " (" << store->get_zonegroup().api_name << ")" @@ -5540,7 +5540,7 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path) goto delop_fail; } - if (!store->get_zonegroup().is_master) { + if (!store->get_zonegroup().is_master_zonegroup()) { bufferlist in_data; ret = forward_request_to_master(s, &ot.read_version, store, in_data, nullptr); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 6dedd96b7cf34..fdf35ca82fe58 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1852,7 +1852,7 @@ void RGWPeriodMap::decode(bufferlist::iterator& bl) { iter != zonegroups.end(); ++iter) { RGWZoneGroup& zonegroup = iter->second; zonegroups_by_api[zonegroup.api_name] = zonegroup; - if (zonegroup.is_master) { + if (zonegroup.is_master_zonegroup()) { master_zonegroup = zonegroup.get_id(); } } @@ -1873,7 +1873,7 @@ static uint32_t gen_short_zone_id(const std::string zone_id) int RGWPeriodMap::update(const RGWZoneGroup& zonegroup, CephContext *cct) { - if (zonegroup.is_master && (!master_zonegroup.empty() && zonegroup.get_id() != master_zonegroup)) { + if (zonegroup.is_master_zonegroup() && (!master_zonegroup.empty() && zonegroup.get_id() != master_zonegroup)) { ldout(cct,0) << "Error updating periodmap, multiple master zonegroups configured "<< dendl; ldout(cct,0) << "master zonegroup: " << master_zonegroup << " and " << zonegroup.get_id() <second; zonegroups_by_api[zonegroup.api_name] = zonegroup; - if (zonegroup.is_master) { + if (zonegroup.is_master_zonegroup()) { master_zonegroup = zonegroup.get_name(); } } @@ -3942,7 +3942,7 @@ int RGWRados::replace_region_with_zonegroup() ldout(cct, 0) << __func__ << " failed init region "<< *iter << ": " << cpp_strerror(-ret) << dendl; return ret; } - if (region.is_master) { + if (region.is_master_zonegroup()) { master_region = region.get_id(); master_zone = region.master_zone; } @@ -4234,7 +4234,7 @@ int RGWRados::init_zg_from_local(bool *creating_defaults) } } ldout(cct, 20) << "zonegroup " << zonegroup.get_name() << dendl; - if (zonegroup.is_master) { + if (zonegroup.is_master_zonegroup()) { // use endpoints from the zonegroup's master zone auto master = zonegroup.zones.find(zonegroup.master_zone); if (master == zonegroup.zones.end()) { @@ -8175,7 +8175,7 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx, bool RGWRados::is_meta_master() { - if (!get_zonegroup().is_master) { + if (!get_zonegroup().is_master_zonegroup()) { return false; } @@ -8196,7 +8196,7 @@ bool RGWRados::is_syncing_bucket_meta(const rgw_bucket& bucket) } /* zonegroup is not master zonegroup */ - if (!get_zonegroup().is_master) { + if (!get_zonegroup().is_master_zonegroup()) { return false; } -- 2.39.5