]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove epoch and duplicates from list_periods
authorOrit Wasserman <owasserm@redhat.com>
Wed, 18 Nov 2015 11:56:37 +0000 (12:56 +0100)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:36 +0000 (16:13 -0800)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/rgw/rgw_rados.cc

index 7208c6afc3e59f27c230a58a4ef98961ebe6b64f..498140f199f23ec3ca48e431905069f316d8560f 100644 (file)
@@ -3472,8 +3472,21 @@ int RGWRados::list_realms(list<string>& realms)
 int RGWRados::list_periods(list<string>& periods)
 {
   RGWPeriod period;
-
-  return list_raw_prefixed_objs(period.get_pool_name(cct), period.get_info_oid_prefix(), periods);
+  list<string> raw_periods;
+  int ret = list_raw_prefixed_objs(period.get_pool_name(cct), period.get_info_oid_prefix(), raw_periods);
+  if (ret < 0) {
+    return ret;
+  }
+  for(list<string>::iterator iter = raw_periods.begin(); iter != raw_periods.end(); iter++) {
+    size_t pos = iter->find(".");
+    if ( pos != std::string::npos) {
+      periods.push_back(iter->substr(0, pos));
+    } else {
+      periods.push_back(*iter);
+    }
+  }
+  periods.unique();
+  return 0;
 }