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

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index eec9dcb..838ebed 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -146,6 +146,12 @@
       <arg name="downtime" type="t" direction="in"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="MigrateSetMaxSpeed">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxSpeed"/>
+      <arg name="bandwidth" type="t" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
     <method name="Reboot">
       <annotation name="org.gtk.GDBus.DocString"
         value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/>
diff --git a/src/domain.c b/src/domain.c
index 46a8c03..b7bc10c 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -831,6 +831,30 @@ virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainMigrateSetMaxSpeed(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;
+    gulong bandwidth;
+    guint flags;
+
+    g_variant_get(inArgs, "(tu)", &bandwidth, &flags);
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainMigrateSetMaxSpeed(domain, bandwidth, flags) < 0)
+        return virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainReboot(GVariant *inArgs,
                      GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1023,6 +1047,7 @@ static virtDBusGDBusMethodTable 
virtDBusDomainMethodTable[] = {
     { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
     { "MigrateGetMaxSpeed", virtDBusDomainMigrateGetMaxSpeed },
     { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
+    { "MigrateSetMaxSpeed", virtDBusDomainMigrateSetMaxSpeed },
     { "Reboot", virtDBusDomainReboot },
     { "Reset", virtDBusDomainReset },
     { "Resume", virtDBusDomainResume },
-- 
2.15.0

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

Reply via email to