Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- 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 b739841..31abd34 100644 --- a/data/org.libvirt.StoragePool.xml +++ b/data/org.libvirt.StoragePool.xml @@ -16,6 +16,10 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetName"/> </property> + <property name="Persistent" type="b" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolIsPersistent"/> + </property> <property name="UUID" type="s" access="read"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetUUIDString"/> diff --git a/src/storagepool.c b/src/storagepool.c index 834e1c5..c38e029 100644 --- a/src/storagepool.c +++ b/src/storagepool.c @@ -89,6 +89,28 @@ virtDBusStoragePoolGetName(const gchar *objectPath, *value = g_variant_new("s", name); } +static void +virtDBusStoragePoolGetPersistent(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virStoragePool) storagePool = NULL; + gint persistent; + + storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath, + error); + if (!storagePool) + return; + + persistent = virStoragePoolIsPersistent(storagePool); + if (persistent < 0) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("b", !!persistent); +} + static void virtDBusStoragePoolGetUUID(const gchar *objectPath, gpointer userData, @@ -262,6 +284,7 @@ static virtDBusGDBusPropertyTable virtDBusStoragePoolPropertyTable[] = { { "Active", virtDBusStoragePoolGetActive, NULL }, { "Autostart", virtDBusStoragePoolGetAutostart, NULL }, { "Name", virtDBusStoragePoolGetName, NULL }, + { "Persistent", virtDBusStoragePoolGetPersistent, NULL }, { "UUID", virtDBusStoragePoolGetUUID, NULL }, { 0 } }; diff --git a/tests/test_storage.py b/tests/test_storage.py index 34838fc..b872c3d 100755 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -73,6 +73,7 @@ class TestStoragePool(libvirttest.BaseTestClass): assert isinstance(props['Active'], dbus.Boolean) assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['Name'], dbus.String) + assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['UUID'], dbus.String) -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list