[dbus PATCH v3 17/20] Implement MigrateGetMaxSpeed method for Domain Interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 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#virDomainMigrateGetMaxSpeed"/>
+      <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#virDomainMigrateSetMaxDowntime"/>
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

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux