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

Add new autostart API for node devices

Provide a manual override for the virNodeDeviceGetAutostart() API
modeled on what's done for the network and storage APIs.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Jonathon Jongsma 2021-09-21 14:08:46 -05:00
parent e78e2bae31
commit 066af64107
3 changed files with 35 additions and 0 deletions

View File

@ -480,6 +480,7 @@ skip_impl = {
'virDomainAuthorizedSSHKeysGet',
'virDomainAuthorizedSSHKeysSet',
'virDomainGetMessages',
'virNodeDeviceGetAutostart',
}
lxc_skip_impl = {

View File

@ -194,6 +194,11 @@
<return type='int' info='the autostart flag, or None in case of error'/>
<arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/>
</function>
<function name='virNodeDeviceGetAutostart' file='python'>
<info>Extract the autostart flag for a node device.</info>
<return type='int' info='the autostart flag, or None in case of error'/>
<arg name='dev' type='virNodeDevicePtr' info='a node device object'/>
</function>
<function name='virDomainBlockStats' file='python'>
<info>Extracts block device statistics for a domain</info>
<return type='char *' info='a tuple of statistics'/>

View File

@ -3355,6 +3355,32 @@ libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED,
return libvirt_intWrap(autostart);
}
#if LIBVIR_CHECK_VERSION(7, 8, 0)
static PyObject *
libvirt_virNodeDeviceGetAutostart(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
{
int c_retval, autostart;
virNodeDevicePtr dev;
PyObject *pyobj_dev;
if (!PyArg_ParseTuple(args, (char *)"O:virNodeDeviceGetAutostart",
&pyobj_dev))
return NULL;
dev = (virNodeDevicePtr) PyvirNodeDevice_Get(pyobj_dev);
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeDeviceGetAutostart(dev, &autostart);
LIBVIRT_END_ALLOW_THREADS;
if (c_retval < 0)
return VIR_PY_INT_FAIL;
return libvirt_intWrap(autostart);
}
#endif /* LIBVIR_CHECK_VERSION(7, 8, 0) */
static PyObject *
libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
@ -10833,6 +10859,9 @@ static PyMethodDef libvirtMethods[] = {
#if LIBVIR_CHECK_VERSION(7, 1, 0)
{(char *) "virDomainGetMessages", libvirt_virDomainGetMessages, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(7, 1, 0) */
#if LIBVIR_CHECK_VERSION(7, 8, 0)
{(char *) "virNodeDeviceGetAutostart", libvirt_virNodeDeviceGetAutostart, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(7, 8, 0) */
{NULL, NULL, 0, NULL}
};