diff options
author | Sage Weil <sage@inktank.com> | 2013-07-25 17:58:12 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-25 17:58:35 -0700 |
commit | ca8ac9502bdfce888decd4b53669ef57858afcf6 (patch) | |
tree | f6f79aff99a4dd5d853de92d9a450dc116b31c88 | |
parent | 05b6c7e8645081f405c616735238ae89602d3cc6 (diff) | |
download | ceph-ca8ac9502bdfce888decd4b53669ef57858afcf6.tar.gz |
mon: translate caps=[k1,v1,k2,v2] into [caps_k1=v1, caps_k2=v2]
The command matching needs key/value pairs.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
-rw-r--r-- | src/mon/Monitor.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index bd189f1430c..bf500dff218 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1535,11 +1535,23 @@ bool Monitor::_allowed_command(MonSession *s, map<string, cmd_vartype>& cmd) map<string,string> strmap; for (map<string, cmd_vartype>::const_iterator p = cmd.begin(); p != cmd.end(); ++p) { - if (p->first != "prefix") { - strmap[p->first] = cmd_vartype_stringify(p->second); + if (p->first == "prefix") + continue; + if (p->first == "caps") { + vector<string> cv; + if (cmd_getval(g_ceph_context, cmd, "caps", cv) && + cv.size() % 2 == 0) { + for (unsigned i = 0; i < cv.size(); i += 2) { + string k = string("caps_") + cv[i]; + strmap[k] = cv[i + 1]; + } + continue; + } } + strmap[p->first] = cmd_vartype_stringify(p->second); } + dout(20) << __func__ << " strmap " << strmap << dendl; if (s->caps.is_capable(g_ceph_context, s->inst.name, "", prefix, strmap, false, false, true)) { retval = true; |