diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index 8a228fba86..5f51fc7260 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -37,6 +37,12 @@
+
+ returns list of all networks
+
+
+
+
Try to lookup a domain on the given hypervisor based on its UUID.
diff --git a/python/libvirt-override-virConnect.py b/python/libvirt-override-virConnect.py
index 87a737f1fb..85db5fee90 100644
--- a/python/libvirt-override-virConnect.py
+++ b/python/libvirt-override-virConnect.py
@@ -218,3 +218,15 @@
retlist.append(virStoragePool(self, _obj=poolptr))
return retlist
+
+ def listAllNetworks(self, flags):
+ """Returns a list of network objects"""
+ ret = libvirtmod.virConnectListAllNetworks(self._o, flags)
+ if ret is None:
+ raise libvirtError("virConnectListAllNetworks() failed", conn=self)
+
+ retlist = list()
+ for netptr in ret:
+ retlist.append(virNetwork(self, _obj=netptr))
+
+ return retlist
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index c1f89389bb..75bacff976 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -2594,6 +2594,53 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
return py_retval;
}
+static PyObject *
+libvirt_virConnectListAllNetworks(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *pyobj_conn;
+ PyObject *py_retval = NULL;
+ PyObject *tmp = NULL;
+ virConnectPtr conn;
+ virNetworkPtr *nets = NULL;
+ int c_retval = 0;
+ int i;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:virConnectListAllNetworks",
+ &pyobj_conn, &flags))
+ return NULL;
+ conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virConnectListAllNetworks(conn, &nets, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!(py_retval = PyList_New(c_retval)))
+ goto cleanup;
+
+ for (i = 0; i < c_retval; i++) {
+ if (!(tmp = libvirt_virNetworkPtrWrap(nets[i])) ||
+ PyList_SetItem(py_retval, i, tmp) < 0) {
+ Py_XDECREF(tmp);
+ Py_DECREF(py_retval);
+ py_retval = NULL;
+ goto cleanup;
+ }
+ /* python steals the pointer */
+ nets[i] = NULL;
+ }
+
+cleanup:
+ for (i = 0; i < c_retval; i++)
+ if (nets[i])
+ virNetworkFree(nets[i]);
+ VIR_FREE(nets);
+ return py_retval;
+}
+
static PyObject *
libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -5943,6 +5990,7 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virConnGetLastError", libvirt_virConnGetLastError, METH_VARARGS, NULL},
{(char *) "virConnectListNetworks", libvirt_virConnectListNetworks, METH_VARARGS, NULL},
{(char *) "virConnectListDefinedNetworks", libvirt_virConnectListDefinedNetworks, METH_VARARGS, NULL},
+ {(char *) "virConnectListAllNetworks", libvirt_virConnectListAllNetworks, METH_VARARGS, NULL},
{(char *) "virNetworkGetUUID", libvirt_virNetworkGetUUID, METH_VARARGS, NULL},
{(char *) "virNetworkGetUUIDString", libvirt_virNetworkGetUUIDString, METH_VARARGS, NULL},
{(char *) "virNetworkLookupByUUID", libvirt_virNetworkLookupByUUID, METH_VARARGS, NULL},