Commit e0de1dca authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Path property for StorageVol Interface

Signed-off-by: 's avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent d33dc0c7
......@@ -13,5 +13,10 @@
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetKey"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="Path" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetPath"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
</interface>
</node>
......@@ -68,9 +68,32 @@ virtDBusStorageVolGetKey(const gchar *objectPath,
*value = g_variant_new("s", key);
}
static void
virtDBusStorageVolGetPath(const gchar *objectPath,
gpointer userData,
GVariant **value,
GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virStorageVol) storageVol = NULL;
g_autofree gchar *path = NULL;
storageVol = virtDBusStorageVolGetVirStorageVol(connect, objectPath,
error);
if (!storageVol)
return;
path = virStorageVolGetPath(storageVol);
if (!path)
return virtDBusUtilSetLastVirtError(error);
*value = g_variant_new("s", path);
}
static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = {
{ "Name", virtDBusStorageVolGetName, NULL },
{ "Key", virtDBusStorageVolGetKey, NULL },
{ "Path", virtDBusStorageVolGetPath, NULL },
{ 0 }
};
......
......@@ -140,6 +140,7 @@ class TestStorageVolume(libvirttest.BaseTestClass):
dbus_interface=dbus.PROPERTIES_IFACE)
assert isinstance(props['Key'], dbus.String)
assert isinstance(props['Name'], dbus.String)
assert isinstance(props['Path'], dbus.String)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment