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) {
zonegroupmap.clear_zonegroups();
}
+ 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);
+ zonegroupmap.update(g_ceph_context, store, realm.get_current_period());
+ }
+
list<string> zonegroups;
ret = store->list_zonegroups(zonegroups);
if (ret < 0) {
return 0;
}
+int RGWZoneGroupMap::update(CephContext *cct, RGWRados *store,
+ const string& period_id)
+{
+ Mutex::Locker l(lock);
+ RGWPeriod period(period_id);
+
+ int ret = period.init(cct, store);
+ if (ret < 0) {
+ cerr << "failed to init period: " << cpp_strerror(-ret) << std::endl;
+ return ret;
+ }
+
+ periods[period.get_id()] = period.get_map();
+
+ return 0;
+}
+
int RGWZoneGroupMap::get_master_zonegroup(const string& current_period,
RGWZoneGroup& zonegroup)
{
int update(RGWZoneGroup& zonegroup);
int update(RGWRealm& realm);
+ int update(CephContext *cct, RGWRados *store,
+ const string& period_id);
int get_master_zonegroup(const string& current_period,
RGWZoneGroup& master_zonegroup);
epoch_t epoch;
string predecessor_uuid;
map<int, version_t> versions;
-
+ RGWPeriodMap period_map;
string master_zone;
string realm_id;
const string& get_predecessor() { return predecessor_uuid;}
const string& get_master_zone() { return master_zone;}
const string& get_realm() { return realm_id;}
+ const RGWPeriodMap& get_map() { return period_map;}
const string& get_pool_name(CephContext *cct);
const string& get_latest_epoch_oid();
const string& get_info_oid_prefix();