On 08/07/2012 06:05 PM, MATSUDA, Daiki wrote:
Add virDomainQemuAgentCommand() support function to python
module.
generator.py | 1 +
libvirt-qemu-override-api.xml | 8 ++++++++
libvirt-qemu-override.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+)
Normally, the diffstat should occur after a '---' line. It does not
need to be part of the commit message (since git will regenerate it
correctly on the fly when browsing history). I'm not sure why it is
showing up without '---', unless your 'git send-email' settings are off.
diff --git a/python/generator.py b/python/generator.py
index 6559ece..3cec12b 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -431,6 +431,7 @@ skip_impl = (
qemu_skip_impl = (
'virDomainQemuMonitorCommand',
+ 'virDomainQemuAgentCommand',
This hunk belongs in an earlier patch (right now, 3/5, but in reality
whenever you first document the function in libvirt-qemu.h), so that
'make check' can get past the python generation at each commit.
+++ b/python/libvirt-qemu-override-api.xml
@@ -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'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 or None in case of
error'/>
What should this return when the user didn't request 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'/>
Unlike the C code, you don't have a 'result' parameter that can be NULL
when you don't care about waiting for output. But I guess timeout of 0
serves the same purpose, so we should be okay.
+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;
+ int c_retval;
+
+ 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;
+ c_retval = virDomainQemuAgentCommand(domain, cmd, &result, timeout, flags);
The third arg needs to be 'timeout ? &result : NULL', when requesting no
timeout.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org