From 3fbebe315f25a4d1ce8cb460710ba6da23dc40f4 Mon Sep 17 00:00:00 2001 From: Prashant D Date: Thu, 25 May 2023 18:09:02 -0400 Subject: [PATCH] mon: Fix ceph versions command The commit-id d3cca1d has introduced a bug where mgr/osd/mds version information goes missing during the cluster upgrade. Collect version information before checking the emptiness of the map. Fixes: https://tracker.ceph.com/issues/61453 Signed-off-by: Prashant D --- src/mon/Monitor.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 395b07b8babba..1f6359c83a142 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3962,8 +3962,8 @@ void Monitor::handle_command(MonOpRequestRef op) } f->close_section(); + mgrmon()->count_metadata("ceph_version", &mgr); if (!mgr.empty()) { - mgrmon()->count_metadata("ceph_version", &mgr); f->open_object_section("mgr"); for (auto& p : mgr) { f->dump_int(p.first.c_str(), p.second); @@ -3972,8 +3972,8 @@ void Monitor::handle_command(MonOpRequestRef op) f->close_section(); } + osdmon()->count_metadata("ceph_version", &osd); if (!osd.empty()) { - osdmon()->count_metadata("ceph_version", &osd); f->open_object_section("osd"); for (auto& p : osd) { f->dump_int(p.first.c_str(), p.second); @@ -3982,8 +3982,8 @@ void Monitor::handle_command(MonOpRequestRef op) f->close_section(); } + mdsmon()->count_metadata("ceph_version", &mds); if (!mds.empty()) { - mdsmon()->count_metadata("ceph_version", &mds); f->open_object_section("mds"); for (auto& p : mds) { f->dump_int(p.first.c_str(), p.second); -- 2.39.5