Description of problem: I tried to hot remove the pci device (NIC card) using the following commands: 1.(qemu) info network VLAN 0 devices: tap.0: ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown virtio.0: model=virtio,macaddr=22:11:22:45:66:83 2. (qemu) host_net_remove 0 tap.0 3.(qemu) pci_del pci_addr=3 4.(qemu) info network VLAN 0 devices: virtio.0: model=virtio,macaddr=22:11:22:45:66:83 5.(qemu) info pci .............. Bus 0, device 3, function 0: Ethernet controller: PCI device 1af4:1000 IRQ 11. BAR0: I/O at 0xc040 [0xc05f]. It's failed. Version-Release number of selected component (if applicable): #rpm -qa | grep kvm kvm-qemu-img-83-204.el5 kvm-debuginfo-83-204.el5 etherboot-roms-kvm-5.4.4-13.el5 kvm-tools-83-204.el5 kmod-kvm-83-204.el5 etherboot-zroms-kvm-5.4.4-13.el5 kvm-83-204.el5 How reproducible: Steps to Reproduce: 1.boot 2008 r2 guest. #/usr/libexec/qemu-kvm -no-hpet -usbdevice tablet -rtc-td-hack -m 2G -smp 2 -drive file=/root/zhangjunyi/win2008-r2-virtio.qcow2,if=virtio,boot=on,werror=stop -drive file=/root/zhangjunyi/mnt/win2008/Windows_Server_2008_R2_GA_EN.iso,media=cdrom -fda /usr/share/virtio-win/virtio-drivers-1.0.0-45801-1.0.0.vfd -net nic,vlan=0,macaddr=22:11:22:45:66:83,model=virtio -net tap,vlan=0,script=/etc/qemu-ifup -uuid `uuidgen` -cpu qemu64,+sse2 -balloon none -boot d -monitor stdio -vnc :10 -notify all 2.Issue the following commands 2.1.(qemu) info network VLAN 0 devices: tap.0: ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown virtio.0: model=virtio,macaddr=22:11:22:45:66:83 2.2 (qemu) host_net_remove 0 tap.0 2.3(qemu) pci_del pci_addr=3 2.4(qemu) info network VLAN 0 devices: virtio.0: model=virtio,macaddr=22:11:22:45:66:83 2.5(qemu) info pci .............. Bus 0, device 3, function 0: Ethernet controller: PCI device 1af4:1000 IRQ 11. BAR0: I/O at 0xc040 [0xc05f]. Actual results: The NIC card can not be removed from guest. Expected results: The NIC card can be removed successfully. Additional info: 1. If issue command pci_del pci_addr=3 earlier than command "host_net_remove",The NIC card can be removed successfully. 1.1(qemu) info network VLAN 0 devices: tap.0: ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown virtio.0: model=virtio,macaddr=22:11:22:45:66:83 1.2 (qemu) pci_del pci_addr=3 1.3 (qemu) host_net_remove 0 tap.0 /etc/qemu-ifdown: could not launch network script 1.4 (qemu) info network VLAN 0 devices: 1.5 (qemu) info pci (function 3 was removed) Bus 0, device 0, function 0: Host bridge: PCI device 8086:1237 Bus 0, device 1, function 0: ISA bridge: PCI device 8086:7000 Bus 0, device 1, function 1: IDE controller: PCI device 8086:7010 BAR4: I/O at 0xc000 [0xc00f]. Bus 0, device 1, function 2: USB controller: PCI device 8086:7020 IRQ 10. BAR4: I/O at 0xc020 [0xc03f]. Bus 0, device 1, function 3: Bridge: PCI device 8086:7113 IRQ 9. Bus 0, device 2, function 0: VGA controller: PCI device 1013:00b8 BAR0: 32 bit memory at 0xc2000000 [0xc3ffffff]. BAR1: 32 bit memory at 0xc4000000 [0xc4000fff]. Bus 0, device 4, function 0: SCSI controller: PCI device 1af4:1001 IRQ 10. BAR0: I/O at 0xc080 [0xc0bf]. 2.I also tested rhel6. The NIC card can be removed successfully.now matter which command is issue first.
There's an ordering requirement that's not enforced by the qemu command line. If you can reproduce this with libvirt, using virt-manager or virsh to do the device remove, re-open.