From: Loic Dachary Date: Wed, 12 Feb 2014 15:45:40 +0000 (+0100) Subject: mon: split prepare_command in two X-Git-Tag: v0.78~186^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=53e92f62a049fe04b8ac02eb1c7b2f131140c335;p=ceph.git mon: split prepare_command in two So that it is possible to call prepare_command without a session established and a cmdmap that has already been parsed. Signed-off-by: Loic Dachary --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a3ff89abedc..eea7bcb7d6a 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3230,12 +3230,7 @@ int OSDMonitor::prepare_command_pool_set(map &cmdmap, bool OSDMonitor::prepare_command(MMonCommand *m) { - bool ret = false; stringstream ss; - string rs; - bufferlist rdata; - int err = 0; - map cmdmap; if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) { string rs = ss.str(); @@ -3243,16 +3238,28 @@ bool OSDMonitor::prepare_command(MMonCommand *m) return true; } - string format; - cmd_getval(g_ceph_context, cmdmap, "format", format, string("plain")); - boost::scoped_ptr f(new_formatter(format)); - MonSession *session = m->get_session(); if (!session) { mon->reply_command(m, -EACCES, "access denied", get_last_committed()); return true; } + return prepare_command_impl(m, cmdmap); +} + +bool OSDMonitor::prepare_command_impl(MMonCommand *m, + map &cmdmap) +{ + bool ret = false; + stringstream ss; + string rs; + bufferlist rdata; + int err = 0; + + string format; + cmd_getval(g_ceph_context, cmdmap, "format", format, string("plain")); + boost::scoped_ptr f(new_formatter(format)); + string prefix; cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index fc225d5ed70..73f8a9a2630 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -348,6 +348,7 @@ private: list > *detail) const; bool preprocess_command(MMonCommand *m); bool prepare_command(MMonCommand *m); + bool prepare_command_impl(MMonCommand *m, map &cmdmap); int prepare_command_pool_set(map &cmdmap, stringstream& ss);