Hi Laine,
As for the hot-unplug behavior, I have one more question about it, could you please help to confirm?
unplugging a PCI device properly requires cooperation from the guest OS.
If the guest OS isn't running yet, the unplug won't complete, so qemu
(and libvirt) still show the device as plugged into the guest.
virsh reports success on the unplug because unplugging a device is done
asynchronously - the "success" means "libvirt successfully told qemu to
unplug the device, qemu has told the virtual machine to unplug the
device, and is waiting for acknowledgment from the virtual machine that
the guest has completed removal". At some later time the guest OS may
complete its part of the unplug; when that happens, qemu will get a
notification and will send an event to libvirt - at that time the device
will be removed from libvirt's list of devices.
tl;dr - this is all expected.
The question is that, when I unplug it during boot, the virsh cmd will succeed but the interface still exists, which is expected.
After the vm boot successfully, the guest OS will *not* complete this removal. When I tried to detach it again, it reported that the device was in the process of unplugging.
Is this acceptable?
# virsh detach-interface rhel_new network 52:54:00:36:a8:d4
Interface detached successfully
# virsh domiflist rhel_new
Interface Type Source Model MAC
-------------------------------------------------------------
vnet4 network default virtio 52:54:00:36:a8:d4
# virsh detach-interface rhel_new network 52:54:00:36:a8:d4
error: Failed to detach interface
error: internal error: unable to execute QEMU command 'device_del': Device net0 is already in the process of unplug
Thank you!