Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index f2ef3dd..97c5471 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -268,6 +268,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="ay" 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 f50043d..92799ac 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1363,6 +1363,39 @@ 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_autofree const guchar *cpumap = NULL;
+ gsize maplen;
+ guint flags;
+ GVariant *v;
+
+ v = g_variant_get_child_value(inArgs, 0);
+ cpumap = g_variant_get_fixed_array(v, &maplen, sizeof(guchar));
+ g_variant_unref(v);
+
+ v = g_variant_get_child_value(inArgs, 1);
+ flags = g_variant_get_uint32(v);
+ g_variant_unref(v);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ if (virDomainPinEmulator(domain, (guchar *)cpumap, maplen, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
+}
+
static void
virtDBusDomainReboot(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1643,6 +1676,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
{ "MigrateSetMaxSpeed", virtDBusDomainMigrateSetMaxSpeed },
{ "MigrateStartPostCopy", virtDBusDomainMigrateStartPostCopy },
+ { "PinEmulator", virtDBusDomainPinEmulator },
{ "Reboot", virtDBusDomainReboot },
{ "Reset", virtDBusDomainReset },
{ "Resume", virtDBusDomainResume },
--
2.15.0