Bug 1984721

Summary: Unclear error message while hotplugging the same chardev
Product: Red Hat Enterprise Linux 8 Reporter: liunana <nanliu>
Component: qemu-kvmAssignee: Marc-Andre Lureau <marcandre.lureau>
qemu-kvm sub component: General QA Contact: liunana <nanliu>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: chayang, ddepaula, jinzhao, juzhang, marcandre.lureau, mdeng, virt-maint, yfu
Version: 8.5Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: 8.6   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-6.1.0-2.module+el8.6.0+12861+13975d62 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2001316 (view as bug list) Environment:
Last Closed: 2022-05-10 13:20:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1997410    
Bug Blocks: 2001316    

Description liunana 2021-07-22 02:14:01 UTC
Description of problem:
unclear error message while hotplugging the same chardev


Version-Release number of selected component (if applicable):
Host:    
    kernel-4.18.0-323.el8.x86_64 
    qemu-kvm-6.0.0-24.module+el8.5.0+11844+1e3017bd.x86_64
    



How reproducible: 100%


Steps to Reproduce:
1. Boot qemu with cmdline:
   /usr/libexec/qemu-kvm -monitor stdio -qmp tcp:0:4445,server=on,wait=off

2. Hotplug chardev:
  {"execute":"chardev-add","arguments":{"id":"char2","backend":{"type":"socket","data":{"addr":{"type":"unix", "data": {"path": "/home/mm"}}}}}}
  {"return": {}}

3. Hotplug the same chardev again:
  {"execute":"chardev-add","arguments":{"id":"char2","backend":{"type":"socket","data":{"addr":{"type":"unix", "data": {"path": "/home/mm"}}}}}}
  {"error": {"class": "GenericError", "desc": "duplicate yank instance"}}

Actual results:
Can't tell what's the reason that cause the failure of hotplugging.


Expected results:
We should have reported
that the "id" value for the two chardevs is clashing.


Additional info:

Comment 1 liunana 2021-07-22 02:43:42 UTC
Slow train has no such issue:
    qemu-kvm-4.2.0-53.module+el8.5.0+11673+72138537.x86_64


{"execute":"chardev-add","arguments":{"id":"char2","backend":{"type":"socket","data":{"addr":{"type":"unix", "data": {"path": "/home/mm"}}}}}}
{"return": {}}
{"execute":"chardev-add","arguments":{"id":"char2","backend":{"type":"socket","data":{"addr":{"type":"unix", "data": {"path": "/home/mm"}}}}}}
{"error": {"class": "GenericError", "desc": "attempt to add duplicate property 'char2' to object (type 'container')"}}

Comment 2 Marc-Andre Lureau 2021-07-28 11:34:05 UTC
Would this be good enough?

{"error": {"class": "GenericError", "desc": "Failed to open chardev 'char2': duplicate yank instance"}}


> {"error": {"class": "GenericError", "desc": "attempt to add duplicate property 'char2' to object (type 'container')"}}

wasn't very friendly either..

Comment 3 liunana 2021-07-30 09:39:31 UTC
(In reply to Marc-Andre Lureau from comment #2)
> Would this be good enough?
> 
> {"error": {"class": "GenericError", "desc": "Failed to open chardev 'char2':
> duplicate yank instance"}}
> 

Hi,

It's good to contain the duplicate chardev id, thanks.
But seems 'open chardev' is not a match error log for duplicate hotplugging the same chardev.

How about:

{"error": {"class": "GenericError", "desc": "Failed to add chardev 'char2': duplicate yank instance"}}



Besides, would you please help to explain more about what's the 'yank' function in the error log? Thanks.


> 
> > {"error": {"class": "GenericError", "desc": "attempt to add duplicate property 'char2' to object (type 'container')"}}
> 
> wasn't very friendly either.


Seems clearer than "duplicate yank instance".




Best regards
Liu Nana

Comment 4 John Ferlan 2021-08-09 13:25:32 UTC
Moving this to 8.6, in POST, and setting DTM=5 since this can be tested/validated using the weekly rebase as the fix has gone into qemu-6.1.

Decision was to not backport for AV 8.5 since it's really an error path for newer code (yank functionality) that isn't necessarily reachable via libvirt or other means at this point. Neither RHV nor OSP will use 8.5.

Comment 5 John Ferlan 2021-09-05 13:55:02 UTC
Move to RHEL since RHEL-AV will only be a rebuild of RHEL starting w/ 8.6.0

Added the RHEL rebase bz to depends on list

Comment 8 Yanan Fu 2021-10-13 03:07:41 UTC
Set 'Verified:Tested,SanityOnly' as gating test with qemu-kvm-6.1.0-2.module+el8.6.0+12861+13975d62 pass.

Comment 9 liunana 2021-10-13 14:31:44 UTC
Verified this bug with qemu-kvm-6.1.0-2.module+el8.6.0+12861+13975d62.

1. Boot qemu with cmdline:
   /usr/libexec/qemu-kvm -monitor stdio -qmp tcp:0:4445,server=on,wait=off

2. Hotplug the same chardev, we can get the clear error log.
{"execute":"chardev-add","arguments":{"id":"char2","backend":{"type":"socket","data":{"addr":{"type":"unix", "data": {"path": "/home/mm"}}}}}}
{"return": {}}
{"execute":"chardev-add","arguments":{"id":"char2","backend":{"type":"socket","data":{"addr":{"type":"unix", "data": {"path": "/home/mm"}}}}}}
{"error": {"class": "GenericError", "desc": "Chardev with id 'char2' already exists"}}


Test Env:
    4.18.0-345.1.el8.x86_64
    qemu-kvm-6.1.0-2.module+el8.6.0+12861+13975d62.x86_64
    

I will move this bug to verified now, thanks.



Besides, seems two chardev backends can use the same path, is that normal?

# /usr/libexec/qemu-kvm -monitor stdio -qmp tcp:0:4445,server=on,wait=off -chardev socket,id=t1,path=/tmp/mm,server=on,wait=off -chardev socket,id=t2,path=/tmp/mm,server=on,wait=off
QEMU 6.1.0 monitor - type 'help' for more information
(qemu) VNC server running on ::1:5900
info chardev
t2: filename=disconnected:unix:/tmp/mm,server=on
t1: filename=disconnected:unix:/tmp/mm,server=on
compat_monitor1: filename=disconnected:tcp:0.0.0.0:4445,server=on


Would you please help to check this? Thanks!


Best regards
Liu Nana

Comment 10 Marc-Andre Lureau 2021-10-18 08:32:59 UTC
(In reply to liunana from comment #9)
> I will move this bug to verified now, thanks.
> 

thanks

> Besides, seems two chardev backends can use the same path, is that normal?
> 
> # /usr/libexec/qemu-kvm -monitor stdio -qmp tcp:0:4445,server=on,wait=off
> -chardev socket,id=t1,path=/tmp/mm,server=on,wait=off -chardev
> socket,id=t2,path=/tmp/mm,server=on,wait=off
> QEMU 6.1.0 monitor - type 'help' for more information
> (qemu) VNC server running on ::1:5900
> info chardev
> t2: filename=disconnected:unix:/tmp/mm,server=on
> t1: filename=disconnected:unix:/tmp/mm,server=on
> compat_monitor1: filename=disconnected:tcp:0.0.0.0:4445,server=on
> 
> 
> Would you please help to check this? Thanks!
> 

This expected, qemu has always unlink() the previous path before serving on unix socket.

(in general, UNIX paths aren't very robust, management applications should use different sockets)

Comment 12 errata-xmlrpc 2022-05-10 13:20:14 UTC
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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:1759