> >> > > Il 26/04/2014 10:56, Gonglei (Arei) ha scritto: > >> > > > Public bug reported: > >> > > > > >> > > > I want to repeated hot-plug/unplug the virtio-net in the latest qemu > >> > > upstream > >> > > > (commit 839a5547574e57cce62f49bfc50fe1f04b00589a), but I am > failed > >> at > >> > > the > >> > > > second time hot plug the virtio-net to guest. > >> > > > > >> > > > Then I tried to use Qemu-2.0.0 release version, but I got the error > >> > > > too. > >> > > > > >> > > > Cmdline for vm: > >> > > > > >> > > > /mnt/sdb/gonglei/qemu/x86_64-softmmu/qemu-system-x86_64 > >> -enable-kvm > >> > > -m 4096 -smp 4 -name sles-et -boot c -drive > file=/mnt/sdb/gonglei/image/ > >> > > sles-3.img -vnc 0.0.0.0:10 -monitor stdio > >> > > > QEMU 1.7.50 monitor - type 'help' for more information > >> > > > >> > > For commit 839a5547574e57cce62f49bfc50fe1f04b00589a you should > have > >> > > gotten 1.7.90 as the version number. > >> > > > >> > Maybe just because Peter Maydell merge remote-tracking branch. But it > >> doesn't matter. > >> > > >> > > > (qemu) device_add virtio-net-pci,id=net1 > >> > > > (qemu) device_del net1 > >> > > > (qemu) device_add virtio-net-pci,id=net1 > >> > > > Duplicate ID 'net1' for device > >> > > > (qemu) > >> > > > >> > > I cannot reproduce this on Fedora running the 2.0.0 package from the > >> > > virt-preview repository (qemu-system-x86-2.0.0-2.fc20.x86_64). > >> > > > >> > > For what it's worth, I get this for --version: > >> > > > >> > > $ qemu-system-x86_64 --version > >> > > QEMU emulator version 2.0.0, Copyright (c) 2003-2008 Fabrice Bellard > >> > > > >> > > and likewise, when starting QEMU with "-monitor stdio": > >> > > > >> > > QEMU 2.0.0 monitor - type 'help' for more information > >> > > > >> > I got the QEMU 2.0.0 version from http://wiki.qemu.org/Download > >> > > >> > The issue was reproduced perforce: > >> > UVP:/mnt/sdb/gonglei/code/qemu-2.0.0/x86_64-softmmu > >> #./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name sles \ > >> > -boot c -drive file=/mnt/sdb/gonglei/image/sles-3.img -vnc 0.0.0.0:10 > >> -monitor stdio > >> > QEMU 2.0.0 monitor - type 'help' for more information > >> > (qemu) device_add virtio-net-pci,id=net1 > >> > (qemu) device_del net1 > >> > (qemu) device_add virtio-net-pci,id=net1 > >> > Duplicate ID 'net1' for device > >> > (qemu) > >> > > >> > Anything wrong? Thanks! > >> > >> Issue confirmed with both -monitor and qmp-shell with different other > device > >> models like e1000. > > > > Thanks. This issue confused me two weeks now, any helps will be > appreciated. > > > > Cc'ing Peter and Michael for additional insights. > > I suspect your second device_add fails because the unplug initiated by > device_del hasn't completed, yet. > > More detailed explanation of the ACPI unplug dance: > https://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg01362.html > > Please verify the device is gone with "info pci", "info qtree" or > similar before you try device_del. > Thank you for reply. I have verified it.
Step 1: I executed "device_add virtio-net-pci,id=net1" with "info pci", I found the net1, showing as below: Bus 0, device 4, function 0: Ethernet controller: PCI device 1af4:1000 IRQ 0. BAR0: I/O at 0xffffffffffffffff [0x001e]. BAR1: 32 bit memory at 0xffffffffffffffff [0x00000ffe]. BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe]. id "net1" Step 2: I executed " device_del net1", but the net1 still existed. > In QMP, you get a DEVICE_DELETED event when the unplug completes. See > qmp/qmp-events.txt. Actually, I don't get the event, as the net1 can't be unplug. BTW, when I execute step 1 "device_add virtio-net-pci,id=net1", I don't find the Ethernet controller of virtio-net by "lspci " in the guest OS. TBH, the command execution failed despite we can see net1 with "info pci". Would you help me to verify it? Thanks in advance! Best regards, -Gonglei