]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: add PG::dump_primary()
authorKefu Chai <kchai@redhat.com>
Sun, 6 Sep 2020 06:49:30 +0000 (14:49 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 6 Sep 2020 07:30:15 +0000 (15:30 +0800)
for implementing asock command "ceph tell 1.0 query"

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index c4b3f5df18af7bf3144f8d70d10c82d4cda09162..22ad38b74a2a94ddbb3bb3b9ed54a535e5713f76 100644 (file)
@@ -495,6 +495,19 @@ void PG::print(ostream& out) const
   out << peering_state << " ";
 }
 
+void PG::dump_primary(Formatter* f)
+{
+  peering_state.dump_peering_state(f);
+
+  f->open_array_section("recovery_state");
+  PeeringState::QueryState q(f);
+  peering_state.handle_event(q, 0);
+  f->close_section();
+
+  // TODO: snap_trimq
+  // TODO: scrubber state
+  // TODO: agent state
+}
 
 std::ostream& operator<<(std::ostream& os, const PG& pg)
 {
index 1f8e0a0bf614c16b60d58af6948dffadbb5a5294..104483d8e819b5c617844e16423ec9d476fca04f 100644 (file)
@@ -529,6 +529,7 @@ public:
                           const MOSDRepOpReply& m);
 
   void print(std::ostream& os) const;
+  void dump_primary(Formatter*);
 
 private:
   void do_peering_event(