From 933fdefb56ce1ab883e6d3ee09c34fb2aa14808e Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 16 May 2016 11:03:45 -0400 Subject: [PATCH] rgw: add_zone only clears master_zone if --master=false Fixes: http://tracker.ceph.com/issues/15901 Signed-off-by: Casey Bodley (cherry picked from commit 40c4d150757cba4b05938c6c760ab9f0296c2ff6) --- src/rgw/rgw_rados.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index e6cb001701515..87c83d6cd4f05 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -238,13 +238,15 @@ int RGWZoneGroup::equals(const string& other_zonegroup) const int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only, const list& endpoints) { - if (is_master && *is_master) { - if (!master_zone.empty() && master_zone != zone_params.get_id()) { - ldout(cct, 0) << "NOTICE: overriding master zone: " << master_zone << dendl; + if (is_master) { + if (*is_master) { + if (!master_zone.empty() && master_zone != zone_params.get_id()) { + ldout(cct, 0) << "NOTICE: overriding master zone: " << master_zone << dendl; + } + master_zone = zone_params.get_id(); + } else if (master_zone == zone_params.get_id()) { + master_zone.clear(); } - master_zone = zone_params.get_id(); - } else if (master_zone == zone_params.get_id()) { - master_zone =""; } RGWZone& zone = zones[zone_params.get_id()];