Signed-off-by: Katerina Koukiou <kkouk...@redhat.com>
---
 data/org.libvirt.Domain.xml |  5 +++++
 src/domain.c                | 24 ++++++++++++++++++++++++
 test/test_domain.py         |  2 ++
 3 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index e29cd4c..f300b59 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -101,6 +101,11 @@
         value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSave"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="ManagedSaveRemove">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSaveRemove"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
     <method name="MemoryStats">
       <annotation name="org.gtk.GDBus.DocString"
         value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/>
diff --git a/src/domain.c b/src/domain.c
index 05904d7..5f83b33 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -601,6 +601,29 @@ virtDBusDomainManagedSave(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainManagedSaveRemove(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;
+    guint flags;
+
+    g_variant_get(inArgs, "(u)", &flags);
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainManagedSaveRemove(domain, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainMemoryStats(GVariant *inArgs,
                           GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -849,6 +872,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
     { "GetXMLDesc", virtDBusDomainGetXMLDesc },
     { "HasManagedSaveImage", virtDBusDomainHasManagedSaveImage },
     { "ManagedSave", virtDBusDomainManagedSave },
+    { "ManagedSaveRemove", virtDBusDomainManagedSaveRemove },
     { "MemoryStats", virtDBusDomainMemoryStats },
     { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
     { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
diff --git a/test/test_domain.py b/test/test_domain.py
index 13f27f7..45a99f9 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -59,6 +59,8 @@ class TestDomain(libvirttest.BaseTestClass):
         assert domain.HasManagedSaveImage(0) == dbus.Boolean(True)
         state = obj.Get('org.libvirt.Domain', 'State', 
dbus_interface=dbus.PROPERTIES_IFACE)
         assert state == 'shutoff'
+        domain.ManagedSaveRemove(0)
+        assert domain.HasManagedSaveImage(0) == dbus.Boolean(False)
 
         self.main_loop()
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to