Questions on device-added and device-removed events

Han Han hhan at redhat.com
Thu Nov 18 06:37:32 UTC 2021


Hi developers,
When the guest OS is booting, the event for live attachment could be caught
by libvirt, while the event for live detachment could not.
Version:
libvirt-7.9
qemu-kvm-6.1

Steps:
Terminal 1:
➜  ~ virsh event --loop --all

Terminal 2:
➜  ~ virsh start avocado-vt-vm1; qemu-img create /tmp/vdb 10M; virsh
attach-disk avocado-vt-vm1 /tmp/vdb vdb; virsh detach-disk avocado-vt-vm1
vdb

The outputs from terminal 1:
event 'agent-lifecycle' for domain 'avocado-vt-vm1': state: 'disconnected'
reason: 'domain started'
event 'lifecycle' for domain 'avocado-vt-vm1': Resumed Unpaused
event 'lifecycle' for domain 'avocado-vt-vm1': Started Booted
event 'device-added' for domain 'avocado-vt-vm1': virtio-disk1
event 'agent-lifecycle' for domain 'avocado-vt-vm1': state: 'connected'
reason: 'channel event'

As you can see, the device live attachment and the device detachment are
both executed when the guest OS is booting, but there is only the event
'device-added' is recorded.
So my questions are:
1. Is it the expected results for the results above?
2. If so, what is the internal difference between 'device-added' and
'device-removed'?
3. I notice there is the DEVICE_DELETED event in qmp? Any relation between
the 'device-removed' of libvirt and the DEVICE_DELETED of qmp?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20211118/7677b4fa/attachment.htm>


More information about the libvirt-users mailing list