]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add zonegroupmap realm update
authorOrit Wasserman <owasserm@redhat.com>
Mon, 21 Sep 2015 15:28:25 +0000 (17:28 +0200)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:01 +0000 (16:13 -0800)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 9c6f85818db3a4b1b40da13e526a8a3fc104816f..0dcb0e255f00bd99506190dab3613b44275cf53a 100644 (file)
@@ -2192,6 +2192,23 @@ int main(int argc, char **argv)
          return -ret;
        }
 
+       list<string> realms;
+       ret = store->list_realms(realms);
+       if (ret < 0) {
+         cerr << "failed to list realms: " << cpp_strerror(-ret) << std::endl;
+         return -ret;
+       }
+       for (list<string>::iterator iter = realms.begin(); iter != realms.end(); ++iter)
+       {        
+         RGWRealm realm(*iter);
+         ret = realm.init(g_ceph_context, store);
+         if (ret < 0) {
+           cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
+           return -ret;
+         }
+         zonegroupmap.update(realm);
+       }
+
        list<string> zonegroups;
        ret = store->list_zonegroups(zonegroups);
        if (ret < 0) {
index 4024f9cf5ad8287a28727b815df6efb00cbfe7e8..52c8106612fdaf583c1814d9f86de55709b3e551 100644 (file)
@@ -1120,6 +1120,13 @@ int RGWZoneGroupMap::update(RGWZoneGroup& zonegroup)
   return 0;
 }
 
+int RGWZoneGroupMap::update(RGWRealm& realm)
+{
+  Mutex::Locker l(lock);
+  realms[realm.get_id()] = realm;
+  return 0;
+}
+
 int RGWZoneGroupMap::get_master_zonegroup(const string& current_period,
                                          RGWZoneGroup& zonegroup)
 {
index b0a75a2bcd86adb77226147d85b91fd6592ad2e3..3db003e719123615c19220bbcf5c6496b5afcbd1 100644 (file)
@@ -1148,7 +1148,6 @@ struct RGWPeriodMap
 WRITE_CLASS_ENCODER(RGWPeriodMap)
 
 class RGWRealm;
-
 struct RGWZoneGroupMap {
 
   Mutex lock;
@@ -1174,7 +1173,8 @@ struct RGWZoneGroupMap {
   int store(CephContext *cct, RGWRados *store);
 
   int update(RGWZoneGroup& zonegroup);
-
+  int update(RGWRealm& realm);
+  
   int get_master_zonegroup(const string& current_period,
                           RGWZoneGroup& master_zonegroup);
 
@@ -1235,7 +1235,7 @@ class RGWRealm : public RGWSystemMetaObj
 
 public:
   RGWRealm() {}
-  RGWRealm(const string& _id, const string& _name) : RGWSystemMetaObj(_id, _name) {}  
+  RGWRealm(const string& _id, const string& _name = "") : RGWSystemMetaObj(_id, _name) {}  
   RGWRealm(CephContext *_cct, RGWRados *_store): RGWSystemMetaObj(_cct, _store) {}
   RGWRealm(const string& _name, CephContext *_cct, RGWRados *_store): RGWSystemMetaObj(_name, _cct, _store){}