[dbus PATCH 4/6] Implement PinIOThread 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 |  7 +++++++
 src/domain.c                | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index a3318a3..725aadc 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -388,6 +388,13 @@
       <arg name="cpumap" type="ab" direction="in"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="PinIOThread">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinIOThread"/>
+      <arg name="iothreadId" type="u" direction="in"/>
+      <arg name="cpumap" type="ab" 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 4c0906d..eff4e34 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -2105,6 +2105,46 @@ virtDBusDomainPinEmulator(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainPinIOThread(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;
+    guint iothreadId;
+    g_autoptr(GVariantIter) iter = NULL;
+    guint flags;
+    guint cpus;
+    guint cpumaplen;
+    g_autofree guchar *cpumap = NULL;
+    gboolean usable;
+    guint cnt = 0;
+
+    g_variant_get(inArgs, "(uabu)", &iothreadId, &iter, &flags);
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    cpus = g_variant_iter_n_children(iter);
+    cpumaplen = VIR_CPU_MAPLEN(cpus);
+    cpumap = g_new0(guchar, cpumaplen);
+    while (g_variant_iter_loop(iter, "b", &usable)) {
+        if (usable)
+            VIR_USE_CPU(cpumap, cnt);
+        cnt++;
+    }
+
+    if (virDomainPinIOThread(domain, iothreadId, cpumap, cpumaplen, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainReboot(GVariant *inArgs,
                      GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -2837,6 +2877,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "MigrateSetMaxSpeed", virtDBusDomainMigrateSetMaxSpeed },
     { "MigrateStartPostCopy", virtDBusDomainMigrateStartPostCopy },
     { "PinEmulator", virtDBusDomainPinEmulator },
+    { "PinIOThread", virtDBusDomainPinIOThread },
     { "Reboot", virtDBusDomainReboot },
     { "Rename", virtDBusDomainRename },
     { "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