]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix upgrade from old multisite to new multisite configuration 10891/head
authorOrit Wasserman <owasserm@redhat.com>
Wed, 20 Jul 2016 11:02:03 +0000 (13:02 +0200)
committerLoic Dachary <ldachary@redhat.com>
Fri, 26 Aug 2016 07:07:58 +0000 (09:07 +0200)
We need to store the updated current period after adding the old converted regions

Fixes: http://tracker.ceph.com/issues/16751
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
(cherry picked from commit 6d7841c6f050f6bd813d54df65d38e7f6934d22d)

src/rgw/rgw_rados.cc

index 3b5743a7d44d88f71d524daea695ed5a17251403..f592aaaf08eb641cfa0c269d30dfcd6188471a5e 100644 (file)
@@ -3435,6 +3435,7 @@ int RGWRados::replace_region_with_zonegroup()
          iter ++) {
       RGWZoneParams zoneparams(iter->first, iter->first);
       zoneparams.set_id(iter->first);
+      zoneparams.realm_id = realm.get_id();
       ret = zoneparams.init(cct, this);
       if (ret < 0) {
         ldout(cct, 0) << "failed to init zoneparams  " << iter->first <<  ": " << cpp_strerror(-ret) << dendl;
@@ -3462,16 +3463,37 @@ int RGWRados::replace_region_with_zonegroup()
         ldout(cct, 0) << "failed to add zonegroup to current_period: " << cpp_strerror(-ret) << dendl;
         return ret;
       }
-      ret = current_period.update();
-      if (ret < 0) {
-        ldout(cct, 0) << "failed to update current_period: " << cpp_strerror(-ret) << dendl;
-        return ret;
-      }
     }
+  }
+
+  if (!current_period.get_id().empty()) {
+    ret = current_period.update();
+    if (ret < 0) {
+      ldout(cct, 0) << "failed to update new period: " << cpp_strerror(-ret) << dendl;
+      return ret;
+    }
+    ret = current_period.store_info(false);
+    if (ret < 0) {
+      ldout(cct, 0) << "failed to store new period: " << cpp_strerror(-ret) << dendl;
+      return ret;
+    }
+    ret = current_period.reflect();
+    if (ret < 0) {
+      ldout(cct, 0) << "failed to update local objects: " << cpp_strerror(-ret) << dendl;
+      return ret;
+    }
+  }
 
+  for (auto const& iter : regions) {
+    RGWZoneGroup zonegroup(iter);
+    int ret = zonegroup.init(cct, this, true, true);
+    if (ret < 0) {
+      ldout(cct, 0) << "failed init zonegroup" << iter << ": ret "<< ret << " " << cpp_strerror(-ret) << dendl;
+      return ret;
+    }
     ret = zonegroup.delete_obj(true);
     if (ret < 0 && ret != -ENOENT) {
-      ldout(cct, 0) << "failed to delete region " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
+      ldout(cct, 0) << "failed to delete region " << iter << ": ret "<< ret << " " << cpp_strerror(-ret)
         << dendl;
       return ret;
     }