Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 0937cbb..5763a8a 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -87,6 +87,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="memoryParameters" type="a{sv}"
direction="out"/>
</method>
+ <method name="GetSchedulerParameters">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedule...
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="SchedulerParameters" type="a{sv}"
direction="out"/>
+ </method>
<method name="GetStats">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainListGetStat...
diff --git a/src/domain.c b/src/domain.c
index a8d3e6c..0eda7cf 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -543,6 +543,43 @@ virtDBusDomainGetMemoryParameters(GVariant *inArgs,
*outArgs = g_variant_new_tuple(&grecords, 1);
}
+static void
+virtDBusDomainGetSchedulerParameters(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;
+ guint flags;
+ GVariant *grecords;
+ g_autofree gchar *ret = NULL;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ ret = virDomainGetSchedulerType(domain, &nparams);
+ if (ret && nparams != 0) {
+ if ((params = g_new0(virTypedParameter, nparams)) == NULL)
+ return;
+ if (virDomainGetSchedulerParametersFlags(domain, params, &nparams, 0))
+ return virtDBusUtilSetLastVirtError(error);
+ }
+
+ grecords = virtDBusUtilTypedParamsToGVariant(params,
+ nparams);
+
+ *outArgs = g_variant_new_tuple(&grecords, 1);
+}
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecordListFree);
static void
@@ -1054,6 +1091,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "GetBlkioParameters", virtDBusDomainGetBlkioParameters },
{ "GetJobInfo", virtDBusDomainGetJobInfo },
{ "GetMemoryParameters", virtDBusDomainGetMemoryParameters },
+ { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters },
{ "GetStats", virtDBusDomainGetStats },
{ "GetVcpus", virtDBusDomainGetVcpus },
{ "GetXMLDesc", virtDBusDomainGetXMLDesc },
--
2.15.0