]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: report statfs data 37870/head
authorXuehan Xu <xxhdx1985126@gmail.com>
Sun, 1 Nov 2020 03:30:38 +0000 (11:30 +0800)
committerXuehan Xu <xxhdx1985126@gmail.com>
Sun, 1 Nov 2020 03:37:21 +0000 (11:37 +0800)
Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
src/crimson/mgr/client.cc
src/crimson/mgr/client.h
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index 1c8c3fd889f0e862fadb7d563b759525649a85d4..fcc8f8326070ade4a7638e9713ea709b2f82b1d5 100644 (file)
@@ -148,7 +148,6 @@ seastar::future<> Client::handle_mgr_conf(crimson::net::Connection* conn,
 
 void Client::report()
 {
-  with_stats.update_stats();
   gate.dispatch_in_background(__func__, *this, [this] {
     assert(conn);
     auto pg_stats = with_stats.get_stats();
index 742cf0c002610c5b03867eda9110269ba4160013..19e4cd6ee25d43ef13a3f57133b971ce259919fa 100644 (file)
@@ -24,7 +24,6 @@ namespace crimson::mgr
 // implement WithStats if you want to report stats to mgr periodically
 class WithStats {
 public:
-  virtual void update_stats() = 0;
   virtual MessageRef get_stats() const = 0;
   virtual ~WithStats() {}
 };
index f991c0534cab7f4cc442a77dc3e3bdfe9a8af14f..430d8ed2ebb0e28a132e5b4d34f53aa5735d772b 100644 (file)
@@ -89,7 +89,10 @@ OSD::OSD(int id, uint32_t nonce,
     shard_services{*this, whoami, *cluster_msgr, *public_msgr, *monc, *mgrc, *store},
     heartbeat{new Heartbeat{whoami, shard_services, *monc, hb_front_msgr, hb_back_msgr}},
     // do this in background
-    tick_timer{[this] { update_heartbeat_peers(); }},
+    tick_timer{[this] {
+      update_heartbeat_peers();
+      update_stats();
+    }},
     asok{seastar::make_lw_shared<crimson::admin::AdminSocket>()},
     osdmap_gate("OSD::osdmap_gate", std::make_optional(std::ref(shard_services)))
 {
@@ -721,6 +724,11 @@ void OSD::update_stats()
   osd_stat.up_from = get_up_epoch();
   osd_stat.hb_peers = heartbeat->get_peers();
   osd_stat.seq = (static_cast<uint64_t>(get_up_epoch()) << 32) | osd_stat_seq;
+  gate.dispatch_in_background("statfs", *this, [this] {
+    (void) store->stat().then([this](store_statfs_t&& st) {
+      osd_stat.statfs = st;
+    });
+  });
 }
 
 MessageRef OSD::get_stats() const
index 82563767d67fbbf8453f9b5f28c0fd830ca694a2..72a892fb2ffbca7182e7907b8c9e5f92cce73f6b 100644 (file)
@@ -105,7 +105,7 @@ class OSD final : public crimson::net::Dispatcher,
   // pg statistics including osd ones
   osd_stat_t osd_stat;
   uint32_t osd_stat_seq = 0;
-  void update_stats() final;
+  void update_stats();
   MessageRef get_stats() const final;
 
   // AuthHandler methods