Bug 1256619

Summary: qemu quit with "qemu_chr_fe_claim_no_fail: error chardev "charnet0" already used"
Product: Red Hat Enterprise Linux 7 Reporter: Qian Guo <qiguo>
Component: qemu-kvm-rhevAssignee: Marc-Andre Lureau <marcandre.lureau>
Status: CLOSED DUPLICATE QA Contact: xiywang
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: chayang, juzhang, knoel, michen, qiguo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-09 01:14:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Qian Guo 2015-08-25 06:51:40 UTC
Description of problem:
Hot remove virtio-net-pci and  vhost-user netdev, but with the chardev left in the qemu.

Then try to hot plug the vhost-user, qemu will quit with 
"qemu_chr_fe_claim_no_fail: error chardev "charnet0" already used
"

I think it should not quit directly due to if the guest is running some important work, it should warning and refuse to hot plug the vhost-user.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.3.0-18.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Boot guest with chardev and vhost-user that user the chardev.
...
-chardev socket,id=charnet0,path=/var/run/openvswitch/vhost-user1 \
-netdev type=vhost-user,id=hostnet0,chardev=charnet0 \
-device virtio-net-pci,netdev=hostnet0,mrg_rxbuf=off,id=net0,mac=52:54:00:01:0b:11,bus=pci.0,addr=0x9
...

2.Hot remove net0 and netdev_del hostnet0

3.Try to hot plug a new netdev that connect to the chardev.
(qemu) netdev_add vhost-user,id=hostnet0,chardev=charnet0



Actual results:
QEMU quit with following infos:
(qemu) netdev_add vhost-user,id=hostnet0,chardev=charnet0
qemu_chr_fe_claim_no_fail: error chardev "charnet0" already used


Expected results:
1. if the chardev is in use, should refuse to use it, but not quit the qemu.

Additional info:

Comment 2 Marc-Andre Lureau 2015-09-03 13:26:48 UTC
I am not sure this is a bug, you must also remove/recreate a chardev to establish a new connection anyway... It could perhaps destroy the chardev for you though when removing the netdev.

Comment 3 Marc-Andre Lureau 2015-09-03 14:22:11 UTC
sent a RFC to qemu-devel "vhost-user: release chardev on cleanup"

Comment 6 Marc-Andre Lureau 2016-08-11 09:17:39 UTC
patches are not even reviewed upstream, low-prio, moving to 7.4

Comment 7 Marc-Andre Lureau 2016-12-27 17:52:06 UTC
patches are not even reviewed upstream, low-prio, moving to 7.5

will resend for 2.9

Comment 8 Marc-Andre Lureau 2017-01-24 18:57:51 UTC
likely fixed in v2.7.0 with:

commit 25f0d2aa5e3d21caa1bc622b21368cc2e383f02c
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Wed Jun 29 15:15:33 2016 +0200

    vhost-user: disable chardev handlers on close

I will check

Comment 9 Marc-Andre Lureau 2017-10-06 11:15:03 UTC
I suggest we close as duplicate of bug 1256618, now that the behaviour is fixed to remove the chardev.

Comment 10 xiywang 2017-10-09 01:14:26 UTC
I checked bug 1256618, we can close as duplicate.
Thanks Marc-Andre.

*** This bug has been marked as a duplicate of bug 1256618 ***