[dbus PATCH 09/15] Implement GetInterfaceParameters method 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.Domain.xml |  7 +++++++
 src/domain.c                | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 1324db8..84ef3bf 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -215,6 +215,13 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="hostname" type="s" direction="out"/>
     </method>
+    <method name="GetInterfaceParameters">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetInterfaceParameters"/>
+      <arg name="device" type="s" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+      <arg name="interfaceParameters" type="a{sv}" direction="out"/>
+    </method>
     <method name="GetJobInfo">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo"/>
diff --git a/src/domain.c b/src/domain.c
index 18ca7aa..3c1fec7 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1179,6 +1179,46 @@ virtDBusDomainGetHostname(GVariant *inArgs,
     *outArgs = g_variant_new("(s)", hostname);
 }
 
+static void
+virtDBusDomainGetInterfaceParameters(GVariant *inArgs,
+                                     GUnixFDList *inFDs G_GNUC_UNUSED,
+                                     const gchar *objectPath,
+                                     gpointer userData,
+                                     GVariant **outArgs,
+                                     GUnixFDList **outFDs G_GNUC_UNUSED,
+                                     GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virDomain) domain = NULL;
+    g_auto(virtDBusUtilTypedParams) params = { 0 };
+    const gchar *device;
+    guint flags;
+    gint ret;
+    GVariant *grecords;
+
+    g_variant_get(inArgs, "(&su)", &device, &flags);
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    ret = virDomainGetInterfaceParameters(domain, device, NULL,
+                                          &params.nparams, flags);
+    if (ret < 0)
+        return virtDBusUtilSetLastVirtError(error);
+    if (ret == 0 && params.nparams != 0) {
+        params.params = g_new0(virTypedParameter, params.nparams);
+        if (virDomainGetInterfaceParameters(domain, device, params.params,
+                                            &params.nparams, flags) < 0) {
+            return virtDBusUtilSetLastVirtError(error);
+        }
+    }
+
+    grecords = virtDBusUtilTypedParamsToGVariant(params.params, params.nparams);
+
+    *outArgs = g_variant_new_tuple(&grecords, 1);
+}
+
 static void
 virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED,
                          GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -2261,6 +2301,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "GetFSInfo", virtDBusDomainGetFSInfo },
     { "GetGuestVcpus", virtDBusDomainGetGuestVcpus },
     { "GetHostname", virtDBusDomainGetHostname },
+    { "GetInterfaceParameters", virtDBusDomainGetInterfaceParameters },
     { "GetJobInfo", virtDBusDomainGetJobInfo },
     { "GetMemoryParameters", virtDBusDomainGetMemoryParameters },
     { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters },
-- 
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