]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Fix ceph versions command 51765/head
authorPrashant D <pdhange@redhat.com>
Thu, 25 May 2023 22:09:02 +0000 (18:09 -0400)
committerPrashant D <pdhange@redhat.com>
Fri, 26 May 2023 00:30:55 +0000 (20:30 -0400)
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 <pdhange@redhat.com>
src/mon/Monitor.cc

index 395b07b8babba6ca7ffb0b0c58230c387ad21ed1..1f6359c83a14243ae51d033fc0db2fd4cc3b6671 100644 (file)
@@ -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);