]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: provide admin friendly reshard status output 29286/head
authorMark Kogan <mkogan@redhat.com>
Sun, 12 May 2019 13:45:30 +0000 (09:45 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 24 Jul 2019 16:50:22 +0000 (18:50 +0200)
Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit ba4167c2f30fbb868482d48aaada6388f58de920)

doc/radosgw/dynamicresharding.rst
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h
src/rgw/rgw_reshard.cc

index 4d1061932ff398e118f30e11e3a9ca50c5cd7b71..7140a7e024ca31f7e79d8f1c4ffd3b9a3b2703e7 100644 (file)
@@ -94,7 +94,7 @@ For example, the output at different Dynamic Resharding stages is shown below:
 
   [
     {
-        "reshard_status": "CLS_RGW_RESHARD_NONE",
+        "reshard_status": "not-resharding",
         "new_bucket_instance_id": "",
         "num_shards": -1
     }
@@ -105,12 +105,12 @@ For example, the output at different Dynamic Resharding stages is shown below:
 
   [
     {
-        "reshard_status": "CLS_RGW_RESHARD_IN_PROGRESS",
+        "reshard_status": "in-progress",
         "new_bucket_instance_id": "1179f470-2ebf-4630-8ec3-c9922da887fd.8652.1",
         "num_shards": 2
     },
     {
-        "reshard_status": "CLS_RGW_RESHARD_IN_PROGRESS",
+        "reshard_status": "in-progress",
         "new_bucket_instance_id": "1179f470-2ebf-4630-8ec3-c9922da887fd.8652.1",
         "num_shards": 2
     }
@@ -121,12 +121,12 @@ For example, the output at different Dynamic Resharding stages is shown below:
 
   [
     {
-        "reshard_status": "CLS_RGW_RESHARD_NONE",
+        "reshard_status": "not-resharding",
         "new_bucket_instance_id": "",
         "num_shards": -1
     },
     {
-        "reshard_status": "CLS_RGW_RESHARD_NONE",
+        "reshard_status": "not-resharding",
         "new_bucket_instance_id": "",
         "num_shards": -1
     }
index 0fc588bbd8eaaa88607cc1cdbbc9a107dad8f52c..892ef5617e0e662cb78424953e8b7813509c0bc3 100644 (file)
@@ -674,21 +674,7 @@ void cls_rgw_reshard_entry::generate_test_instances(list<cls_rgw_reshard_entry*>
 
 void cls_rgw_bucket_instance_entry::dump(Formatter *f) const
 {
-  string status_str;
-  switch(reshard_status) {
-    case CLS_RGW_RESHARD_NONE:
-      status_str= "none";
-      break;
-    case CLS_RGW_RESHARD_IN_PROGRESS:
-      status_str = "in-progress";
-      break;
-    case CLS_RGW_RESHARD_DONE:
-      status_str = "done";
-      break;
-    default:
-      status_str = "invalid";
-  }
-  encode_json("reshard_status", status_str, f);
+  encode_json("reshard_status", to_string(reshard_status), f);
   encode_json("new_bucket_instance_id", new_bucket_instance_id, f);
   encode_json("num_shards", num_shards, f);
 
index ee15fbc0e6a542aa6b2ac6f62379f4949634f6fa..d069e8f516d2a9693d949acf480d94e00d18d52e 100644 (file)
@@ -638,22 +638,22 @@ struct rgw_bucket_category_stats {
 WRITE_CLASS_ENCODER(rgw_bucket_category_stats)
 
 enum cls_rgw_reshard_status {
-  CLS_RGW_RESHARD_NONE        = 0,
-  CLS_RGW_RESHARD_IN_PROGRESS = 1,
-  CLS_RGW_RESHARD_DONE        = 2,
+  CLS_RGW_RESHARD_NOT_RESHARDING  = 0,
+  CLS_RGW_RESHARD_IN_PROGRESS     = 1,
+  CLS_RGW_RESHARD_DONE            = 2,
 };
 
 static inline std::string to_string(const enum cls_rgw_reshard_status status)
 {
   switch (status) {
-  case CLS_RGW_RESHARD_NONE:
-    return "CLS_RGW_RESHARD_NONE";
+  case CLS_RGW_RESHARD_NOT_RESHARDING:
+    return "not-resharding";
     break;
   case CLS_RGW_RESHARD_IN_PROGRESS:
-    return "CLS_RGW_RESHARD_IN_PROGRESS";
+    return "in-progress";
     break;
   case CLS_RGW_RESHARD_DONE:
-    return "CLS_RGW_RESHARD_DONE";
+    return "done";
     break;
   default:
     break;
@@ -662,7 +662,7 @@ static inline std::string to_string(const enum cls_rgw_reshard_status status)
 }
 
 struct cls_rgw_bucket_instance_entry {
-  cls_rgw_reshard_status reshard_status{CLS_RGW_RESHARD_NONE};
+  cls_rgw_reshard_status reshard_status{CLS_RGW_RESHARD_NOT_RESHARDING};
   string new_bucket_instance_id;
   int32_t num_shards{-1};
 
@@ -688,7 +688,7 @@ struct cls_rgw_bucket_instance_entry {
   static void generate_test_instances(list<cls_rgw_bucket_instance_entry*>& o);
 
   void clear() {
-    reshard_status = CLS_RGW_RESHARD_NONE;
+    reshard_status = CLS_RGW_RESHARD_NOT_RESHARDING;
     new_bucket_instance_id.clear();
   }
 
@@ -699,7 +699,7 @@ struct cls_rgw_bucket_instance_entry {
   }
 
   bool resharding() const {
-    return reshard_status != CLS_RGW_RESHARD_NONE;
+    return reshard_status != CLS_RGW_RESHARD_NOT_RESHARDING;
   }
   bool resharding_in_progress() const {
     return reshard_status == CLS_RGW_RESHARD_IN_PROGRESS;
index 34df7d35aec9d2abe9184eb6bc13aa4480c1bbef..12ba93bd9d86e285de07aed5fb6b91239e0bf2b6 100644 (file)
@@ -278,7 +278,7 @@ int RGWBucketReshard::clear_index_shard_reshard_status(RGWRados* store,
     int ret = set_resharding_status(store, bucket_info,
                                    bucket_info.bucket.bucket_id,
                                    (num_shards < 1 ? 1 : num_shards),
-                                   CLS_RGW_RESHARD_NONE);
+                                   CLS_RGW_RESHARD_NOT_RESHARDING);
     if (ret < 0) {
       ldout(store->ctx(), 0) << "RGWBucketReshard::" << __func__ <<
        " ERROR: error clearing reshard status from index shard " <<
@@ -382,7 +382,7 @@ public:
          " clear_index_shard_status returned " << ret << dendl;
       }
       bucket_info.new_bucket_instance_id.clear();
-      set_status(CLS_RGW_RESHARD_NONE); // clears new_bucket_instance as well
+      set_status(CLS_RGW_RESHARD_NOT_RESHARDING); // clears new_bucket_instance as well
     }
   }