On 5/20/26 12:41, Michal Prívozník wrote:
On 5/19/26 15:11, Lucas Kornicki wrote:
Add a generic domain event that fires when libvirt detects a state change on any virtio-serial channel of a domain (connected / disconnected). The existing VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE event is restricted to the QEMU guest agent channel ("org.qemu.guest_agent.0"), making it impossible for management applications to observe lifecycle transitions of other channels (custom guest agents, SPICE, etc.) without polling the domain XML status file.
The new event is emitted for every virtio-serial channel, including the guest agent channel, and carries the affected channels name.
The hypervisor must support virtio-serial port state notifications (e.g. QEMU's VSERPORT_CHANGE event) for the event to be delivered.
Some parts were lifted from the v2 series originally posted to libvirt-devel in 2016 by Matt Broadstone<mbroadst@gmail.com>.
Lucas Kornicki (2): conf,remote: add channel lifecycle domain event qemu: emit channel lifecycle event
examples/c/misc/event-test.c | 57 +++++++++++++++++ include/libvirt/libvirt-domain.h | 65 +++++++++++++++++++ src/conf/domain_event.c | 97 +++++++++++++++++++++++++++++ src/conf/domain_event.h | 12 ++++ src/libvirt_private.syms | 2 + src/qemu/qemu_driver.c | 8 +++ src/qemu/qemu_process.c | 28 +++++++-- src/remote/remote_daemon_dispatch.c | 34 ++++++++++ src/remote/remote_driver.c | 34 ++++++++++ src/remote/remote_protocol.x | 16 ++++- src/remote_protocol-structs | 8 +++ tools/virsh-domain-event.c | 35 +++++++++++ 12 files changed, 389 insertions(+), 7 deletions(-)
I like this. There's only a couple of small nits I've raised. If you want I can fix that before merging or you can send v2.
Michal
I've sent my comments. Please have a look at v1 first, and if everything is in order you can merge with appropriate fixes.