From: Joao Eduardo Luis Date: Wed, 16 Oct 2013 00:31:20 +0000 (+0100) Subject: mon: Monitor: do not flush formatter at end of _mon_status() X-Git-Tag: v0.72-rc1~22^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ca1407fd9e69d9c43da70e8ebfc015c73f9f63f;p=ceph.git 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 --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index d8c90bc3d765..8ecd45b05e9d 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 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;