From: Kefu Chai Date: Fri, 23 Jun 2017 04:00:00 +0000 (+0800) Subject: mgr: enable ceph_send_command() to send pg command X-Git-Tag: v12.1.2~1^2~54^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=40b96745f02c255fd610da3381b5e5bcbef23a3e;p=ceph.git mgr: enable ceph_send_command() to send pg command Signed-off-by: Kefu Chai --- diff --git a/src/mgr/PyState.cc b/src/mgr/PyState.cc index ce71dcd3f700..963526fc519d 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: ");