]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add option to dump pg log to pg command 46571/head
authorNitzanMordhai <nmordech@redhat.com>
Wed, 8 Jun 2022 13:41:13 +0000 (13:41 +0000)
committerNitzanMordhai <nmordech@redhat.com>
Wed, 8 Jun 2022 13:41:21 +0000 (13:41 +0000)
Currently we need to stop the cluster and use ceph_objectstore_tool to dump pg log
with that commit we will be able to dump pg logs with PG command

Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
src/osd/OSD.cc
src/osd/PrimaryLogPG.cc

index ef55e440b06c166cd03f44b89dea758effc15f24..03c6553395e90668da5dd4e055f16bd3e26f5367 100644 (file)
@@ -2527,6 +2527,7 @@ void OSD::asok_command(
   // --- PG commands are routed here to PG::do_command ---
   if (prefix == "pg" ||
       prefix == "query" ||
+      prefix == "log" ||
       prefix == "mark_unfound_lost" ||
       prefix == "list_unfound" ||
       prefix == "scrub" ||
@@ -4188,6 +4189,13 @@ void OSD::final_init()
     asok_hook,
     "");
   ceph_assert(r == 0);
+  r = admin_socket->register_command(
+    "pg "                         \
+    "name=pgid,type=CephPgid "    \
+    "name=cmd,type=CephChoices,strings=log",
+    asok_hook,
+    "");
+  ceph_assert(r == 0);
   r = admin_socket->register_command(
     "pg "                         \
     "name=pgid,type=CephPgid "    \
@@ -4226,6 +4234,11 @@ void OSD::final_init()
     asok_hook,
     "show details of a specific pg");
   ceph_assert(r == 0);
+  r = admin_socket->register_command(
+    "log",
+    asok_hook,
+    "dump pg_log of a specific pg");
+  ceph_assert(r == 0);
   r = admin_socket->register_command(
     "mark_unfound_lost "                                       \
     "name=pgid,type=CephPgid,req=false "                       \
index 1b60dfc0793aa12f178135573c5231e84f329654..b71c2eab8093611849f30d0a4e47bd91cafbf41f 100644 (file)
@@ -1038,7 +1038,14 @@ void PrimaryLogPG::do_command(
 
     f->close_section();
   }
-
+  else if (prefix == "log") {
+    
+    f->open_object_section("op_log");
+    f->open_object_section("pg_log_t");
+    recovery_state.get_pg_log().get_log().dump(f.get());
+    f->close_section();
+    f->close_section();
+  }
   else if (prefix == "mark_unfound_lost") {
     string mulcmd;
     cmd_getval(cmdmap, "mulcmd", mulcmd);