Commit d33dc0c7 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Key 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 eeb049a1
......@@ -8,5 +8,10 @@
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetName"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="Key" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetKey"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
</interface>
</node>
......@@ -46,8 +46,31 @@ virtDBusStorageVolGetName(const gchar *objectPath,
*value = g_variant_new("s", name);
}
static void
virtDBusStorageVolGetKey(const gchar *objectPath,
gpointer userData,
GVariant **value,
GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virStorageVol) storageVol = NULL;
const gchar *key;
storageVol = virtDBusStorageVolGetVirStorageVol(connect, objectPath,
error);
if (!storageVol)
return;
key = virStorageVolGetKey(storageVol);
if (!key)
return virtDBusUtilSetLastVirtError(error);
*value = g_variant_new("s", key);
}
static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = {
{ "Name", virtDBusStorageVolGetName, NULL },
{ "Key", virtDBusStorageVolGetKey, NULL },
{ 0 }
};
......
......@@ -138,6 +138,7 @@ class TestStorageVolume(libvirttest.BaseTestClass):
props = obj.GetAll('org.libvirt.StorageVol',
dbus_interface=dbus.PROPERTIES_IFACE)
assert isinstance(props['Key'], dbus.String)
assert isinstance(props['Name'], dbus.String)
......
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