Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 28 ++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 21eb162..eec9dcb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -134,6 +134,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="downtime" type="t"
direction="out"/>
</method>
+ <method name="MigrateGetMaxSpeed">
+ <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="bandwidth" 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 5a2dbfb..46a8c03 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -780,6 +780,33 @@ virtDBusDomainMigrateGetMaxDowntime(GVariant *inArgs,
*outArgs = g_variant_new("(t)", downtime);
}
+static void
+virtDBusDomainMigrateGetMaxSpeed(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 bandwidth;
+ guint flags;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ if (virDomainMigrateGetMaxSpeed(domain, &bandwidth, flags) < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(t)", bandwidth);
+}
+
static void
virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -994,6 +1021,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "ManagedSaveRemove", virtDBusDomainManagedSaveRemove },
{ "MemoryStats", virtDBusDomainMemoryStats },
{ "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
+ { "MigrateGetMaxSpeed", virtDBusDomainMigrateGetMaxSpeed },
{ "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
{ "Reboot", virtDBusDomainReboot },
{ "Reset", virtDBusDomainReset },
--
2.15.0