]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: add mon metada using type of "mon" 39219/head
authorKefu Chai <kchai@redhat.com>
Tue, 9 Mar 2021 04:51:55 +0000 (12:51 +0800)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Fri, 26 Mar 2021 08:00:09 +0000 (15:00 +0700)
this change addresses a regression introduced by
c037f4cb5d7436879d58c34748ef516b5269781f

also remove the "P" before the json command.

see also: https://tracker.ceph.com/issues/48905

Fixes: https://tracker.ceph.com/issues/49661
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 8fc290bfba4d71a60d30c2374ce4bcba37e649de)

src/mgr/Mgr.cc

index 06899f60eaa1df13cd4e85cdb5e1f47e6fc2b544..e90db3119b6e07bdc84876b5860a9e4a25a89497 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include <Python.h>
-
+#include <fmt/format.h>
 #include "osdc/Objecter.h"
 #include "client/Client.h"
 #include "common/errno.h"
@@ -530,18 +530,15 @@ void Mgr::handle_mon_map()
     }
   });
   for (const auto& name : names_exist) {
-     const auto k = DaemonKey{"osd", name};
-     if (daemon_state.is_updating(k)) {
-       continue;
-     }
-     auto c = new MetadataUpdate(daemon_state, k);
-     std::ostringstream cmd;
-     cmd << "{\"prefix\": \"mon metadata\", \"id\": \""
-    << name << "\"}";
-     monc->start_mon_command(
-    {cmd.str()},
-    {}, &c->outbl, &c->outs, c);
-   }
+    const auto k = DaemonKey{"mon", name};
+    if (daemon_state.is_updating(k)) {
+      continue;
+    }
+    auto c = new MetadataUpdate(daemon_state, k);
+    const char* cmd = R"({{"prefix": "mon metadata", "id": "{}"}})";
+    monc->start_mon_command({fmt::format(cmd, name)}, {},
+               &c->outbl, &c->outs, c);
+  }
   daemon_state.cull("mon", names_exist);
 }