Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- 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 57e5ea4..087b64e 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 26f6bbf..336128e 100644 --- a/src/domain.c +++ b/src/domain.c @@ -593,6 +593,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, @@ -839,6 +862,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@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list