From d7848f9358d8031925851ad47ffa56ce885cc04f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 4 Aug 2017 14:37:41 -0400 Subject: [PATCH] mon/MgrMonitor: use static mgr commands if none defined yet During upgrade, we may get a command (like 'pg dump') before we pass our first post-upgrade paxos round embedding the static mgr commands. Until then, use the static mgr commands (that's what we're proposing anyway). Signed-off-by: Sage Weil --- src/mon/MgrMonitor.cc | 9 +++++++++ src/mon/MgrMonitor.h | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index fb760260f3e..fc4f08d8d70 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -938,3 +938,12 @@ int MgrMonitor::dump_metadata(const string& name, Formatter *f, ostream *err) return 0; } +const std::vector &MgrMonitor::get_command_descs() const +{ + if (command_descs.empty()) { + // must have just upgraded; fallback to static commands + return mgr_commands; + } else { + return command_descs; + } +} diff --git a/src/mon/MgrMonitor.h b/src/mon/MgrMonitor.h index f63fb714f79..65451633dbe 100644 --- a/src/mon/MgrMonitor.h +++ b/src/mon/MgrMonitor.h @@ -99,9 +99,7 @@ public: void print_summary(Formatter *f, std::ostream *ss) const; - const std::vector &get_command_descs() const { - return command_descs; - } + const std::vector &get_command_descs() const; int load_metadata(const string& name, std::map& m, ostream *err); -- 2.39.5