]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Fix ceph versions command
authorPrashant D <pdhange@redhat.com>
Thu, 25 May 2023 22:09:02 +0000 (18:09 -0400)
committerYuri Weinstein <yweinste@redhat.com>
Sat, 27 May 2023 22:55:44 +0000 (22:55 +0000)
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>
(cherry picked from commit 3fbebe315f25a4d1ce8cb460710ba6da23dc40f4)
(cherry picked from commit 6173877518eef91d34bc0cea4848b128b7a7dc26)

src/mon/Monitor.cc

index 234fc5c4c3e31bf0faada863101cc1099a315504..5635e5ebcb6958736131fa93539636fd4edb30c7 100644 (file)
@@ -3965,8 +3965,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);
@@ -3975,8 +3975,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);
@@ -3985,8 +3985,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);