[dbus PATCH v2 02/22] Implement SchedulerType property for Domain Interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 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..dbeafce 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#virDomainIsPersistent"/>
     </property>
+    <property name="SchedulerType" type="si" access="read">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerType"/>
+    </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"/>
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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux