Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 2d8f6fe..6f80cc7 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -171,6 +171,13 @@ <arg name="flags" type="u" direction="in"/> <arg name="BlkioParameters" type="a{sv}" direction="out"/> </method> + <method name="GetBlockIoTune"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockIoTune"/> + <arg name="disk" type="s" direction="in"/> + <arg name="flags" type="u" direction="in"/> + <arg name="blockIoTune" type="a{sv}" direction="out"/> + </method> <method name="GetControlInfo"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetControlInfo"/> diff --git a/src/domain.c b/src/domain.c index b61e9f1..b4bdd34 100644 --- a/src/domain.c +++ b/src/domain.c @@ -866,6 +866,45 @@ virtDBusDomainGetBlkioParameters(GVariant *inArgs, *outArgs = g_variant_new_tuple(&grecords, 1); } +static void +virtDBusDomainGetBlockIoTune(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 }; + const gchar *disk; + guint flags; + gint ret; + GVariant *grecords; + + g_variant_get(inArgs, "(&su)", &disk, &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + ret = virDomainGetBlockIoTune(domain, disk, NULL, ¶ms.nparams, flags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + if (ret == 0 && params.nparams != 0) { + params.params = g_new0(virTypedParameter, params.nparams); + if (virDomainGetBlockIoTune(domain, disk, params.params, + ¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + } + + grecords = virtDBusUtilTypedParamsToGVariant(params.params, params.nparams); + + *outArgs = g_variant_new_tuple(&grecords, 1); +} + static void virtDBusDomainGetControlInfo(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1986,6 +2025,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "FSThaw", virtDBusDomainFSThaw }, { "FSTrim", virtDBusDomainFSTrim }, { "GetBlkioParameters", virtDBusDomainGetBlkioParameters }, + { "GetBlockIoTune", virtDBusDomainGetBlockIoTune }, { "GetControlInfo", virtDBusDomainGetControlInfo }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list