Bug 1539823

Summary: libvirt should report a better error if vhost-user is not compiled into qemu
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Dan Zheng <dzheng>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.0CC: dgibson, phrdina, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-25 10:07:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Zheng 2018-01-29 17:02:48 UTC
Description of problem:
 When we try to use vhost-user, but the QEMU binary has the feature compiled out - like qemu-kvm and qemu-kvm-ma, libvirt spawns QEMU message directly. This can be enhanced in libvirt to give more meaningful message.

Version-Release number of selected component (if applicable):
qemu-kvm-ma-2.10.0-17.el7.ppc64le
libvirt-3.9.0-9.el7.ppc64le
kernel-4.14.0-25.el7a.ppc64le

How reproducible:
100%

Steps to Reproduce:
1. Edit /etc/default/grub
Append "numa=off" and "hugepages=1024" (enable the hugepage and disable numa)
2. Run "grub2-mkconfig -o /boot/grub2/grub.cfg"
3. Reboot the guest( Run "reboot")
4. Set selinux
Run "setenforce 0 " (bug1278495)
5. Run the shell scripts:
***********************
#!/bin/bash

set -e
set -x
echo "killing old ovs process"
pkill -f ovs- || true
pkill -f ovsdb || true

echo "probing ovs kernel module"
modprobe -r openvswitch || true
modprobe openvswitch

echo "clean env"
DB_FILE=/etc/openvswitch/conf.db
rm -rf /var/run/openvswitch
mkdir /var/run/openvswitch
rm -f $DB_FILE

echo "init ovs db and boot db server"
export DB_SOCK=/var/run/openvswitch/db.sock
ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema
ovsdb-server --remote=punix:$DB_SOCK --remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detach --log-file
ovs-vsctl --no-wait init

echo "start ovs vswitch daemon"
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem="4096"
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask="0x1010000000000"
ovs-vswitchd unix:$DB_SOCK --pidfile --detach --log-file=/var/log/openvswitch/ovs-vswitchd.log --verbose

echo "creating bridge and ports"
ovs-vsctl --if-exists del-br br0
ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev 
ovs-vsctl add-port br0 vhost-vm1 -- set Interface vhost-vm1 type=dpdkvhostuser 
ovs-vsctl add-port br0 vhost-vm2 -- set Interface vhost-vm2 type=dpdkvhostuser
ip add add 192.168.2.1/24 dev br0; ip link set dev br0 up

***********************
# chown qemu:qemu /var/run/openvswitch/vhost-vm*

6. Define one guest (Reminder: the guest name. the disk source, the interface mac, the interface source path need to change) (Warning: "mrg_rxbuf='off'" is a must)
***************************
<domain type='kvm'>
  <name>vm1</name>
  <memory unit='KiB'>3145728</memory>
  <currentMemory unit='KiB'>3145728</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='16' unit='M' nodeset='0'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='ppc64le' machine='pseries'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
  </os>
  <cpu mode='host-model'>
    <model fallback='allow'/>
    <topology sockets='2' cores='1' threads='1'/>
    <numa>
      <cell id='0' cpus='0-1' memory='3145728' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='?????????????????.qcow2'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
    </disk>
    <interface type='vhostuser'>
      <mac address='00:00:00:00:00:01'/>
      <source type='unix' path='/var/run/openvswitch/vhost-vm1' mode='client'/>
       <model type='virtio'/>
      <driver queues='2'>
        <host mrg_rxbuf='off'/>
      </driver>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
  </devices>
</domain>
*******************

7. Start the guest
# virsh start dpdk1
error: Failed to start domain dpdk1
error: internal error: qemu unexpectedly closed the monitor: 2018-01-25T08:40:41.859965Z qemu-kvm: -netdev vhost-user,chardev=charnet0,queues=2,id=hostnet0: Parameter 'type' expects a netdev backend type

Actual results:
See step 7.

Expected results:
Libvirt can display more meaningful message.

Additional info:

Comment 5 David Gibson 2020-05-18 05:30:11 UTC
Dan,

I don't think this problem is POWER specific.  Can you check it on x86?

Comment 6 Dan Zheng 2020-05-22 06:18:32 UTC
David,
vhost-user is supported in RHEL-AV 8.2 on x86_64. So I can not reproduce this issue on x86_64.
And this issue only happens with certain qemu-kvm versions (qemu-kvm-ma on RHEL7-ALT) without vhost-user compiled in. 
According to bz1516114, vhost-user is already supported by qemu-kvm on RHEL8-AV. So this issue should not be reproduced any more.

Comment 7 David Gibson 2020-05-25 03:10:26 UTC
Ok, thanks for the explanation Dan.

Given that this bug is going to become irrelevant and is fairly cosmetic to begin with, I'm not sure it's worth bothering with.

Pavel, it's your choice, but no objection from me if you want to close this as WONTFIX.

Comment 8 Pavel Hrdina 2020-05-25 10:07:16 UTC
Works for me David.  Based on the comments closing this BZ as WONTFIX.