[libvirt] [dbus PATCH 17/19] Implement Refresh method for StoragePool Interface

Katerina Koukiou kkoukiou at redhat.com
Mon May 7 14:40:58 UTC 2018


Test will should be added when
VIR_STORAGE_POOL_EVENT_ID_REFRESH signal will be implemented.

Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
---
 data/org.libvirt.StoragePool.xml |  5 +++++
 src/storagepool.c                | 25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml
index 31abd34..8ebab33 100644
--- a/data/org.libvirt.StoragePool.xml
+++ b/data/org.libvirt.StoragePool.xml
@@ -55,5 +55,10 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="xml" type="s" direction="out"/>
     </method>
+    <method name="Refresh">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolRefresh"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
   </interface>
 </node>
diff --git a/src/storagepool.c b/src/storagepool.c
index c38e029..aa0e280 100644
--- a/src/storagepool.c
+++ b/src/storagepool.c
@@ -280,6 +280,30 @@ virtDBusStoragePoolGetXMLDesc(GVariant *inArgs,
     *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusStoragePoolRefresh(GVariant *inArgs,
+                           GUnixFDList *inFDs G_GNUC_UNUSED,
+                           const gchar *objectPath,
+                           gpointer userData,
+                           GVariant **outArgs G_GNUC_UNUSED,
+                           GUnixFDList **outFDs G_GNUC_UNUSED,
+                           GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virStoragePool) storagePool = NULL;
+    guint flags;
+
+    g_variant_get(inArgs, "(u)", &flags);
+
+    storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath,
+                                                       error);
+    if (!storagePool)
+        return;
+
+    if (virStoragePoolRefresh(storagePool, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusStoragePoolPropertyTable[] = {
     { "Active", virtDBusStoragePoolGetActive, NULL },
     { "Autostart", virtDBusStoragePoolGetAutostart, NULL },
@@ -296,6 +320,7 @@ static virtDBusGDBusMethodTable virtDBusStoragePoolMethodTable[] = {
     { "Destroy", virtDBusStoragePoolDestroy },
     { "GetInfo", virtDBusStoragePoolGetInfo },
     { "GetXMLDesc", virtDBusStoragePoolGetXMLDesc },
+    { "Refresh", virtDBusStoragePoolRefresh },
     { 0 }
 };
 
-- 
2.15.0




More information about the libvir-list mailing list