[dbus PATCH 06/15] Implement InterfaceDefineXML method for Connect Interface

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

 



Signed-off-by: Anya Harter <aharter@xxxxxxxxxx>
---
 data/org.libvirt.Connect.xml |  7 +++++++
 src/connect.c                | 30 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 0604841..791e1f5 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -148,6 +148,13 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="sysinfo" type="s" direction="out"/>
     </method>
+    <method name="InterfaceDefineXML">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDefineXML"/>
+      <arg name="xml" type="s" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+      <arg name="interface" type="o" direction="out"/>
+    </method>
     <method name="ListDomains">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDomains"/>
diff --git a/src/connect.c b/src/connect.c
index a3d002e..8c39d52 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -735,6 +735,35 @@ virtDBusConnectGetSysinfo(GVariant *inArgs,
     *outArgs = g_variant_new("(s)", sysinfo);
 }
 
+static void
+virtDBusConnectInterfaceDefineXML(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;
+    g_autoptr(virInterface) interface = NULL;
+    g_autofree gchar *path = NULL;
+    const gchar *xml;
+    guint flags;
+
+    g_variant_get(inArgs, "(&su)", &xml, &flags);
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    interface = virInterfaceDefineXML(connect->connection, xml, flags);
+    if (!interface)
+        return virtDBusUtilSetLastVirtError(error);
+
+    path = virtDBusUtilBusPathForVirInterface(interface, connect->interfacePath);
+
+    *outArgs = g_variant_new("(o)", path);
+}
+
 static void
 virtDBusConnectListDomains(GVariant *inArgs,
                            GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1803,6 +1832,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
     { "GetCPUModelNames", virtDBusConnectGetCPUModelNames },
     { "GetDomainCapabilities", virtDBusConnectGetDomainCapabilities },
     { "GetSysinfo", virtDBusConnectGetSysinfo },
+    { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML },
     { "ListDomains", virtDBusConnectListDomains },
     { "ListInterfaces", virtDBusConnectListInterfaces },
     { "ListNetworks", virtDBusConnectListNetworks },
-- 
2.17.1

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