From 11891383aebf73568c044485dffb7c3de12eeeb5 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Mon, 29 Dec 2014 10:05:28 +0200 Subject: [PATCH] mon: make ceph tell mon.* version work Fixes: #6767 Signed-off-by: Mykola Golub --- qa/workunits/cephtool/test.sh | 1 - src/mon/MonCommands.h | 1 + src/mon/Monitor.cc | 12 ++++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index aa325e80d68..0aad890b844 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -1055,7 +1055,6 @@ function test_mon_pg() # ceph tell osd.0 version expect_false ceph tell osd.9999 version - expect_false ceph tell osd.foo version # back to pg stuff diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 4e3a01b8232..a7c6ca03600 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -227,6 +227,7 @@ COMMAND("tell " \ "name=target,type=CephName " \ "name=args,type=CephString,n=N", \ "send a command to a specific daemon", "mon", "rw", "cli,rest") +COMMAND("version", "show mon daemon version", "mon", "r", "cli,rest") /* * MDS commands (MDSMonitor.cc) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 52753a62fb4..78e2061fe6b 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2683,6 +2683,18 @@ void Monitor::handle_command(MMonCommand *m) rs = "needs a valid 'quorum' command"; r = -EINVAL; } + } else if (prefix == "version") { + if (f) { + f->open_object_section("version"); + f->dump_string("version", pretty_version_to_str()); + f->close_section(); + f->flush(ds); + } else { + ds << pretty_version_to_str(); + } + rdata.append(ds); + rs = ""; + r = 0; } out: