Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index c3c64fa..10c4da8 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -96,6 +96,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="stats" type="a{st}"
direction="out"/>
</method>
+ <method name="MigrateGetMaxDowntime">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetM...
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="downtime" type="t"
direction="out"/>
+ </method>
<method name="MigrateSetMaxDowntime">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetM...
diff --git a/src/domain.c b/src/domain.c
index 88e6aaa..522fedb 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -585,6 +585,36 @@ virtDBusDomainMemoryStats(GVariant *inArgs,
*outArgs = g_variant_new_tuple(&gstats, 1);
}
+static void
+virtDBusDomainMigrateGetMaxDowntime(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virDomain) domain = NULL;
+ gulong downtime;
+ guint flags;
+ gint ret;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ ret = virDomainMigrateGetMaxDowntime(domain,
+ (unsigned long long *)&downtime,
+ flags);
+ if (ret < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(t)", downtime);
+}
+
static void
virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -767,6 +797,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "GetVcpus", virtDBusDomainGetVcpus },
{ "GetXMLDesc", virtDBusDomainGetXMLDesc },
{ "MemoryStats", virtDBusDomainMemoryStats },
+ { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
{ "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
{ "Reboot", virtDBusDomainReboot },
{ "Reset", virtDBusDomainReset },
--
2.15.0