]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add_zone only clears master_zone if --master=false 9327/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 16 May 2016 15:03:45 +0000 (11:03 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 31 May 2016 13:19:19 +0000 (09:19 -0400)
Fixes: http://tracker.ceph.com/issues/15901
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 40c4d150757cba4b05938c6c760ab9f0296c2ff6)

src/rgw/rgw_rados.cc

index e6cb00170151588adfafc2195834cca66da6c333..87c83d6cd4f05a885f4d33609b0df7d1d301bd1e 100644 (file)
@@ -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<string>& 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()];