]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: update zonegroupmap when adding a zone
authorOrit Wasserman <owasserm@redhat.com>
Tue, 22 Sep 2015 19:55:38 +0000 (21:55 +0200)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:04 +0000 (16:13 -0800)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/rgw/rgw_admin.cc

index 5c9f4680f4d9f195bb336b60f16c9c8fd3b7cea4..40e8d9054f22c5ecdc5149e4e9caf58f615a4789 100644 (file)
@@ -2405,6 +2405,30 @@ int main(int argc, char **argv)
               << cpp_strerror(-ret) << std::endl;
          return ret;
        }
+
+       RGWRealm realm(realm_id, realm_name);
+       ret = realm.init(g_ceph_context, store);
+       if (ret < 0) {
+         cerr << "ERROR: couldn't init realm:" << cpp_strerror(-ret) << std::endl;
+         return ret;
+       }
+       
+       RGWZoneGroupMap zonegroup_map;
+       ret = zonegroup_map.read(g_ceph_context, store);
+       if (ret < 0 && ret != -ENOENT) {
+         cerr << "ERROR: couldn't read zonegroup_map: " << cpp_strerror(-ret) << std::endl;
+         return ret;
+       }
+       ret = zonegroup_map.update(g_ceph_context, store, realm, zonegroup);
+       if (ret < 0) {
+         cerr << "failed to update zonegroup_map: " << cpp_strerror(-ret) << std::endl;
+         return -ret;
+       }
+       ret = zonegroup_map.store(g_ceph_context, store);
+       if (ret < 0) {
+         cerr << "failed to store zonegroup_map: " << cpp_strerror(-ret) << std::endl;
+         return -ret;
+       }
       }
       break;
     case OPT_ZONE_CREATE:
@@ -2437,6 +2461,7 @@ int main(int argc, char **argv)
            return ret;
          }
        }
+
        encode_json("zone", zone, formatter);
        formatter->flush(cout);
        cout << std::endl;