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 1591561 - libvirtd crash when detach serial device using 'virsh detach-device-alias --config'
Summary: libvirtd crash when detach serial device using 'virsh detach-device-alias --...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: jiyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-15 02:37 UTC by yafu
Modified: 2018-10-30 09:57 UTC (History)
5 users (show)

Fixed In Version: libvirt-4.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:56:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:57:59 UTC

Description yafu 2018-06-15 02:37:35 UTC
Description of problem:
libvirtd crash when detach serial device using 'virsh detach-device-alias --config'

Version-Release number of selected component (if applicable):
libvirt-4.4.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Start a guest having serial tty device with alias name:
#virsh dumpxml iommu1
 <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='ua-04c2decd-8e33-4023-84de-a2205c777af7'/>
    </serial>

2.Detach serial device using 'virsh detach-device-alias'
#virsh detach-device-alias iommu1 ua-04c2decd-8e33-4023-84de-a2205c777af7 --config
error: Disconnected from qemu:///system due to end of file
error: Failed to detach device with alias ua-04c2decd-8e33-4023-84de-a2205c777af7
error: End of file while reading data: Input/output error


Actual results:
As step 2.

Expected results:
Should detach the serial device successfuly

Additional info:
1.The backtrace of crashed libvirtd:
(gdb) bt
#0  0x00007f1be167e1b7 in raise () from /lib64/libc.so.6
#1  0x00007f1be167f8a8 in abort () from /lib64/libc.so.6
#2  0x00007f1be16c0c77 in __libc_message () from /lib64/libc.so.6
#3  0x00007f1be16c93d9 in _int_free () from /lib64/libc.so.6
#4  0x00007f1be464f66a in virFree (ptrptr=ptrptr@entry=0x7f1bd39ca868) at util/viralloc.c:582
#5  0x00007f1be473ab81 in virDomainChrDefFree (def=0x7f1ba40457f0) at conf/domain_conf.c:2419
#6  0x00007f1bc19e9301 in qemuDomainDetachDeviceConfig (vmdef=0x7f1ba40438f0, caps=caps@entry=0x7f1bb818d710, parse_flags=parse_flags@entry=1026, 
    xmlopt=0x7f1bb8290370, dev=0x7f1bd39ca950, dev=0x7f1bd39ca950) at qemu/qemu_driver.c:8222
#7  0x00007f1bc19e99e9 in qemuDomainDetachDeviceAliasLiveAndConfig (flags=<optimized out>, 
    alias=0x7f1b94000960 "ua-04c2decd-8e33-4023-84de-a2205c777af7", vm=0x7f1bb81bc140, driver=0x7f1bb8109b70) at qemu/qemu_driver.c:8798
#8  qemuDomainDetachDeviceAlias (dom=<optimized out>, alias=0x7f1b94000960 "ua-04c2decd-8e33-4023-84de-a2205c777af7", flags=2)
    at qemu/qemu_driver.c:8885
#9  0x00007f1be4939407 in virDomainDetachDeviceAlias (domain=domain@entry=0x7f1b94002630, 
    alias=0x7f1b94000960 "ua-04c2decd-8e33-4023-84de-a2205c777af7", flags=2) at libvirt-domain.c:8391
#10 0x000055675679db66 in remoteDispatchDomainDetachDeviceAlias (server=0x5567575b93c0, msg=0x55675760afd0, args=0x7f1b94002750, 
    rerr=0x7f1bd39cabc0, client=<optimized out>) at remote/remote_daemon_dispatch_stubs.h:4911
#11 remoteDispatchDomainDetachDeviceAliasHelper (server=0x5567575b93c0, client=<optimized out>, msg=0x55675760afd0, rerr=0x7f1bd39cabc0, 
    args=0x7f1b94002750, ret=0x7f1b94000b70) at remote/remote_daemon_dispatch_stubs.h:4887
#12 0x00007f1be4816a45 in virNetServerProgramDispatchCall (msg=0x55675760afd0, client=0x55675760c5a0, server=0x5567575b93c0, prog=0x556757608390)
    at rpc/virnetserverprogram.c:437
#13 virNetServerProgramDispatch (prog=0x556757608390, server=server@entry=0x5567575b93c0, client=client@entry=0x55675760c5a0, 
    msg=msg@entry=0x55675760afd0) at rpc/virnetserverprogram.c:304
#14 0x00007f1be481f7aa in virNetServerProcessMsg (srv=srv@entry=0x5567575b93c0, client=0x55675760c5a0, prog=<optimized out>, msg=0x55675760afd0)
    at rpc/virnetserver.c:145
#15 0x00007f1be481fbf8 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x5567575b93c0) at rpc/virnetserver.c:166
#16 0x00007f1be4701ec1 in virThreadPoolWorker (opaque=opaque@entry=0x5567575ad500) at util/virthreadpool.c:167
#17 0x00007f1be4700c90 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
#18 0x00007f1be1a1cdd5 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f1be1746aed in clone () from /lib64/libc.so.6

Comment 2 jiyan 2018-06-15 03:05:47 UTC
Detaching channel device can hit this issue, too.

Version:
libvirt-4.4.0-2.el7.x86_64
kernel-3.10.0-902.el7.x86_64
qemu-kvm-rhev-2.12.0-3.el7.x86_64

Steps:
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "<channel" -A4
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <alias name='ua-fb00b3f4-ec4b-4f39-95e8-04b78b405576'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

# virsh start test1
Domain test1 started

# virsh detach-device-alias test1 ua-fb00b3f4-ec4b-4f39-95e8-04b78b405576 --config
error: Disconnected from qemu:///system due to end of file
error: Failed to detach device with alias ua-fb00b3f4-ec4b-4f39-95e8-04b78b405576
error: End of file while reading data: Input/output error

Comment 3 Michal Privoznik 2018-06-15 14:21:16 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2018-June/msg01284.html

Comment 4 Michal Privoznik 2018-06-18 07:32:53 UTC
I've just pushed patch upstream:

commit edcd3ed4a45689e828a2177e8196a61acc16f6ed
Author:     Michal Privoznik <mprivozn>
AuthorDate: Fri Jun 15 16:16:08 2018 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Mon Jun 18 09:20:38 2018 +0200

    qemuDomainDetachDeviceConfig: Don't free device from @dev
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1591561
    
    For reasons I don't understand my original patch of 75f0fd51124
    freed not only the chardev from domain but also the one from
    passed virDomainDeviceDefPtr. This caused no troubles until now,
    because those two pointers were separate, but after I've
    introduced virDomainDetachDeviceAlias() they became the same
    resulting in double free on detach.
    
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Ján Tomko <jtomko>

v4.4.0-263-gedcd3ed4a4

Comment 6 jiyan 2018-07-06 08:45:09 UTC
Version:
qemu-kvm-rhev-2.12.0-7.el7.x86_64
libvirt-4.5.0-1.el7.x86_64
kernel-3.10.0-919.el7.x86_64


======================1. PTY CHARDEV
1-1. pty+isa-serial (Serial/console) and pty+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev pty,id=charua-9874229d-d867-4932-ad28-111111111111 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-111111111111,id=ua-9874229d-d867-4932-ad28-111111111111

-chardev pty,id=charua-9874229d-d867-4932-ad28-111111111112 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-111111111112,id=ua-9874229d-d867-4932-ad28-111111111112,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111111 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111112 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


1-2. pty +virtio (Channel)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev pty,id=charua-9874229d-d867-4932-ad28-111111111201 
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charua-9874229d-d867-4932-ad28-111111111201,id=ua-9874229d-d867-4932-ad28-111111111201,name=arbitrary.virtio.serial.port.name 

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:05 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111201 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:05 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive |grep "<channel" -A5
No output


======================2. File CHARDEV
2-1. file+isa-serial (Serial/console) and file+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev file,id=charua-9874229d-d867-4932-ad28-11111111113,path=/dev/fdset/2,append=on 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111113,id=ua-9874229d-d867-4932-ad28-11111111113 -add-fd set=3,fd=32 
-chardev file,id=charua-9874229d-d867-4932-ad28-11111111114,path=/dev/fdset/3,append=on 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111114,id=ua-9874229d-d867-4932-ad28-11111111114,bus=pci.0,addr=0xa

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111113 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111114 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


======================3. PIPE CHARDEV
3-1. pipe+isa-serial (Serial/console) and pipe+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev pipe,id=charua-9874229d-d867-4932-ad28-11111111115,path=/tmp/mypipe 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111115,id=ua-9874229d-d867-4932-ad28-11111111115 
-chardev pipe,id=charua-9874229d-d867-4932-ad28-11111111116,path=/tmp/mypipe1 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111116,id=ua-9874229d-d867-4932-ad28-11111111116,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111115 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111116 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


======================4. NULL CHARDEV
4-1. null+isa-serial (Serial/console) and null+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev null,id=charua-9874229d-d867-4932-ad28-11111111117 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111117,id=ua-9874229d-d867-4932-ad28-11111111117 
-chardev null,id=charua-9874229d-d867-4932-ad28-11111111118 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111118,id=ua-9874229d-d867-4932-ad28-11111111118,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111117 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111118 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:03 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


======================5. VC CHARDEV
5-1. vc+isa-serial (Serial/console) and vc+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev vc,id=charua-9874229d-d867-4932-ad28-11111111119 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111119,id=ua-9874229d-d867-4932-ad28-11111111119 
-chardev vc,id=charua-9874229d-d867-4932-ad28-11111111120 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111120,id=ua-9874229d-d867-4932-ad28-11111111120,bus=pci.0,addr=0xc

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111119 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111120 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:03 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


======================6. UDP CHARDEV
6-1. udp+isa-serial (Serial/console) and udp+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev udp,id=charua-9874229d-d867-4932-ad28-11111111121,host=0.0.0.0,port=2445,localaddr=0.0.0.0,localport=2445 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111121,id=ua-9874229d-d867-4932-ad28-11111111121 
-chardev udp,id=charua-9874229d-d867-4932-ad28-11111111122,host=0.0.0.0,port=2445,localaddr=0.0.0.0,localport=2445 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111122,id=ua-9874229d-d867-4932-ad28-11111111122,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111121 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111122 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root     16766     1  0 23:24 ?        00:00:03 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


======================7. SPICEPORT CHARDEV
7-1. spiceport+isa-serial (Serial/console) and spiceport+pci-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev spiceport,id=charua-9874229d-d867-4932-ad28-11111111123,name=org.qemu.console.serial.0 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111123,id=ua-9874229d-d867-4932-ad28-11111111123 
-chardev spiceport,id=charua-9874229d-d867-4932-ad28-11111111124,name=org.qemu.console.serial.0 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111124,id=ua-9874229d-d867-4932-ad28-11111111124,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111123 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111124 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output



======================8. SOCKET CHARDEV
8-1. unix+isa-serial (Serial/console) and unix-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev socket,id=charua-9874229d-d867-4932-ad28-11111111125,fd=30,server,nowait 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111125,id=ua-9874229d-d867-4932-ad28-11111111125 
-chardev socket,id=charua-9874229d-d867-4932-ad28-11111111126,fd=31,server,nowait 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111126,id=ua-9874229d-d867-4932-ad28-11111111126,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111125 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111126 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output
8-2. tcp+isa-serial (Serial/console) and tcp-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev socket,id=charua-9874229d-d867-4932-ad28-11111111131,host=127.0.0.1,port=5556,tls-creds=objcharua-9874229d-d867-4932-ad28-11111111131_tls0 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111131,id=ua-9874229d-d867-4932-ad28-11111111131 -object tls-creds-x509,id=objcharua-9874229d-d867-4932-ad28-11111111132_tls0,dir=/etc/pki/libvirt-chardev,endpoint=client,verify-peer=yes 
-chardev socket,id=charua-9874229d-d867-4932-ad28-11111111132,host=127.0.0.1,port=5556,tls-creds=objcharua-9874229d-d867-4932-ad28-11111111132_tls0 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111132,id=ua-9874229d-d867-4932-ad28-11111111132,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:04 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111131 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111132 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:04 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output
8-3. unix+virtio (Channel) 
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev socket,id=charua-9874229d-d867-4932-ad28-111111111202,fd=30,server,nowait 
-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charua-9874229d-d867-4932-ad28-111111111202,id=ua-9874229d-d867-4932-ad28-111111111202,name=org.qemu.guest_agent.0 

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:05 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111202 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:05 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive |grep "<channel" -A5
No output
8-4. tcp+passthrough (Smartcard)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev socket,id=charua-9874229d-d867-4932-ad28-111111111502,host=127.0.0.1,port=2001,server,nowait,tls-creds=objcharua-9874229d-d867-4932-ad28-111111111502_tls0 
-device ccid-card-passthru,chardev=charua-9874229d-d867-4932-ad28-111111111502,id=ua-9874229d-d867-4932-ad28-111111111502,bus=ccid0.0

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:07 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111502 --config
error: Failed to detach device with alias ua-9874229d-d867-4932-ad28-111111111502
error: Operation not supported: persistent detach of device 'smartcard' is not supported

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:07 /usr/sbin/libvirtd
8-4. tcp+usb (Redir)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev socket,id=charua-9874229d-d867-4932-ad28-111111111602,host=10.66.4.201,port=4000 
-device usb-redir,chardev=charua-9874229d-d867-4932-ad28-111111111602,id=ua-9874229d-d867-4932-ad28-111111111602,bus=usb.0,port=2

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:08 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111602 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:08 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive |grep "<redir" -A10
No output


======================9. STDIO CHARDEV
9-1. stdio+isa-serial (Serial/console) 
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev stdio,id=charua-9874229d-d867-4932-ad28-11111111127 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111127,id=ua-9874229d-d867-4932-ad28-11111111127

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111125 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output
9-2. stdio-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev stdio,id=charua-9874229d-d867-4932-ad28-11111111128 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111128,id=ua-9874229d-d867-4932-ad28-11111111128,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111128 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:02 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output


======================10. TTY CHARDEV
10-1. dev+isa-serial (Serial/console) and dev-serial (Serial)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev tty,id=charua-9874229d-d867-4932-ad28-11111111129,path=/dev/ttyS0 
-device isa-serial,chardev=charua-9874229d-d867-4932-ad28-11111111129,id=ua-9874229d-d867-4932-ad28-11111111129 
-chardev tty,id=charua-9874229d-d867-4932-ad28-11111111130,path=/dev/ttyS0 
-device pci-serial,chardev=charua-9874229d-d867-4932-ad28-11111111130,id=ua-9874229d-d867-4932-ad28-11111111130,bus=pci.0,addr=0x9

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:04 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111129 --config
Device detach request sent successfully

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-11111111130 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:04 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive|grep "<serial" -A11
No output

# virsh dumpxml b2 --inactive|grep "<console" -A11
No output


======================11. SPICEVMC CHARDEV
11-1. spicevmc+virtio (Channel)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev spicevmc,id=charua-9874229d-d867-4932-ad28-111111111203,name=vdagent 
-device virtserialport,bus=virtio-serial0.0,nr=3,chardev=charua-9874229d-d867-4932-ad28-111111111203,id=ua-9874229d-d867-4932-ad28-111111111203,name=com.redhat.spice.0

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:05 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111203 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:05 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive |grep "<channel" -A5
No output
11-2. spicevmc+passthrough (Smartcard)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev spicevmc,id=charua-9874229d-d867-4932-ad28-111111111501,name=smartcard 
-device ccid-card-passthru,chardev=charua-9874229d-d867-4932-ad28-111111111501,id=ua-9874229d-d867-4932-ad28-111111111501,bus=ccid0.0

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:07 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111501 --config
error: Failed to detach device with alias ua-9874229d-d867-4932-ad28-111111111501
error: Operation not supported: persistent detach of device 'smartcard' is not supported

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:07 /usr/sbin/libvirtd
11-3. spicevmc+usb (Redir)
# virsh domstate b2
running

# ps -ef |grep "b2" |sed 's/-device/\n-device/g'
-chardev spicevmc,id=charua-9874229d-d867-4932-ad28-111111111601,name=usbredir 
-device usb-redir,chardev=charua-9874229d-d867-4932-ad28-111111111601,id=ua-9874229d-d867-4932-ad28-111111111601,bus=usb.0,port=1 

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:08 /usr/sbin/libvirtd

# virsh detach-device-alias b2 ua-9874229d-d867-4932-ad28-111111111601 --config
Device detach request sent successfully

# ps -ef |grep libvirtd |grep -v color
root      1842     1  0 01:51 ?        00:00:08 /usr/sbin/libvirtd

# virsh dumpxml b2 --inactive |grep "<redir" -A10
No output

Comment 7 jiyan 2018-07-06 08:50:11 UTC
As all the test results are as expected, move this bug to be verified.

Comment 8 jiyan 2018-07-06 09:17:31 UTC
BTW, can not test vhost-user socket Chardev now because of the following bug.
Will Try until this bug fixed.
Bug 1597940 - vhost-user socket path is not recognized by libvirt

Comment 10 errata-xmlrpc 2018-10-30 09:56:58 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, 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-2018:3113


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