Most of the properties will not emit signals when changed, thus making
the annotation EmitsChangedSignal->false global for this Interface.
Properties with different behavior will overwrite it.
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.StoragePool.xml | 5 +++++
src/storagepool.c | 22 ++++++++++++++++++++++
tests/test_storage.py | 7 +++++++
3 files changed, 34 insertions(+)
diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml
index fb21e59..ed03474 100644
--- a/data/org.libvirt.StoragePool.xml
+++ b/data/org.libvirt.StoragePool.xml
@@ -3,6 +3,11 @@
<node name="/org/libvirt/storagepool">
<interface name="org.libvirt.StoragePool">
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="false"/>
+ <property name="Autostart" type="b"
access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetAu...
+ </property>
<method name="Build">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolBuild...
diff --git a/src/storagepool.c b/src/storagepool.c
index bf1fd3f..515b38c 100644
--- a/src/storagepool.c
+++ b/src/storagepool.c
@@ -24,6 +24,27 @@ virtDBusStoragePoolGetVirStoragePool(virtDBusConnect *connect,
return storagePool;
}
+static void
+virtDBusStoragePoolGetAutostart(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virStoragePool) storagePool = NULL;
+ gint autostart = 0;
+
+ storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath,
+ error);
+ if (!storagePool)
+ return;
+
+ if (virStoragePoolGetAutostart(storagePool, &autostart) < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *value = g_variant_new("b", !!autostart);
+}
+
static void
virtDBusStoragePoolBuild(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -118,6 +139,7 @@ virtDBusStoragePoolDestroy(GVariant *inArgs G_GNUC_UNUSED,
}
static virtDBusGDBusPropertyTable virtDBusStoragePoolPropertyTable[] = {
+ { "Autostart", virtDBusStoragePoolGetAutostart, NULL },
{ 0 }
};
diff --git a/tests/test_storage.py b/tests/test_storage.py
index c4c7cf1..0aa75e3 100755
--- a/tests/test_storage.py
+++ b/tests/test_storage.py
@@ -51,6 +51,13 @@ class TestStoragePool(libvirttest.BaseTestClass):
self.main_loop()
+ def test_storage_pool_properties_type(self):
+ _, obj = self.test_storage_pool()
+
+ props = obj.GetAll('org.libvirt.StoragePool',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ assert isinstance(props['Autostart'], dbus.Boolean)
+
if __name__ == '__main__':
libvirttest.run()
--
2.15.0