[dbus PATCH 3/8] Implement FindStoragePoolSources for Domain Interface

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

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Connect.xml |  9 +++++++++
 src/connect.c                | 30 ++++++++++++++++++++++++++++++
 tests/test_connect.py        |  5 +++++
 3 files changed, 44 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 0fc34e3..e5504f7 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -85,6 +85,15 @@
       <arg name="xml" type="s" direction="in"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="FindStoragePoolSources">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectFindStoragePoolSources
+               Empty string can be used to pass a NULL as @srcSpec argument."/>
+      <arg name="type" type="s" direction="in"/>
+      <arg name="srcSpec" type="s" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+      <arg name="storagePoolSources" type="s" direction="out"/>
+    </method>
     <method name="GetCapabilities">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetCapabilities"/>
diff --git a/src/connect.c b/src/connect.c
index 86fea4f..4e64238 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -474,6 +474,35 @@ virtDBusConnectDomainSaveImageDefineXML(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusConnectFindStoragePoolSources(GVariant *inArgs,
+                                      GUnixFDList *inFDs G_GNUC_UNUSED,
+                                      const gchar *objectPath G_GNUC_UNUSED,
+                                      gpointer userData,
+                                      GVariant **outArgs,
+                                      GUnixFDList **outFDs G_GNUC_UNUSED,
+                                      GError **error)
+{
+    virtDBusConnect *connect = userData;
+    const gchar *type;
+    const gchar *srcSpec;
+    guint flags;
+    g_autofree gchar *ret = NULL;
+
+    g_variant_get(inArgs, "(&s&su)", &type, &srcSpec, &flags);
+    if (g_str_equal(srcSpec, ""))
+        srcSpec = NULL;
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    ret = virConnectFindStoragePoolSources(connect->connection, type, srcSpec, flags);
+    if (!ret)
+        return virtDBusUtilSetLastVirtError(error);
+
+    *outArgs = g_variant_new("(s)", ret);
+}
+
 static void
 virtDBusConnectGetSysinfo(GVariant *inArgs,
                           GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -711,6 +740,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
     { "DomainLookupByUUID", virtDBusConnectDomainLookupByUUID },
     { "DomainRestore", virtDBusConnectDomainRestoreFlags },
     { "DomainSaveImageDefineXML", virtDBusConnectDomainSaveImageDefineXML },
+    { "FindStoragePoolSources", virtDBusConnectFindStoragePoolSources },
     { "GetCapabilities", virtDBusConnectGetCapabilities },
     { "GetSysinfo", virtDBusConnectGetSysinfo },
     { "ListDomains", virtDBusConnectListDomains },
diff --git a/tests/test_connect.py b/tests/test_connect.py
index a7b7ad6..d7ec704 100755
--- a/tests/test_connect.py
+++ b/tests/test_connect.py
@@ -68,6 +68,11 @@ class TestConnect(libvirttest.BaseTestClass):
         path = getattr(self.connect, lookup_method_name)(props[lookup_item])
         assert original_path == path
 
+    def test_connect_find_storage_pool_sources(self):
+        storageType = "logical"
+        sources = self.connect.FindStoragePoolSources(storageType, "", 0)
+        assert isinstance(sources, dbus.String)
+
     def test_connect_list_domains(self):
         domains = self.connect.ListDomains(0)
         assert isinstance(domains, dbus.Array)
-- 
2.15.0

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