Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.StoragePool.xml | 4 ++++
src/storagepool.c | 23 +++++++++++++++++++++++
tests/test_storage.py | 1 +
3 files changed, 28 insertions(+)
diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml
index 50550ee..b739841 100644
--- a/data/org.libvirt.StoragePool.xml
+++ b/data/org.libvirt.StoragePool.xml
@@ -4,6 +4,10 @@
<node name="/org/libvirt/storagepool">
<interface name="org.libvirt.StoragePool">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="false"/>
+ <property name="Active" type="b" access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolIsAct...
+ </property>
<property name="Autostart" type="b"
access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetAu...
diff --git a/src/storagepool.c b/src/storagepool.c
index 628ad17..834e1c5 100644
--- a/src/storagepool.c
+++ b/src/storagepool.c
@@ -24,6 +24,28 @@ virtDBusStoragePoolGetVirStoragePool(virtDBusConnect *connect,
return storagePool;
}
+static void
+virtDBusStoragePoolGetActive(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virStoragePool) storagePool = NULL;
+ gint active;
+
+ storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath,
+ error);
+ if (!storagePool)
+ return;
+
+ active = virStoragePoolIsActive(storagePool);
+ if (active < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *value = g_variant_new("b", !!active);
+}
+
static void
virtDBusStoragePoolGetAutostart(const gchar *objectPath,
gpointer userData,
@@ -237,6 +259,7 @@ virtDBusStoragePoolGetXMLDesc(GVariant *inArgs,
}
static virtDBusGDBusPropertyTable virtDBusStoragePoolPropertyTable[] = {
+ { "Active", virtDBusStoragePoolGetActive, NULL },
{ "Autostart", virtDBusStoragePoolGetAutostart, NULL },
{ "Name", virtDBusStoragePoolGetName, NULL },
{ "UUID", virtDBusStoragePoolGetUUID, NULL },
diff --git a/tests/test_storage.py b/tests/test_storage.py
index 1afae2a..34838fc 100755
--- a/tests/test_storage.py
+++ b/tests/test_storage.py
@@ -70,6 +70,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
props = obj.GetAll('org.libvirt.StoragePool',
dbus_interface=dbus.PROPERTIES_IFACE)
+ assert isinstance(props['Active'], dbus.Boolean)
assert isinstance(props['Autostart'], dbus.Boolean)
assert isinstance(props['Name'], dbus.String)
assert isinstance(props['UUID'], dbus.String)
--
2.15.0