Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 4 ++++
src/domain.c | 23 +++++++++++++++++++++++
test/test_domain.py | 3 +++
3 files changed, 30 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index b8ee5b8..df9fbf9 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -28,6 +28,10 @@
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsPersisten...
</property>
+ <property name="SchedulerType" type="(si)"
access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedule...
+ </property>
<property name="State" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState&qu...
diff --git a/src/domain.c b/src/domain.c
index 82682ef..f775fd4 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -149,6 +149,28 @@ virtDBusDomainGetPersistent(const gchar *objectPath,
*value = g_variant_new("b", !!persistent);
}
+static void
+virtDBusDomainGetSchedulerType(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virDomain) domain = NULL;
+ g_autofree gchar *schedtype = NULL;
+ gint nparams;
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ schedtype = virDomainGetSchedulerType(domain, &nparams);
+ if (!schedtype)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *value = g_variant_new("(si)", schedtype, nparams);
+}
+
static void
virtDBusDomainGetState(const gchar *objectPath,
gpointer userData,
@@ -517,6 +539,7 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = {
{ "Name", virtDBusDomainGetName, NULL },
{ "OSType", virtDBusDomainGetOsType, NULL },
{ "Persistent", virtDBusDomainGetPersistent, NULL },
+ { "SchedulerType", virtDBusDomainGetSchedulerType, NULL},
{ "State", virtDBusDomainGetState, NULL },
{ "UUID", virtDBusDomainGetUUID, NULL },
{ 0 }
diff --git a/test/test_domain.py b/test/test_domain.py
index 7fa9aad..a7cf962 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -16,6 +16,9 @@ class TestDomain(libvirttest.BaseTestClass):
assert isinstance(props['Name'], dbus.String)
assert isinstance(props['OSType'], dbus.String)
assert isinstance(props['Persistent'], dbus.Boolean)
+ assert any([isinstance(props['SchedulerType'], dbus.Struct),
+ isinstance(props['SchedulerType'][0], dbus.String),
+ isinstance(props['SchedulerType'][1], dbus.Int32)])
assert isinstance(props['State'], dbus.String)
assert isinstance(props['UUID'], dbus.String)
--
2.15.0