[PATCH] Add override impl for virStorageVolGetInfoFlags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 generator.py             |  1 +
 libvirt-override-api.xml |  6 ++++++
 libvirt-override.c       | 43 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)

Pushed as a build fix patch

diff --git a/generator.py b/generator.py
index 2c3b667..afb1d34 100755
--- a/generator.py
+++ b/generator.py
@@ -455,6 +455,7 @@ skip_impl = (
     'virStoragePoolLookupByUUID',
     'virStoragePoolGetInfo',
     'virStorageVolGetInfo',
+    'virStorageVolGetInfoFlags',
     'virStoragePoolGetAutostart',
     'virStoragePoolListVolumes',
     'virDomainBlockPeek',
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 50250bc..c96e83e 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -410,6 +410,12 @@
       <return type='char *' info='the list of information or None in case of error'/>
       <arg name='vol' type='virStorageVolPtr' info='a storage vol object'/>
     </function>
+    <function name='virStorageVolGetInfoFlags' file='python'>
+      <info>Extract information about a storage volume. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info>
+      <return type='char *' info='the list of information or None in case of error'/>
+      <arg name='vol' type='virStorageVolPtr' info='a storage vol object'/>
+      <arg name='flags' type='unsigned int' info='bitwise-OR of virStorageVolInfoFlags'/>
+    </function>
     <function name='virNodeListDevices' file='python'>
       <info>list the node devices</info>
       <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
diff --git a/libvirt-override.c b/libvirt-override.c
index be299d4..db14244 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -3681,6 +3681,46 @@ libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED,
     return NULL;
 }
 
+#if LIBVIR_CHECK_VERSION(3, 0, 0)
+static PyObject *
+libvirt_virStorageVolGetInfoFlags(PyObject *self ATTRIBUTE_UNUSED,
+                                  PyObject *args)
+{
+    PyObject *py_retval;
+    int c_retval;
+    virStorageVolPtr pool;
+    PyObject *pyobj_pool;
+    virStorageVolInfo info;
+    unsigned int flags;
+
+    if (!PyArg_ParseTuple(args, (char *)"OI:virStorageVolGetInfoFlags", &pyobj_pool, &flags))
+        return NULL;
+    pool = (virStorageVolPtr) PyvirStorageVol_Get(pyobj_pool);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    c_retval = virStorageVolGetInfoFlags(pool, &info, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+    if (c_retval < 0)
+        return VIR_PY_NONE;
+
+    if ((py_retval = PyList_New(3)) == NULL)
+        return NULL;
+
+    VIR_PY_LIST_SET_GOTO(py_retval, 0,
+                         libvirt_intWrap((int) info.type), error);
+    VIR_PY_LIST_SET_GOTO(py_retval, 1,
+                         libvirt_ulonglongWrap(info.capacity), error);
+    VIR_PY_LIST_SET_GOTO(py_retval, 2,
+                         libvirt_ulonglongWrap(info.allocation), error);
+
+    return py_retval;
+
+ error:
+    Py_DECREF(py_retval);
+    return NULL;
+}
+#endif
+
 static PyObject *
 libvirt_virStoragePoolGetUUID(PyObject *self ATTRIBUTE_UNUSED,
                               PyObject *args)
@@ -9203,6 +9243,9 @@ static PyMethodDef libvirtMethods[] = {
 #endif /* LIBVIR_CHECK_VERSION(0, 10, 2) */
     {(char *) "virStoragePoolGetInfo", libvirt_virStoragePoolGetInfo, METH_VARARGS, NULL},
     {(char *) "virStorageVolGetInfo", libvirt_virStorageVolGetInfo, METH_VARARGS, NULL},
+#if LIBVIR_CHECK_VERSION(3, 0, 0)
+    {(char *) "virStorageVolGetInfoFlags", libvirt_virStorageVolGetInfoFlags, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(3, 0, 0) */
     {(char *) "virStoragePoolGetUUID", libvirt_virStoragePoolGetUUID, METH_VARARGS, NULL},
     {(char *) "virStoragePoolGetUUIDString", libvirt_virStoragePoolGetUUIDString, METH_VARARGS, NULL},
     {(char *) "virStoragePoolLookupByUUID", libvirt_virStoragePoolLookupByUUID, METH_VARARGS, NULL},
-- 
2.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux