Re: [dbus PATCH 02/15] Implement ListStorageVolumes for StoragePool Interface

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

 



On Tue, Jun 12, 2018 at 11:00:15AM +0200, Katerina Koukiou wrote:
Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
data/org.libvirt.StoragePool.xml |  6 ++++++
src/storagepool.c                | 44 ++++++++++++++++++++++++++++++++++++++++
tests/test_storage.py            |  8 ++++++++
3 files changed, 58 insertions(+)

diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml
index e9d6b0e..764c9c1 100644
--- a/data/org.libvirt.StoragePool.xml
+++ b/data/org.libvirt.StoragePool.xml
@@ -57,6 +57,12 @@
      <arg name="flags" type="u" direction="in"/>
      <arg name="xml" type="s" direction="out"/>
    </method>
+    <method name="ListStorageVolumes">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolListAllVolumes"/>
+      <arg name="flags" type="u" direction="in"/>
+      <arg name="storageVols" type="ao" direction="out"/>
+    </method>
    <method name="Refresh">
      <annotation name="org.gtk.GDBus.DocString"
        value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolRefresh"/>
diff --git a/src/storagepool.c b/src/storagepool.c
index 0da732f..11e356c 100644
--- a/src/storagepool.c
+++ b/src/storagepool.c
@@ -301,6 +301,49 @@ virtDBusStoragePoolGetXMLDesc(GVariant *inArgs,
    *outArgs = g_variant_new("(s)", xml);
}

+static void
+virtDBusStoragePoolListAllVolumes(GVariant *inArgs,

s/ListAll/List/

The other DBus wrappers around *ListAll APIs do not include All in their
names.

+                                  GUnixFDList *inFDs G_GNUC_UNUSED,
+                                  const gchar *objectPath,
+                                  gpointer userData,
+                                  GVariant **outArgs,
+                                  GUnixFDList **outFDs G_GNUC_UNUSED,
+                                  GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virStoragePool) storagePool = NULL;
+    g_autoptr(virStorageVolPtr) storageVols = NULL;
+    g_autofree gchar *xml = NULL;

My CLang complains:
storagepool.c:316:23: error: unused variable 'xml' [-Werror,-Wunused-variable]
   g_autofree gchar *xml = NULL;

+    guint flags;
+    gint nVols;
+    GVariantBuilder builder;
+    GVariant *gstorageVols;
+
+    g_variant_get(inArgs, "(u)", &flags);
+
+    storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath,
+                                                       error);
+    if (!storagePool)
+        return;
+
+    nVols = virStoragePoolListAllVolumes(storagePool, &storageVols, flags);
+    if (nVols < 0)
+        return virtDBusUtilSetLastVirtError(error);
+
+    g_variant_builder_init(&builder, G_VARIANT_TYPE("ao"));
+
+    for (gint i = 0; i< nVols; i++) {

Missing space before <.

+        g_autofree gchar *path = NULL;
+        path = virtDBusUtilBusPathForVirStorageVol(storageVols[i],
+                                                   connect->storageVolPath);
+
+        g_variant_builder_add(&builder, "o", path);
+    }
+
+    gstorageVols = g_variant_builder_end(&builder);
+    *outArgs = g_variant_new_tuple(&gstorageVols, 1);

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: Digital signature

--
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