Red Hat Bugzilla – Bug 994891
duplicate chardev reported after chardev-remove
Last modified: 2013-11-21 02:08:20 EST
RHEL6 clone +++ This bug was initially created as a clone of Bug #970548 +++ An error is reported when readding a character device with the same id as a removed one: (qemu) chardev-add file,path=foo2,id=foo2 (qemu) chardev-remove foo2 (qemu) chardev-add file,path=foo2,id=foo2 Duplicate ID 'foo2' for chardev Parsing chardev args failed --- Additional comment from dengmin on 2013-06-05 16:50:43 IST --- Hi Paolo, I can not reproduce it via QMP,my detail steps: Build info, qemu-kvm-common-1.5.0-2.el7.x86_64 qemu-kvm-tools-1.5.0-2.el7.x86_64 qemu-kvm-1.5.0-2.el7.x86_64 qemu-kvm-debuginfo-1.5.0-2.el7.x86_64 CLI- 1./usr/libexec/qemu-kvm -cpu SandyBridge -M pc-i440fx-1.5 -enable-kvm -m 4G -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo-test -uuid a5fd4bfe-ccbf-403d-9a26-41b1b3843729 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=RHEL-Server-7.0-64-virtio-min.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device rtl8139,netdev=hostnet0,id=rtl8139-net-pci0,mac=08:2e:5f:0a:0d:a1,bus=pci.0,addr=0x5,bootindex=2 -monitor stdio -vnc :3 -qmp tcp:0:4444,server,nowait 2.{"execute":"chardev-add","arguments":{"id":"bar3","backend":{"type":"file","data":{"out":"/tmp/bar3.log"}}}} {"return": {}} 3.{"execute":"chardev-remove","arguments":{"id":"bar3"}} {"return": {}} 4.{"execute":"chardev-add","arguments":{"id":"bar3","backend":{"type":"file","data":{"out":"/tmp/bar3.log"}}}} {"return": {}} I repeated many times but I still can not reproduce,if possible,could you please tell me why it cannot be reproduced via qmp? thanks in advance. Best Regards, Min --- Additional comment from juzhang on 2013-06-06 07:18:17 IST --- Additional infos, Min can reproduce this issue by using HMP commands? Would you please tell QE what's different between HMP and QMP? QE are using QMP command for usual testing since upper mgmt are using QMP. Thanks in advance . --- Additional comment from Bandan Das on 2013-07-18 01:14:55 IST --- The issue here is that the call path to hmp_chardev_remove isn't removing OptsList. The fix is already upstream : commit 2ea3e2c1e85097c45a882dbc1fbba4a7fdb3ff1c Author: Markus Armbruster <armbru@redhat.com> Date: Thu Jun 27 15:25:12 2013 +0200 qemu-char: Fix ID reuse after chardev-remove for qapi-based init Commit 2c5f488 introduced qapi-based character device initialization as a new code path in qemu_chr_new_from_opts(). Unfortunately, it failed to store parameter opts in the new chardev. Therefore, qemu_chr_delete() doesn't delete it. Even though the device is gone, its options linger, and any attempt to create another one with the same ID fails. Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1372339512-28149-1-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> diff --git a/qemu-char.c b/qemu-char.c index a030e6b..63972ae 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3219,6 +3219,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, } chr = qemu_chr_find(id); + chr->opts = opts; qapi_out: qapi_free_ChardevBackend(backend);
Test this bug on both unfixed version qemu-kvm-0.12.1.2-2.381.el6 and fixed version qemu-kvm-0.12.1.2-2.398.el6, both can not reproduce because failed to add chardev with 'chardev-add' hmp command. Only can hot add it with qmp command. 1. Boot a guest with qmp. 2. (qemu) chardev-add file,path=foo2,id=foo2 chardev-add: unknown type 'q' ======> Failed to hot add chardev with HMP. 3. Tried with qmp commands. (1) All with qmp commands: {"execute":"chardev-add","arguments":{"id":"foo2","backend":{"type":"file","data":{"out":"foo2"}}}} {"return": {}} {"execute":"chardev-remove","arguments":{"id":"foo2"}} {"return": {}} {"execute":"chardev-add","arguments":{"id":"foo2","backend":{"type":"file","data":{"out":"foo2"}}}} {"return": {}} {"execute":"chardev-remove","arguments":{"id":"foo2"}} {"return": {}} {"execute":"chardev-add","arguments":{"id":"foo2","backend":{"type":"file","data":{"out":"foo2"}}}} {"return": {}} (2) qmp + HMP commands: {"execute":"chardev-add","arguments":{"id":"foo2","backend":{"type":"file","data":{"out":"foo2"}}}} {"return": {}} (qemu) info chardev monitor: filename=stdio charserial0: filename=pty:/dev/pts/2 charchannel0: filename=unix:/var/lib/libvirt/qemu/r6.agent,server monitor1: filename=tcp:0.0.0.0:5555,server foo2: filename=file (qemu) chardev-remove foo2 =====> HMP "chardev-remove" works. (qemu) (qemu) info chardev monitor: filename=stdio charserial0: filename=pty:/dev/pts/2 charchannel0: filename=unix:/var/lib/libvirt/qemu/r6.agent,server monitor1: filename=tcp:0.0.0.0:5555,server {"execute":"chardev-add","arguments":{"id":"foo2","backend":{"type":"file","data":{"out":"foo2"}}}} {"return": {}} (qemu) chardev-remove foo2 (qemu) {"execute":"chardev-add","arguments":{"id":"foo2","backend":{"type":"file","data":{"out":"foo2"}}}} {"return": {}} (qemu) chardev-remove foo2 (qemu) Amit, we talked about this before, do you have some suggestion?
(In reply to Qunfang Zhang from comment #5) > Test this bug on both unfixed version qemu-kvm-0.12.1.2-2.381.el6 and fixed > version qemu-kvm-0.12.1.2-2.398.el6, both can not reproduce because failed > to add chardev with 'chardev-add' hmp command. Only can hot add it with qmp > command. > Amit, we talked about this before, do you have some suggestion? Yes, the hmp command doesn't work in RHEL6, and there are no plans to fix it. Since the fix is obvious by code review, and since it fixes things for RHEL7, let's use that data for this bug too?
(In reply to Amit Shah from comment #6) > (In reply to Qunfang Zhang from comment #5) > > Test this bug on both unfixed version qemu-kvm-0.12.1.2-2.381.el6 and fixed > > version qemu-kvm-0.12.1.2-2.398.el6, both can not reproduce because failed > > to add chardev with 'chardev-add' hmp command. Only can hot add it with qmp > > command. > > > Amit, we talked about this before, do you have some suggestion? > > Yes, the hmp command doesn't work in RHEL6, and there are no plans to fix it. > > Since the fix is obvious by code review, and since it fixes things for > RHEL7, let's use that data for this bug too? Okay, agree that and as we can not reproduce it in the latest qemu-kvm with qmp commands. So I will verify it.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-1553.html