1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +03:00

Add support for virConnectBaselineHypervisorCPU

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2018-05-31 17:14:25 +02:00
parent bae22e3eb7
commit 0f3f82e8be
3 changed files with 72 additions and 0 deletions

View File

@ -488,6 +488,7 @@ skip_impl = (
'virDomainGetPerfEvents',
'virDomainSetPerfEvents',
'virDomainGetGuestVcpus',
'virConnectBaselineHypervisorCPU',
)
lxc_skip_impl = (

View File

@ -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>

View File

@ -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}
};