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 1155458 - libvirt can not save mode='client' of vhostuser interface to domain xml
Summary: libvirt can not save mode='client' of vhostuser interface to domain xml
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-22 07:38 UTC by Hu Jianwei
Modified: 2015-03-05 07:46 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.8-6.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:46:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Hu Jianwei 2014-10-22 07:38:23 UTC
Description
libvirt can not save mode='client' of vhostuser interface to domain xml

Version:
libvirt-1.2.8-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
[root@localhost ~]# virsh edit r7
    <interface type='vhostuser'>
      <mac address='52:54:00:3b:83:1a'/>
      <source type='unix' path='/var/lib/libvirt/qemu/vhost.sock' mode='client'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
 
[root@localhost ~]# virsh dumpxml r7| grep "/interface" -B6
    </controller>
    <interface type='vhostuser'>
      <mac address='52:54:00:3b:83:1a'/>
      <source type='unix' path='/var/lib/libvirt/qemu/vhost.sock'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
[root@localhost ~]# time virsh start r7
error: Failed to start domain r7
error: internal error: No <source> 'mode' attribute specified with <interface type='vhostuser'/>


real        0m0.024s
user        0m0.019s
sys        0m0.001s

Actual results:
As above shown steps, the mode='client' will be discarded.

Expected results:
The mode='client' can be save successfully

Just like:
[root@localhost x86_64]# virsh dumpxml r7| grep "/interface" -B5
    <interface type='vhostuser'>
      <mac address='52:54:00:3b:83:1a'/>
      <source type='unix' path='/var/lib/libvirt/qemu/vhost.sock' mode='client'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Additional info:
>From file:///usr/share/doc/libvirt-docs-1.2.8/html/formatdomain.html
The <source> element has to be specified along with the type of char device. Currently, only type='unix' is supported, where the path (the directory path of the socket) and mode attributes are required. Both mode='server' and mode='client' are supported. vhost-user requires the virtio model type, thus the <model> element is mandatory.

Comment 1 Hu Jianwei 2014-10-22 07:45:56 UTC
I found a upstream commit can fix the bug.
https://www.redhat.com/archives/libvir-list/2014-October/msg00502.html

commit 302720742f6e159af45631475d720cf807e905b9
Author: Maxime Leroy <maxime.leroy>
Date:   Fri Oct 17 18:45:18 2014 +0200

    conf: tests: fix virDomainNetDefFormat for vhost-user in client mode
    
    The mode attribute is required for the source element of vhost-user.
    Thus virDomainNetDefFormat should always generate a xml with it and not
    only when the mode is server.
    
    The commit fixes the issue. And it adds a vhostuser interface in
    'client' mode to qemuxml2argv-net-vhostuser.(args|xml) to test this
    usecase.

Comment 5 Hu Jianwei 2014-11-05 15:34:19 UTC
I can not reproduce the bug using libvirt-1.2.8-6.el7.x86_64

Version:
libvirt-1.2.8-6.el7.x86_64
qemu-kvm-1.5.3-77.el7.x86_64
kernel-3.10.0-187.el7.x86_64

[root@ibm-x3850x5-06 ~]# virsh dumpxml r7 | grep "/interface" -B5
    <interface type='vhostuser'>
      <mac address='52:54:00:3b:83:1a'/>
      <source type='unix' path='/var/lib/libvirt/qemu/vhost.sock' mode='client'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Question:
But the domain can not boot up.
<1> When we have a server which is running
[root@ibm-x3850x5-06 ~]#  virsh dumpxml test | grep "/interface" -B5
    <interface type='vhostuser'>
      <mac address='52:54:00:3b:83:1a'/>
      <source type='unix' path='/var/lib/libvirt/qemu/vhost.sock' mode='server'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
[root@ibm-x3850x5-06 ~]# virsh start test
      <======The domain is waiting for the client,please refer to Bug 1156267.

[root@ibm-x3850x5-06 ~]# virsh start r7
error: Failed to start domain r7
error: internal error: process exited while connecting to monitor: 2014-11-05T15:11:58.707970Z qemu-kvm: -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock: Failed to connect to socket: Permission denied
2014-11-05T15:11:58.708122Z qemu-kvm: -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock: chardev: opening backend "socket" failed

<2> When have no server
[root@ibm-x3850x5-06 ~]# virsh start r7
error: Failed to start domain r7
error: internal error: process exited while connecting to monitor: 2014-11-05T15:24:45.329499Z qemu-kvm: -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock: Failed to connect to socket: Connection refused
2014-11-05T15:24:45.329642Z qemu-kvm: -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock: chardev: opening backend "socket" failed

For scenario <1> above, why can not domain start? Is it a bug?
For scenario <2> above, I think it's expected, do you agree?

Full log for scenario <1>:
[root@ibm-x3850x5-06 ~]# cat /var/log/libvirt/qemu/r7.log
2014-11-05 15:13:22.820+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name r7 -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid a70da21c-ffe1-4dca-b348-62e44035a6b6 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/r7.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device ahci,id=ahci0,bus=pci.0,addr=0x7 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/libvirt/images/r7.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock -netdev type=vhost-user,id=hostnet0,chardev=charnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:3b:83:1a,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5901,addr=127.0.0.1,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device usb-host,hostbus=6,hostaddr=2,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on
2014-11-05T15:13:22.864095Z qemu-kvm: -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock: Failed to connect to socket: Permission denied
2014-11-05T15:13:22.864234Z qemu-kvm: -chardev socket,id=charnet0,path=/var/lib/libvirt/qemu/vhost.sock: chardev: opening backend "socket" failed
2014-11-05 15:13:23.037+0000: shutting down

Comment 6 Pavel Hrdina 2014-11-06 16:30:48 UTC
Yes for the scenario <2> the error is expected.

For the scenario <1> there is a missing selinux policy that allows guest connect to existing unix_socket_stream. I've created a Bug 1161217 to track the issue for selinux-policy component.

Comment 7 Hu Jianwei 2014-11-06 17:18:49 UTC
(In reply to Pavel Hrdina from comment #6)
> Yes for the scenario <2> the error is expected.
> 
> For the scenario <1> there is a missing selinux policy that allows guest
> connect to existing unix_socket_stream. I've created a Bug 1161217 to track
> the issue for selinux-policy component.

OK, thanks.

Comment 8 Hu Jianwei 2014-11-06 17:20:19 UTC
According to comment 5 and 6, we can get expected results, so change to Verified.

Comment 10 errata-xmlrpc 2015-03-05 07:46:30 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://rhn.redhat.com/errata/RHSA-2015-0323.html


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