Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index db9a93e..576f415 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -66,6 +66,12 @@ <arg name="xml" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="GetBlkioParameters"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlkioParameters"/> + <arg name="flags" type="u" direction="in"/> + <arg name="BlkioParameters" 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 1f907e0..0ae093a 100644 --- a/src/domain.c +++ b/src/domain.c @@ -416,6 +416,42 @@ virtDBusDomainDetachDevice(GVariant *inArgs, return virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainGetBlkioParameters(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_autofree virTypedParameterPtr params = NULL; + gint nparams = 0; + guint flags; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetBlkioParameters(domain, NULL, &nparams, flags) == 0 && + nparams != 0) { + if ((params = g_new0(virTypedParameter, nparams)) == NULL) + return; + if (virDomainGetBlkioParameters(domain, params, &nparams, flags)) + return virtDBusUtilSetLastVirtError(error); + } + + grecords = virtDBusUtilTypedParamsToGVariant(params, + nparams); + + *outArgs = g_variant_new_tuple(&grecords, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -917,6 +953,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "Create", virtDBusDomainCreate }, { "Destroy", virtDBusDomainDestroy }, { "DetachDevice", virtDBusDomainDetachDevice }, + { "GetBlkioParameters", virtDBusDomainGetBlkioParameters }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetStats", virtDBusDomainGetStats }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list