1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-11-27 20:23:47 +03:00

override: domain: Implement override for virDomainGetAutostartOnce()

The bindings generator can't generate proper bindings for
virDomainGetAutostartOnce() (because of int* in the arguments) so
implement it manually.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik
2025-03-21 10:06:48 +01:00
parent 81ec853802
commit 8b350461f7
3 changed files with 35 additions and 0 deletions

View File

@@ -440,6 +440,7 @@ skip_impl = {
'virNodeDeviceGetAutostart',
'virDomainSaveParams',
'virDomainRestoreParams',
'virDomainGetAutostartOnce',
'virDomainLxcOpenNamespace',

View File

@@ -866,5 +866,10 @@
<arg name='params' type='virTypedParameterPtr' info='pointer to save parameter objects'/>
<arg name='flags' type='int' info='an OR&apos;ed set of virDomainSaveRestoreFlags'/>
</function>
<function name='virDomainGetAutostartOnce' file='python'>
<info>Provides a boolean value indicating whether the domain is configured to be automatically started the next time the host machine boots only.</info>
<return type='int' info='the autostart flag, or None in case of error'/>
<arg name='domain' type='virDomainPtr' info='a network object'/>
</function>
</symbols>
</api>

View File

@@ -10913,6 +10913,32 @@ libvirt_virDomainFDAssociate(PyObject *self ATTRIBUTE_UNUSED,
#endif /* LIBVIR_CHECK_VERSION(9, 0, 0) */
#if LIBVIR_CHECK_VERSION(11, 2, 0)
static PyObject *
libvirt_virDomainGetAutostartOnce(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
{
int c_retval, autostart;
virDomainPtr domain;
PyObject *pyobj_domain;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetAutostartOnce",
&pyobj_domain))
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetAutostartOnce(domain, &autostart);
LIBVIRT_END_ALLOW_THREADS;
if (c_retval < 0)
return VIR_PY_INT_FAIL;
return libvirt_intWrap(autostart);
}
#endif /* LIBVIR_CHECK_VERSION(11, 2, 0) */
/************************************************************************
* *
@@ -11198,6 +11224,9 @@ static PyMethodDef libvirtMethods[] = {
#if LIBVIR_CHECK_VERSION(9, 0, 0)
{(char *) "virDomainFDAssociate", libvirt_virDomainFDAssociate, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(9, 0, 0) */
#if LIBVIR_CHECK_VERSION(11, 2, 0)
{(char *) "virDomainGetAutostartOnce", libvirt_virDomainGetAutostartOnce, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(11, 2, 0) */
{NULL, NULL, 0, NULL}
};