From: Sage Weil Date: Fri, 4 Aug 2017 18:37:41 +0000 (-0400) Subject: mon/MgrMonitor: use static mgr commands if none defined yet X-Git-Tag: v12.1.3~59^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7848f9358d8031925851ad47ffa56ce885cc04f;p=ceph.git 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 --- diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index fb760260f3ec..fc4f08d8d70c 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 f63fb714f795..65451633dbef 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);