On Fri, 14 Feb 2025 14:54:33 +0100
Markus Armbruster <arm...@redhat.com> wrote:

> Laurent Vivier <lviv...@redhat.com> writes:
> 
> > On 14/02/2025 11:06, Markus Armbruster wrote:  
> >> Laurent Vivier <lviv...@redhat.com> writes:
> >>   
> >>> The netdev reports NETDEV_VHOST_USER_CONNECTED event when
> >>> the chardev is connected, and NETDEV_VHOST_USER_DISCONNECTED
> >>> when it is disconnected.
> >>>
> >>> The NETDEV_VHOST_USER_CONNECTED event includes the ChardevInfo
> >>> (label, filename and frontend_open).
> >>>
> >>> This allows a system manager like libvirt to detect when the server
> >>> fails.
> >>>
> >>> For instance with passt:
> >>>
> >>> { 'execute': 'qmp_capabilities' }
> >>> { "return": { } }
> >>>
> >>> [killing passt here]
> >>>
> >>> { "timestamp": { "seconds": 1739517243, "microseconds": 115081 },
> >>>    "event": "NETDEV_VHOST_USER_DISCONNECTED",
> >>>    "data": { "netdev-id": "netdev0" } }
> >>>
> >>> [automatic reconnection with reconnect-ms]
> >>>
> >>> { "timestamp": { "seconds": 1739517290, "microseconds": 343777 },
> >>>    "event": "NETDEV_VHOST_USER_CONNECTED",
> >>>    "data": { "netdev-id": "netdev0",
> >>>              "info": { "frontend-open": true,
> >>>                        "filename": "unix:",
> >>>                        "label": "chr0" } } }
> >>>
> >>> Signed-off-by: Laurent Vivier <lviv...@redhat.com>  
> >> 
> >> Standard question for events: if a management application misses an
> >> event, say because it restarts and reconnects, is there a way to obtain
> >> the missed information with a query command?  
> >
> > query-chardev could help but it doesn't provide the netdev id.
> >
> > in HMP, "info network" has the information, but for QMP we had a try with a 
> > query-netdev in the past but the series has been reverted.
> >
> > f9bb0c1f9862 ("Revert "qapi: net: Add query-netdev command"")
> > d32ad10a14d4 ("qapi: net: Add query-netdev command")  
> 
> Hmm.  Can management applications use these events without a matching
> query?

Yes, see https://lore.kernel.org/all/20250214095338.344063fa@elisabeth/
and the existing libvirt implementation for NETDEV_STREAM_DISCONNECTED.

-- 
Stefano


Reply via email to