]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rgw_admin.cc : Make restore attrs readable in admin cli 61037/head
authorJiffin Tony Thottan <thottanjiffin@gmail.com>
Thu, 2 Jan 2025 07:28:13 +0000 (12:58 +0530)
committerJiffin Tony Thottan <thottanjiffin@gmail.com>
Thu, 9 Jan 2025 04:53:18 +0000 (10:23 +0530)
The restore attrs directly stored at the backend which make it difficult to understand
via `radosgw-admin object stat` cli. Make it more human readable form.

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
src/rgw/radosgw-admin/radosgw-admin.cc
src/rgw/rgw_sal.cc
src/rgw/rgw_sal.h

index 182e42b8e31f71c6eb81bc6a6a22ca84d2478829..29804fc5b87f75e24cbab276937de5bbf1479b52 100644 (file)
@@ -8822,9 +8822,19 @@ next:
       } else if (iter->first == RGW_ATTR_SOURCE_ZONE) {
         handled = decode_dump<uint32_t>("source_zone", bl, formatter.get());
       } else if (iter->first == RGW_ATTR_RESTORE_EXPIRY_DATE) {
-        handled = decode_dump<utime_t>("restore_expiry_date", bl, formatter.get());
+        handled = decode_dump<ceph::real_time>("restore_expiry_date", bl, formatter.get());
       } else if (iter->first == RGW_ATTR_RESTORE_TIME) {
-        handled = decode_dump<utime_t>("restore_time", bl, formatter.get());
+        handled = decode_dump<ceph::real_time>("restore_time", bl, formatter.get());
+      } else if (iter->first == RGW_ATTR_RESTORE_TYPE) {
+        rgw::sal::RGWRestoreType rt;
+        decode(rt, bl);
+        formatter->dump_string("RestoreType", rgw::sal::rgw_restore_type_dump(rt));
+        handled = true;
+      } else if (iter->first == RGW_ATTR_RESTORE_STATUS) {
+        rgw::sal::RGWRestoreStatus rs;
+        decode(rs, bl);
+        formatter->dump_string("RestoreStatus", rgw::sal::rgw_restore_status_dump(rs));
+        handled = true;
       }
 
       if (!handled)
@@ -8840,6 +8850,8 @@ next:
       bufferlist& bl = iter->second;
       if (iter->first == RGW_ATTR_OBJ_REPLICATION_TIMESTAMP) {
         decode_dump<ceph::real_time>("user.rgw.replicated-at", bl, formatter.get());
+      } else if (iter->first == RGW_ATTR_RESTORE_TIME) {
+        decode_dump<ceph::real_time>("user.rgw.restore-at", bl, formatter.get());
       } else {
         dump_string(iter->first.c_str(), iter->second, formatter.get());
       }
index b02ad3657e9a292474052752eca639b5350bd92b..e2a6c78b4f436349ef1272b0b4c2ced0e14b1449 100644 (file)
@@ -415,4 +415,38 @@ int Object::range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end)
   }
   return 0;
 }
-} // namespace rgw::sal
+
+
+std::string_view rgw_restore_status_dump(rgw::sal::RGWRestoreStatus status)
+{
+  switch (status)
+  {
+  case RGWRestoreStatus::None:
+    return "None";
+  case RGWRestoreStatus::RestoreAlreadyInProgress:
+    return "RestoreAlreadyInProgress";
+  case RGWRestoreStatus::CloudRestored:
+    return "CloudRestored";
+  case RGWRestoreStatus::RestoreFailed:
+    return "RestoreFailed";
+  default:
+    return "";
+  }
+}
+
+std::string_view rgw_restore_type_dump(rgw::sal::RGWRestoreType type)
+{
+  switch (type)
+  {
+  case RGWRestoreType::None:
+    return "None";
+  case RGWRestoreType::Temporary:
+    return "Temporary";
+  case RGWRestoreType::Permanent:
+    return "Permanent";
+  default:
+    return "";
+  }
+}
+
+} // namespace rgw::sal
\ No newline at end of file
index e098c4decf71a2d4089c9f213a6e44304c711f5d..afe45b53a33dd5e12fe68681a54842d544b0410c 100644 (file)
@@ -160,6 +160,7 @@ enum RGWRestoreStatus : uint8_t {
   RestoreFailed = 3
 };
 
+std::string_view rgw_restore_status_dump(rgw::sal::RGWRestoreStatus status);
 
 enum class RGWRestoreType : uint8_t {
   None = 0,
@@ -167,6 +168,7 @@ enum class RGWRestoreType : uint8_t {
   Permanent = 2
 };
 
+std::string_view rgw_restore_type_dump(rgw::sal::RGWRestoreType type);
 
 // a simple streaming data processing abstraction
 /**