summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2021-09-21 14:08:46 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2021-09-21 16:11:07 -0500
commit066af64107ac340a6c508636e80ec7b415f512d8 (patch)
tree33f051d1f60c7d9726ddb95216c9951d22f7d81c
parente78e2bae31739180b6e469e49a282722f0aa2a08 (diff)
downloadlibvirt-python-066af64107ac340a6c508636e80ec7b415f512d8.tar.gz
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>
-rwxr-xr-xgenerator.py1
-rw-r--r--libvirt-override-api.xml5
-rw-r--r--libvirt-override.c29
3 files changed, 35 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index ceaad46..c7466a8 100755
--- a/generator.py
+++ b/generator.py
@@ -480,6 +480,7 @@ skip_impl = {
'virDomainAuthorizedSSHKeysGet',
'virDomainAuthorizedSSHKeysSet',
'virDomainGetMessages',
+ 'virNodeDeviceGetAutostart',
}
lxc_skip_impl = {
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index a96e5c4..e36a611 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -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'/>
diff --git a/libvirt-override.c b/libvirt-override.c
index 65319ee..8617999 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -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}
};