The python bindings for this API cannot be generated because are generator is not capable of handling string arrays (char **) parameters. https://bugzilla.redhat.com/show_bug.cgi?id=1584676 Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- generator.py | 1 + libvirt-override-api.xml | 11 ++++++++ libvirt-override.c | 60 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/generator.py b/generator.py index a0fc720..b7d96a1 100755 --- a/generator.py +++ b/generator.py @@ -488,6 +488,7 @@ skip_impl = ( 'virDomainGetPerfEvents', 'virDomainSetPerfEvents', 'virDomainGetGuestVcpus', + 'virConnectBaselineHypervisorCPU', ) lxc_skip_impl = ( diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index b63a403..36d3577 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -717,5 +717,16 @@ <arg name='flags' type='unsigned int' info='extra flags; not used yet, so callers should always pass 0'/> <return type='int' info="dictionary of vcpu data returned by the guest agent"/> </function> + <function name='virConnectBaselineHypervisorCPU' file='python'> + <info>Computes the most feature-rich CPU which is compatible with all given CPUs and can be provided by the specified hypervisor.</info> + <return type='char *' info='XML description of the computed CPU or NULL on error.'/> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + <arg name='emulator' type='const char *' info='path to the emulator binary'/> + <arg name='arch' type='const char *' info='CPU architecture'/> + <arg name='machine' type='const char *' info='machine type'/> + <arg name='virttype' type='const char *' info='virtualization type'/> + <arg name='xmlCPUs' type='const char **' info='array of XML descriptions of CPUs'/> + <arg name='flags' type='unsigned int' info='bitwise-OR of virConnectBaselineCPUFlags'/> + </function> </symbols> </api> diff --git a/libvirt-override.c b/libvirt-override.c index b4c1529..1c95c18 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -9708,6 +9708,63 @@ libvirt_virStreamRecvFlags(PyObject *self ATTRIBUTE_UNUSED, #endif /* LIBVIR_CHECK_VERSION(3, 4, 0) */ +#if LIBVIR_CHECK_VERSION(4, 4, 0) +static PyObject * +libvirt_virConnectBaselineHypervisorCPU(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + virConnectPtr conn; + PyObject *pyobj_conn; + char *emulator; + char *arch; + char *machine; + char *virttype; + PyObject *list; + unsigned int flags; + char **xmlCPUs = NULL; + int ncpus = 0; + size_t i; + char *cpu; + PyObject *ret = NULL; + + if (!PyArg_ParseTuple(args, (char *)"OzzzzOI:virConnectBaselineHypervisorCPU", + &pyobj_conn, &emulator, &arch, &machine, &virttype, + &list, &flags)) + return NULL; + + conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); + + if (PyList_Check(list)) { + ncpus = PyList_Size(list); + if (VIR_ALLOC_N(xmlCPUs, ncpus) < 0) + return PyErr_NoMemory(); + + for (i = 0; i < ncpus; i++) { + if (libvirt_charPtrUnwrap(PyList_GetItem(list, i), + &(xmlCPUs[i])) < 0 || + !xmlCPUs[i]) + goto cleanup; + } + } + + LIBVIRT_BEGIN_ALLOW_THREADS; + cpu = virConnectBaselineHypervisorCPU(conn, emulator, arch, machine, virttype, + (const char **)xmlCPUs, ncpus, flags); + LIBVIRT_END_ALLOW_THREADS; + + ret = libvirt_constcharPtrWrap(cpu); + + cleanup: + for (i = 0; i < ncpus; i++) + VIR_FREE(xmlCPUs[i]); + VIR_FREE(xmlCPUs); + VIR_FREE(cpu); + + return ret; +} +#endif /* LIBVIR_CHECK_VERSION(4, 4, 0) */ + + /************************************************************************ * * * The registration stuff * @@ -9941,6 +9998,9 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virStreamSendHole", libvirt_virStreamSendHole, METH_VARARGS, NULL}, {(char *) "virStreamRecvFlags", libvirt_virStreamRecvFlags, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(3, 4, 0) */ +#if LIBVIR_CHECK_VERSION(4, 4, 0) + {(char *) "virConnectBaselineHypervisorCPU", libvirt_virConnectBaselineHypervisorCPU, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(4, 4, 0) */ {NULL, NULL, 0, NULL} }; -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list