Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index d81f14f..a3318a3 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -382,6 +382,12 @@
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateStar...
<arg name="flags" type="u" direction="in"/>
</method>
+ <method name="PinEmulator">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinEmulator...
+ <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 83ad053..4c0906d 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -2066,6 +2066,45 @@ virtDBusDomainMigrateStartPostCopy(GVariant *inArgs,
virtDBusUtilSetLastVirtError(error);
}
+static void
+virtDBusDomainPinEmulator(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;
+ 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, "(abu)", &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 (virDomainPinEmulator(domain, cpumap, cpumaplen, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
+}
+
static void
virtDBusDomainReboot(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -2797,6 +2836,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
{ "MigrateSetMaxSpeed", virtDBusDomainMigrateSetMaxSpeed },
{ "MigrateStartPostCopy", virtDBusDomainMigrateStartPostCopy },
+ { "PinEmulator", virtDBusDomainPinEmulator },
{ "Reboot", virtDBusDomainReboot },
{ "Rename", virtDBusDomainRename },
{ "Reset", virtDBusDomainReset },
--
2.15.0