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?