On Thu, Jun 14, 2018 at 05:59:37PM +0200, Katerina Koukiou wrote: > Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> > --- > data/Makefile.am | 4 ++- > data/org.libvirt.StorageVol.xml | 7 ++++ > src/Makefile.am | 4 ++- > src/connect.c | 6 ++++ > src/connect.h | 1 + > src/storagevol.c | 77 +++++++++++++++++++++++++++++++++++++++++ > src/storagevol.h | 9 +++++ > src/util.c | 35 +++++++++++++++++++ > src/util.h | 16 +++++++++ > 9 files changed, 157 insertions(+), 2 deletions(-) > create mode 100644 data/org.libvirt.StorageVol.xml > create mode 100644 src/storagevol.c > create mode 100644 src/storagevol.h [...] > diff --git a/src/storagevol.c b/src/storagevol.c > new file mode 100644 > index 0000000..0097a7f > --- /dev/null > +++ b/src/storagevol.c > @@ -0,0 +1,77 @@ > +#include "storagevol.h" > +#include "util.h" > + > +#include <libvirt/libvirt.h> > + > +static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = { > + { 0 } > +}; > + > +static virtDBusGDBusMethodTable virtDBusStorageVolMethodTable[] = { > + { 0 } > +}; > + > +static gchar ** > +virtDBusStorageVolEnumerate(gpointer userData) > +{ > + virtDBusConnect *connect = userData; > + g_autoptr(virStoragePoolPtr) storagePools = NULL; > + gint numPools = 0; > + GPtrArray *list = NULL; > + > + if (!virtDBusConnectOpen(connect, NULL)) > + return NULL; > + > + numPools = virConnectListAllStoragePools(connect->connection, > + &storagePools, 0); > + if (numPools <= 0) > + return NULL; > + > + list = g_ptr_array_new(); > + > + for (gint i = 0; i < numPools; i++) { > + g_autoptr(virStorageVolPtr) storageVols = NULL; > + gint numVols; > + > + numVols = virStoragePoolListAllVolumes(storagePools[i], > + &storageVols, 0); > + if (numVols <= 0) > + continue; > + > + for (gint j = 0; j < numVols; j++) { > + gchar *volPath = virtDBusUtilBusPathForVirStorageVol(storageVols[j], > + connect->storageVolPath); > + g_ptr_array_add(list, volPath); > + } > + } > + > + if (list->len > 0) > + g_ptr_array_add(list, NULL); > + > + return (gchar **)g_ptr_array_free(list, FALSE); Indentation is off by +1. Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list