]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_admin: improve period update errors 8564/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 12 Apr 2016 19:31:19 +0000 (21:31 +0200)
committerAbhishek Lekshmanan <alekshmanan@suse.com>
Mon, 18 Apr 2016 20:46:53 +0000 (22:46 +0200)
If we do a period update on a realm with multiple masters, we fail
stating invalid argument, improving this to suggest that we have
actually errored out because of multiple master zg in a realm, and
printing both of these zonegroups. RGWPeriodMap::update takes
CephContext as an argument, so that we can use ldout. Also dropping the
error messages reporting invalid arguments on period.update() as these
are handled within the function itself whenever it manifests itself.

Fixes: http://tracker.ceph.com/issues/15251
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 13802bc132ab03b40564fa4663fb0700816b2321..3e4bcba2790b6dbbbaf9402271ffb9c4e780e805 100644 (file)
@@ -1482,7 +1482,8 @@ static int update_period(const string& realm_id, const string& realm_name,
   period.fork();
   ret = period.update();
   if(ret < 0) {
-    cerr << "failed to update period: " << cpp_strerror(-ret) << std::endl;
+    // Dropping the error message here, as both the ret codes were handled in
+    // period.update()
     return ret;
   }
   ret = period.store_info(false);
@@ -2537,7 +2538,6 @@ int main(int argc, char **argv)
                                 commit, remote, url, access_key, secret_key,
                                 formatter);
        if (ret < 0) {
-          cerr << "period update failed: " << cpp_strerror(-ret) << std::endl;
          return ret;
        }
       }
@@ -3799,8 +3799,7 @@ int main(int argc, char **argv)
                               commit, remote, url, access_key, secret_key,
                               formatter);
       if (ret < 0) {
-        cerr << "period update failed: " << cpp_strerror(-ret) << std::endl;
-        return ret;
+       return ret;
       }
     }
     return 0;
index 61c2b625d52b3d8ec37863d591ae0b52bd10f457..dc62b6785e6238de10427320a8c45c916aa4ade7 100644 (file)
@@ -1147,7 +1147,7 @@ int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup)
   if (zonegroup.realm_id != realm_id) {
     return 0;
   }
-  int ret = period_map.update(zonegroup);
+  int ret = period_map.update(zonegroup, cct);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: updating period map: " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -1184,9 +1184,8 @@ int RGWPeriod::update()
       master_zone = zg.master_zone;
     }
 
-    int ret = period_map.update(zg);
+    int ret = period_map.update(zg, cct);
     if (ret < 0) {
-      ldout(cct, 0) << "ERROR: updating period map: " << cpp_strerror(-ret) << dendl;
       return ret;
     }
   }
@@ -1623,9 +1622,11 @@ void RGWPeriodMap::decode(bufferlist::iterator& bl) {
   }
 }
 
-int RGWPeriodMap::update(const RGWZoneGroup& zonegroup)
+int RGWPeriodMap::update(const RGWZoneGroup& zonegroup, CephContext *cct)
 {
   if (zonegroup.is_master && (!master_zonegroup.empty() && zonegroup.get_id() != master_zonegroup)) {
+    ldout(cct,0) << "Error updating periodmap, multiple master zonegroups configured "<< dendl;
+    ldout(cct,0) << "master zonegroup: " << master_zonegroup << " and  " << zonegroup.get_id() <<dendl;
     return -EINVAL;
   }
   map<string, RGWZoneGroup>::iterator iter = zonegroups.find(zonegroup.get_id());
index 1195aa331444c8001f15380aebc3985b6abca7f8..c8951c03125db7d34c77bfb8e976a5af976edc2a 100644 (file)
@@ -1181,7 +1181,7 @@ struct RGWPeriodMap
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
 
-  int update(const RGWZoneGroup& zonegroup);
+  int update(const RGWZoneGroup& zonegroup, CephContext *cct);
 
   void dump(Formatter *f) const;
   void decode_json(JSONObj *obj);