]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: enable ceph_send_command() to send pg command
authorKefu Chai <kchai@redhat.com>
Fri, 23 Jun 2017 04:00:00 +0000 (12:00 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 23 Jun 2017 04:02:03 +0000 (12:02 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/PyState.cc

index ce71dcd3f7003e2e1dfcb4bddb7b2db37d559f63..963526fc519d7c457f5f37f845942034d64368f6 100644 (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: ");