Commit 5040f09e authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Parent property for NodeDevice Interface

Signed-off-by: 's avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Pavel Hrdina's avatarPavel Hrdina <phrdina@redhat.com>
parent 004ff131
......@@ -8,6 +8,11 @@
value="See https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceGetName"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="Parent" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceGetParent"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<method name="Destroy">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceDestroy"/>
......
......@@ -45,6 +45,27 @@ virtDBusNodeDeviceGetName(const gchar *objectPath,
*value = g_variant_new("s", name);
}
static void
virtDBusNodeDeviceGetParent(const gchar *objectPath,
gpointer userData,
GVariant **value,
GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virNodeDevice) dev = NULL;
const gchar *parent;
dev = virtDBusNodeDeviceGetVirNodeDevice(connect, objectPath, error);
if (!dev)
return;
parent = virNodeDeviceGetParent(dev);
if (!parent)
return virtDBusUtilSetLastVirtError(error);
*value = g_variant_new("s", parent);
}
static void
virtDBusNodeDeviceDestroy(GVariant *inArgs G_GNUC_UNUSED,
GUnixFDList *inFDs G_GNUC_UNUSED,
......@@ -91,6 +112,7 @@ virtDBusNodeDeviceDetach(GVariant *inArgs,
static virtDBusGDBusPropertyTable virtDBusNodeDevicePropertyTable[] = {
{ "Name", virtDBusNodeDeviceGetName, NULL },
{ "Parent", virtDBusNodeDeviceGetParent, NULL },
{ 0 }
};
......
......@@ -33,6 +33,7 @@ class TestNodeDevice(libvirttest.BaseTestClass):
obj = self.bus.get_object('org.libvirt', test_node_device_path)
props = obj.GetAll('org.libvirt.NodeDevice', dbus_interface=dbus.PROPERTIES_IFACE)
assert isinstance(props['Name'], dbus.String)
assert isinstance(props['Parent'], 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