Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 0f3d926..a57b05a 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -348,6 +348,12 @@ <arg name="uri" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="SetPerfEvents"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetPerfEvents"/> + <arg name="params" type="a{sv}" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="SetUserPassword"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetUserPassword"/> diff --git a/src/domain.c b/src/domain.c index ae1b68f..7eb43f4 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1699,6 +1699,36 @@ virtDBusDomainSetMetadata(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainSetPerfEvents(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; + g_auto(virtDBusUtilTypedParams) params = { 0 }; + guint flags; + + g_variant_get(inArgs, "(a{sv}u)", &iter, &flags); + + if (!virtDBusUtilGVariantToTypedParams(iter, ¶ms.params, + ¶ms.nparams, error)) { + return; + } + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainSetPerfEvents(domain, params.params, params.nparams, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainSetUserPassword(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1930,6 +1960,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "SetMemory", virtDBusDomainSetMemory }, { "SetMemoryStatsPeriod", virtDBusDomainSetMemoryStatsPeriod }, { "SetMetadata", virtDBusDomainSetMetadata }, + { "SetPerfEvents", virtDBusDomainSetPerfEvents }, { "SetTime", virtDBusDomainSetTime }, { "SetUserPassword", virtDBusDomainSetUserPassword }, { "Shutdown", virtDBusDomainShutdown }, -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list