Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.NodeDevice.xml | 4 ++++ src/nodedev.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/data/org.libvirt.NodeDevice.xml b/data/org.libvirt.NodeDevice.xml index 56deee3..5464c9a 100644 --- a/data/org.libvirt.NodeDevice.xml +++ b/data/org.libvirt.NodeDevice.xml @@ -37,5 +37,9 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceReAttach"/> </method> + <method name="Reset"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceReset"/> + </method> </interface> </node> diff --git a/src/nodedev.c b/src/nodedev.c index 1d15d79..7982fd1 100644 --- a/src/nodedev.c +++ b/src/nodedev.c @@ -193,6 +193,26 @@ virtDBusNodeDeviceReAttach(GVariant *inArgs G_GNUC_UNUSED, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusNodeDeviceReset(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virNodeDevice) dev = NULL; + + dev = virtDBusNodeDeviceGetVirNodeDevice(connect, objectPath, error); + if (!dev) + return; + + if (virNodeDeviceReset(dev) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusNodeDevicePropertyTable[] = { { "Name", virtDBusNodeDeviceGetName, NULL }, { "Parent", virtDBusNodeDeviceGetParent, NULL }, @@ -205,6 +225,7 @@ static virtDBusGDBusMethodTable virtDBusNodeDeviceMethodTable[] = { { "GetXMLDesc", virtDBusNodeDeviceGetXMLDesc }, { "ListCaps", virtDBusNodeDeviceListCaps }, { "ReAttach", virtDBusNodeDeviceReAttach }, + { "Reset", virtDBusNodeDeviceReset }, { 0 } }; -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list