]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: admin cmd to dump pools statfs 40946/head
authorIgor Fedotov <ifedotov@suse.com>
Tue, 20 Apr 2021 21:37:36 +0000 (00:37 +0300)
committerIgor Fedotov <ifed@suse.com>
Mon, 26 Apr 2021 14:36:32 +0000 (17:36 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/osd/OSD.cc

index d7d038efcc6c90033537d0c4908e9d8f9b4e5e8b..ae944a387901acff41c9d97ab95ca719a4579a98 100644 (file)
@@ -3206,6 +3206,30 @@ will start to track new ops received afterwards.";
     }
     f->close_section(); // entries
     f->close_section(); // network_ping_times
+  } else if (prefix == "dump_pool_statfs") {
+    lock_guard l(osd_lock);
+
+    int64_t p = 0;
+    if (!(cmd_getval(cmdmap, "poolid", p))) {
+      ss << "Error dumping pool statfs: no poolid provided";
+      ret = -EINVAL;
+      goto out;
+    }
+
+    store_statfs_t st;
+    bool per_pool_omap_stats = false;
+
+    ret = store->pool_statfs(p, &st, &per_pool_omap_stats);
+    if (ret < 0) {
+      ss << "Error dumping pool statfs: " << cpp_strerror(ret);
+      goto out;
+    } else {
+      ss << "dumping pool statfs...";
+      f->open_object_section("pool_statfs");
+      f->dump_int("poolid", p);
+      st.dump(f);
+      f->close_section();
+    }
   } else {
     ceph_abort_msg("broken asok registration");
   }
@@ -3908,6 +3932,11 @@ void OSD::final_init()
     "Dump osd heartbeat network ping times");
   ceph_assert(r == 0);
 
+  r = admin_socket->register_command(
+    "dump_pool_statfs name=poolid,type=CephInt,req=true", asok_hook,
+    "Dump store's statistics for the given pool");
+  ceph_assert(r == 0);
+
   test_ops_hook = new TestOpsSocketHook(&(this->service), this->store);
   // Note: pools are CephString instead of CephPoolname because
   // these commands traditionally support both pool names and numbers