diff options
author | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-10-16 01:31:20 +0100 |
---|---|---|
committer | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-10-16 01:42:46 +0100 |
commit | 6351dbd95f3d3329edf7f4fd94b380bdfa27911e (patch) | |
tree | aefb5ee7cbc71caa2f5a97596ec8626eca79fdda | |
parent | 6ff9570726b8ba6a6d1434a40ae86ca9649b05e6 (diff) | |
download | ceph-6351dbd95f3d3329edf7f4fd94b380bdfa27911e.tar.gz |
mon: Monitor: do not flush formatter at end of _mon_status()
Delegate that to the caller so that we can combine the result of
_mon_status() with the result of other functions.
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
-rw-r--r-- | src/mon/Monitor.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index d8c90bc3d76..8ecd45b05e9 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -241,9 +241,11 @@ void Monitor::do_admin_command(string command, cmdmap_t& cmdmap, string format, boost::scoped_ptr<Formatter> f(new_formatter(format)); - if (command == "mon_status") + if (command == "mon_status") { _mon_status(f.get(), ss); - else if (command == "quorum_status") + if (f) + f->flush(ss); + } else if (command == "quorum_status") _quorum_status(f.get(), ss); else if (command == "sync_force") { string validate; @@ -1673,9 +1675,11 @@ void Monitor::_mon_status(Formatter *f, ostream& ss) f->close_section(); // mon_status - f->flush(ss); - if (free_formatter) + if (free_formatter) { + // flush formatter to ss and delete it iff we created the formatter + f->flush(ss); delete f; + } } void Monitor::get_health(string& status, bufferlist *detailbl, Formatter *f) @@ -2176,6 +2180,8 @@ void Monitor::handle_command(MMonCommand *m) r = 0; } else if (prefix == "mon_status") { _mon_status(f.get(), ds); + if (f) + f->flush(ds); rdata.append(ds); rs = ""; r = 0; |