"Gonglei (Arei)" <arei.gong...@huawei.com> writes:

> Hi,
>
>> > > 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.

In QMP, you get a DEVICE_DELETED event when the unplug completes.  See
qmp/qmp-events.txt.

Reply via email to