From 40b96745f02c255fd610da3381b5e5bcbef23a3e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 23 Jun 2017 12:00:00 +0800 Subject: [PATCH] mgr: enable ceph_send_command() to send pg command Signed-off-by: Kefu Chai --- src/mgr/PyState.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mgr/PyState.cc b/src/mgr/PyState.cc index ce71dcd3f70..963526fc519 100644 --- a/src/mgr/PyState.cc +++ b/src/mgr/PyState.cc @@ -152,7 +152,24 @@ ceph_send_command(PyObject *self, PyObject *args) return nullptr; } } else if (std::string(type) == "pg") { - // TODO: expose objecter::pg_command + pg_t pgid; + if (!pgid.parse(name)) { + delete c; + string msg("invalid pgid: "); + msg.append("\"").append(name).append("\""); + PyErr_SetString(PyExc_ValueError, msg.c_str()); + return nullptr; + } + + ceph_tid_t tid; + global_handle->get_objecter().pg_command( + pgid, + {cmd_json}, + {}, + &tid, + &c->outbl, + &c->outs, + c); return nullptr; } else { string msg("unknown service type: "); -- 2.47.3