Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 243ef35..e262c45 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -96,6 +96,13 @@ <arg name="xml" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="DomainSaveImageGetXMLDesc"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSaveImageGetXMLDesc"/> + <arg name="file" type="s" direction="in"/> + <arg name="flags" type="u" direction="in"/> + <arg name="xml" type="s" direction="out"/> + </method> <method name="FindStoragePoolSources"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectFindStoragePoolSources diff --git a/src/connect.c b/src/connect.c index 0b33bc5..bb2836b 100644 --- a/src/connect.c +++ b/src/connect.c @@ -519,6 +519,33 @@ virtDBusConnectDomainSaveImageDefineXML(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusConnectDomainSaveImageGetXMLDesc(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(virDomain) domain = NULL; + const gchar *file; + guint flags; + g_autofree gchar *xml = NULL; + + g_variant_get(inArgs, "(&su)", &file, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + xml = virDomainSaveImageGetXMLDesc(connect->connection, file, flags); + if (!xml) + return virtDBusUtilSetLastVirtError(error); + + *outArgs = g_variant_new("(s)", xml); +} + static void virtDBusConnectFindStoragePoolSources(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1355,6 +1382,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = { { "DomainLookupByUUID", virtDBusConnectDomainLookupByUUID }, { "DomainRestore", virtDBusConnectDomainRestoreFlags }, { "DomainSaveImageDefineXML", virtDBusConnectDomainSaveImageDefineXML }, + { "DomainSaveImageGetXMLDesc", virtDBusConnectDomainSaveImageGetXMLDesc }, { "FindStoragePoolSources", virtDBusConnectFindStoragePoolSources }, { "GetAllDomainStats", virtDBusConnectGetAllDomainStats }, { "GetCapabilities", virtDBusConnectGetCapabilities }, -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list