RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 970548 - duplicate chardev reported after chardev-remove
Summary: duplicate chardev reported after chardev-remove
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Bandan Das
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 994891
TreeView+ depends on / blocked
 
Reported: 2013-06-04 10:01 UTC by Paolo Bonzini
Modified: 2014-06-18 03:29 UTC (History)
10 users (show)

Fixed In Version: QEMU 1.5.2
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 994891 (view as bug list)
Environment:
Last Closed: 2014-06-13 10:52:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Paolo Bonzini 2013-06-04 10:01:48 UTC
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

Comment 2 Min Deng 2013-06-05 11:20:43 UTC
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

Comment 3 juzhang 2013-06-06 01:48:17 UTC
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 .

Comment 4 Bandan Das 2013-07-17 19:44:55 UTC
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>
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
    Signed-off-by: Markus Armbruster <armbru>
    Reviewed-by: Gerd Hoffmann <kraxel>
    Message-id: 1372339512-28149-1-git-send-email-armbru
    Signed-off-by: Anthony Liguori <aliguori.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);

Comment 10 Jun Li 2014-03-14 02:35:42 UTC
Reproduce:
Version of component:
qemu-kvm-1.5.1-2.el7.x86_64
-------
(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
(qemu) info chardev 
compat_monitor0: filename=stdio

------------------------------
verify this issue:
Version of components:
qemu-kvm-rhev-1.5.3-52.el7.x86_64
---------
Steps as comment0, no error will be reported.
(qemu) chardev-add file,path=foo2,id=foo2
(qemu) chardev-remove foo2
(qemu) chardev-add file,path=foo2,id=foo2
(qemu) info chardev 
foo2: filename=file
...
-------
Based on above test, this issue has been verified.

Comment 12 Ludek Smid 2014-06-13 10:52:34 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.