]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw admin: use the new AdminOp to fix lc shards
authorAbhishek Lekshmanan <abhishek@suse.com>
Thu, 7 Mar 2019 13:44:27 +0000 (14:44 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 12 Apr 2019 16:08:27 +0000 (18:08 +0200)
Since it can iterate over a list of buckets, also rename the command to lc
reshard fix

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 582c1e7afb5f091d1cde0f1c33ee9aa31f3539e9)

src/rgw/rgw_admin.cc
src/test/cli/radosgw-admin/help.t

index 0c711c74fe9086cc057d44414f518d4e6d049dd2..5833501bf8db615093661e85724b0f9ae5938170 100644 (file)
@@ -193,7 +193,7 @@ void usage()
   cout << "  lc list                    list all bucket lifecycle progress\n";
   cout << "  lc get                     get a lifecycle bucket configuration\n";
   cout << "  lc process                 manually process lifecycle\n";
-  cout << "  lc fix                     fix LC for a resharded bucket\n";
+  cout << "  lc reshard fix             fix LC for a resharded bucket\n";
   cout << "  metadata get               get metadata info\n";
   cout << "  metadata put               put metadata info\n";
   cout << "  metadata rm                remove metadata info\n";
@@ -436,7 +436,7 @@ enum {
   OPT_LC_LIST,
   OPT_LC_GET,
   OPT_LC_PROCESS,
-  OPT_LC_FIX,
+  OPT_LC_RESHARD_FIX,
   OPT_ORPHANS_FIND,
   OPT_ORPHANS_FINISH,
   OPT_ORPHANS_LIST_JOBS,
@@ -890,8 +890,10 @@ static int get_cmd(const char *cmd, const char *prev_cmd, const char *prev_prev_
       return OPT_LC_GET;
     if (strcmp(cmd, "process") == 0)
       return OPT_LC_PROCESS;
+  } else if ((prev_prev_cmd && strcmp(prev_prev_cmd, "lc") == 0) &&
+            strcmp(prev_cmd, "reshard") == 0) {
     if (strcmp(cmd, "fix") == 0)
-      return OPT_LC_FIX;
+      return OPT_LC_RESHARD_FIX;
   } else if (strcmp(prev_cmd, "orphans") == 0) {
     if (strcmp(cmd, "find") == 0)
       return OPT_ORPHANS_FIND;
@@ -6583,20 +6585,12 @@ next:
   }
 
 
-  if (opt_cmd == OPT_LC_FIX) {
-    rgw_bucket bucket;
-    RGWBucketInfo bucket_info;
-    map<string, bufferlist> attrs;
-    ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs);
+  if (opt_cmd == OPT_LC_RESHARD_FIX) {
+    ret = RGWBucketAdminOp::fix_lc_shards(store, bucket_op,f);
     if (ret < 0) {
-      cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
-      return -ret;
+      cerr << "ERROR: listing stale instances" << cpp_strerror(-ret) << std::endl;
     }
 
-    ret = rgw::lc::fix_lc_shard_entry(store, bucket_info, attrs);
-    if (ret < 0) {
-      cerr << "ERROR: fixing lc shard entry failed with" << cpp_strerror(-ret) << std::endl;
-    }
   }
 
   if (opt_cmd == OPT_ORPHANS_FIND) {
index 8fdacf9ebe2d155cc9c141a40ca3b2610782cb87..e70c8588e46a613b53ab2761ecec70f7a3c1e016 100644 (file)
     lc list                    list all bucket lifecycle progress
     lc get                     get a lifecycle bucket configuration
     lc process                 manually process lifecycle
-    lc fix                     fix LC for a resharded bucket
+    lc reshard fix             fix LC for a resharded bucket
     metadata get               get metadata info
     metadata put               put metadata info
     metadata rm                remove metadata info