Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index b7fa35f..343fc08 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -203,6 +203,12 @@ <arg name="flags" type="u" direction="in"/> <arg name="fsInfo" type="a(sssas)" direction="out"/> </method> + <method name="GetGuestVcpus"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetGuestVcpus"/> + <arg name="flags" type="u" direction="in"/> + <arg name="vcpus" type="a{sv}" direction="out"/> + </method> <method name="GetJobInfo"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo"/> diff --git a/src/domain.c b/src/domain.c index 1156b84..7b0d6c4 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1121,6 +1121,37 @@ virtDBusDomainGetFSInfo(GVariant *inArgs, *outArgs = g_variant_new_tuple(&gret, 1); } +static void +virtDBusDomainGetGuestVcpus(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; + g_auto(virtDBusUtilTypedParams) params = { 0 }; + guint flags; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetGuestVcpus(domain, ¶ms.params, + (guint *)¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + + grecords = virtDBusUtilTypedParamsToGVariant(params.params, params.nparams); + + *outArgs = g_variant_new_tuple(&grecords, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2201,6 +2232,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "GetControlInfo", virtDBusDomainGetControlInfo }, { "GetDiskErrors", virtDBusDomainGetDiskErrors }, { "GetFSInfo", virtDBusDomainGetFSInfo }, + { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list