From: Orit Wasserman Date: Fri, 8 Jan 2016 09:13:09 +0000 (+0100) Subject: rgw: fix RGWZoneGroup ctor and check period update return code X-Git-Tag: v10.1.0~354^2~87 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5e708a96e56c006b3284f67acba0ae6371eddf6b;p=ceph.git rgw: fix RGWZoneGroup ctor and check period update return code Add more debug messages Signed-off-by: Orit Wasserman --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 3c4d20ad3c50..4e2d4dcc54ac 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1457,7 +1457,11 @@ static int update_period(const string& realm_id, const string& realm_name, return ret; } period.fork(); - period.update(); + ret = period.update(); + if(ret , 0) { + cerr << "failed to update period: " << cpp_strerror(-ret) << std::endl; + return ret; + } ret = period.store_info(false); if (ret < 0) { cerr << "failed to store period: " << cpp_strerror(-ret) << std::endl; @@ -2470,7 +2474,7 @@ int main(int argc, char **argv) return -ret; } - RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name, is_master, g_ceph_context, store, realm.get_id(), endpoints); + RGWZoneGroup zonegroup(zonegroup_name, is_master, g_ceph_context, store, realm.get_id(), endpoints); zonegroup.api_name = (api_name.empty() ? zonegroup_name : api_name); ret = zonegroup.create(); if (ret < 0) { diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index fc6340923fb3..72abdd937be3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1162,6 +1162,7 @@ int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup) int RGWPeriod::update() { + ldout(cct, 20) << __func__ << " realm " << realm_id << " period " << get_id() << dendl; list zonegroups; int ret = store->list_zonegroups(zonegroups); if (ret < 0) { @@ -1178,7 +1179,7 @@ int RGWPeriod::update() } if (zg.realm_id != realm_id) { - ldout(cct, 20) << "skipping zonegroup " << zg.get_name() << ", not on our realm" << dendl; + ldout(cct, 20) << "skipping zonegroup " << zg.get_name() << " zone realm id " << zg.realm_id << ", not on our realm " << realm_id << dendl; continue; } @@ -1213,6 +1214,7 @@ int RGWPeriod::reflect() void RGWPeriod::fork() { + ldout(cct, 20) << __func__ << " realm " << realm_id << " period " << id << dendl; predecessor_uuid = id; id = get_staging_id(realm_id); period_map.reset(); @@ -1220,6 +1222,7 @@ void RGWPeriod::fork() void RGWPeriod::update(const RGWZoneGroupMap& map) { + ldout(cct, 20) << __func__ << " realm " << realm_id << " period " << id << dendl; for (std::map::const_iterator iter = map.zonegroups.begin(); iter != map.zonegroups.end(); iter++) { period_map.zonegroups_by_api[iter->second.api_name] = iter->second; @@ -1266,6 +1269,7 @@ int RGWPeriod::update_sync_status() int RGWPeriod::commit(RGWRealm& realm, const RGWPeriod& current_period) { + ldout(cct, 20) << __func__ << " realm " << realm.get_id() << " period " << current_period.get_id() << dendl; // gateway must be in the master zone to commit if (master_zone != store->get_zone_params().get_id()) { lderr(cct) << "period commit sent to zone " << store->get_zone_params().get_id() diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index d2f790d278f4..8f199b737b39 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1084,12 +1084,10 @@ struct RGWZoneGroup : public RGWSystemMetaObj { RGWZoneGroup(): is_master(false){} RGWZoneGroup(const std::string &id, const std::string &name):RGWSystemMetaObj(id, name) {} RGWZoneGroup(const std::string &_name):RGWSystemMetaObj(_name) {} - RGWZoneGroup(const std::string& _id, const std::string &_name, bool _is_master, CephContext *cct, RGWRados* store, + RGWZoneGroup(const std::string &_name, bool _is_master, CephContext *cct, RGWRados* store, const string& _realm_id, const list& _endpoints) : RGWSystemMetaObj(_name, cct , store), endpoints(_endpoints), is_master(_is_master), - realm_id(_realm_id) { - set_id(_id); - } + realm_id(_realm_id) {} bool is_master_zonegroup() const { return is_master;} void update_master(bool _is_master) {