[dbus PATCH 22/25] Implement Save 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                | 28 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index f68cc39..bc8a6eb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -301,6 +301,13 @@
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
     </method>
+    <method name="Save">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSave"/>
+      <arg name="to" type="s" direction="in"/>
+      <arg name="xml" type="s" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
     <method name="SendKey">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSendKey"/>
diff --git a/src/domain.c b/src/domain.c
index 2a27667..c30e9b5 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1527,6 +1527,33 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainSave(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(virDomain) domain = NULL;
+    const gchar *to;
+    const gchar *xml;
+    guint flags;
+
+    g_variant_get(inArgs, "(&s&su)", &to, &xml, &flags);
+    if (g_strcmp0(xml, "") == 0)
+        xml = NULL;
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainSaveFlags(domain, to, xml, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainSendKey(GVariant *inArgs,
                       GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1745,6 +1772,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "Rename", virtDBusDomainRename },
     { "Reset", virtDBusDomainReset },
     { "Resume", virtDBusDomainResume },
+    { "Save", virtDBusDomainSave },
     { "SendKey", virtDBusDomainSendKey },
     { "SetVcpus", virtDBusDomainSetVcpus },
     { "SetMemory", virtDBusDomainSetMemory },
-- 
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