]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
agent: add python module support
authorMATSUDA Daiki <matsudadik@intellilink.co.jp>
Thu, 23 Aug 2012 03:29:26 +0000 (12:29 +0900)
committerDaniel Veillard <veillard@redhat.com>
Thu, 23 Aug 2012 11:07:53 +0000 (19:07 +0800)
Add virDomainQemuAgentCommand() support function to python module.

Signed-off-by: MATSUDA Daiki <matsudadik@intellilink.co.jp>
python/libvirt-qemu-override-api.xml
python/libvirt-qemu-override.c

index d69acea5d56e340368aaa4e3fa91303899e84462..ca0dae97614b11e4d2b4299f2f031ca9edc2464c 100644 (file)
@@ -8,5 +8,13 @@
         <arg name='cmd' type='const char *' info='the command which will be passed to QEMU monitor'/>
         <arg name='flags' type='unsigned int' info='an OR&apos;ed set of virDomainQemuMonitorCommandFlags'/>
       </function>
+      <function name='virDomainQemuAgentCommand' file='python-qemu'>
+        <info>Send a Guest Agent command to domain</info>
+        <return type='str *' info='the command output'/>
+        <arg name='domain' type='virDomainPtr' info='pointer to the domain'/>
+        <arg name='cmd' type='const char *' info='guest agent command on domain'/>
+        <arg name='timeout' type='int' info='timeout seconds'/>
+        <arg name='flags' type='unsigned int' info='execution flags'/>
+      </function>
   </symbols>
 </api>
index e53241627a1aa4fa4bc69049ec3ac400a943591f..243692a0fb29c9b3e9c1fd2b18068a34cdd6921f 100644 (file)
@@ -82,6 +82,34 @@ libvirt_qemu_virDomainQemuMonitorCommand(PyObject *self ATTRIBUTE_UNUSED,
     return py_retval;
 }
 
+static PyObject *
+libvirt_qemu_virDomainQemuAgentCommand(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
+{
+    PyObject *py_retval;
+    char *result = NULL;
+    virDomainPtr domain;
+    PyObject *pyobj_domain;
+    int timeout;
+    unsigned int flags;
+    char *cmd;
+
+    if (!PyArg_ParseTuple(args, (char *)"Ozii:virDomainQemuAgentCommand",
+                          &pyobj_domain, &cmd, &timeout, &flags))
+        return NULL;
+    domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+    if (domain == NULL)
+        return VIR_PY_NONE;
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    result = virDomainQemuAgentCommand(domain, cmd, timeout, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+
+    if (!result)
+        return VIR_PY_NONE;
+
+    py_retval = PyString_FromString(result);
+    return py_retval;
+}
 /************************************************************************
  *                                                                     *
  *                     The registration stuff                          *
@@ -90,6 +118,7 @@ libvirt_qemu_virDomainQemuMonitorCommand(PyObject *self ATTRIBUTE_UNUSED,
 static PyMethodDef libvirtQemuMethods[] = {
 #include "libvirt-qemu-export.c"
     {(char *) "virDomainQemuMonitorCommand", libvirt_qemu_virDomainQemuMonitorCommand, METH_VARARGS, NULL},
+    {(char *) "virDomainQemuAgentCommand", libvirt_qemu_virDomainQemuAgentCommand, METH_VARARGS, NULL},
     {NULL, NULL, 0, NULL}
 };