Merge pull request #15865 from tchaikov/wip-mgr-pg-command

mgr: enable ceph_send_command() to send pg command

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
Sage Weil 2017-06-24 23:21:27 -05:00 committed by GitHub
commit cf206cc35c
2 changed files with 19 additions and 2 deletions

View File

@ -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: ");

View File

@ -2203,7 +2203,7 @@ public:
onfinish);
submit_command(c, ptid);
}
void pg_command(pg_t pgid, vector<string>& cmd,
void pg_command(pg_t pgid, const vector<string>& cmd,
const bufferlist& inbl, ceph_tid_t *ptid,
bufferlist *poutbl, string *prs, Context *onfinish) {
CommandOp *c = new CommandOp(