Bug 1266982

Summary: libvirt should emit warning/error if vhostuser network device is used, but shared memory is not configured
Product: Red Hat Enterprise Linux 7 Reporter: Aaron Conole <aconole>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: chhu, dyuan, jhsiao, lhuang, mkletzan, mzhan, rbalakri
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:25:21 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 Aaron Conole 2015-09-28 17:52:04 UTC
Description of problem:

When starting a domain which is set to use a vhostuser, if hugepages are not configured to be shared in the numa config of the <cpu/> tag, network packets will not flow. However, it is possible to warn that this may happen (since the situation can be detected).

Version-Release number of selected component (if applicable):
libvirt 1.2.8
qemu-kvm 2.2.0

How reproducible:
100%

Steps to Reproduce:
1. build a libvirt domain which uses vhostuser and non-shared memory
2. bring up the domain (virsh start dom0)
3. domain boots

Actual results:
domain startup does not issue a warning that vhostuser interfaces do not have host-guest shared memory configured.

Expected results:
at least a warning should be issued that vhostuser interfaces require guest-host shared memory.

Comment 2 Martin Kletzander 2015-11-12 11:54:19 UTC
I don't think this should be handled in libvirt.  We are trying to enable most of the options that the hypervisor supports.  We cannot hence check if all settings make sense for each possible scenario.  In this case the user can use different shared memory for the application.  Whether this is part of bigger deployment or not, the management application (or user) should create configuration sensible for its use case.

Let me know if you disagree, but I'm most probably going to close this as a NOTABUG.

Comment 3 Aaron Conole 2015-11-23 19:06:30 UTC
"In this case the user can use different shared memory for the application." I don't know what that means, can you explain? Without guest-host shared memory configured in the XML, what else can the user do for their vhostuser ports to start working? Is there some post-start command or switch? AFAIK, none exists - but if it does that would be good to know because it would mean no warning is needed. However, without such a post-start command or switch, the user has configured network interfaces which can never work.

Please let me know if I'm mistaken.

Comment 4 Martin Kletzander 2015-11-24 09:04:03 UTC
I think you might be able to use ivshmem for that as well (element <shmem/> in libvirt's XML), but even if not, that can happen in the future and we would limit user and ourselves in that regard.  As a compromise, I think the best option would be to emit a warning in the log, so users searching for that will find it, but on the other hand it will not limit them in doing so.  It *may* be also usable for testing, etc.

Comment 5 Aaron Conole 2015-11-25 15:16:04 UTC
"As a compromise, I think the best option would be to emit a warning in the log,"

No compromise needed - the warning log is what I want :)

Comment 6 Martin Kletzander 2015-12-08 15:25:43 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2015-December/msg00306.html

Comment 7 Martin Kletzander 2015-12-14 10:36:23 UTC
Fixed upstream by v1.3.0-62-g686eb7a24f7d:

commit 686eb7a24f7d71048f5cd45bb0095a63d0787875
Author: Martin Kletzander <mkletzan>
Date:   Tue Dec 8 14:15:47 2015 +0100

    qemu: Warn when using vhost-user without shared memory

Comment 9 chhu 2016-08-15 08:27:03 UTC
Verified with packages:
qemu-kvm-rhev-2.6.0-19.el7.x86_64
libvirt-2.0.0-4.el7.x86_64

1. Start a VM with vhostuser network device but shared memory is not configured.
# virsh start r7
Domain r7 started
# virsh dumpxml r7
<domain type='kvm' id='6'>
  <name>r7</name>
  <uuid>ea6b3d7e-eb8e-42df-8b32-e8101d887983</uuid>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>5</vcpu>
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
......
  <cpu mode='host-model'>
    <model fallback='allow'/>
    <numa>
      <cell id='0' cpus='0-1' memory='1024000' unit='KiB'/>
    </numa>
  </cpu>
......
    <interface type='vhostuser'>
      <mac address='52:54:00:bb:25:74'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. Check there is warning in the libvirtd.log:
2016-08-11 07:04:40.987+0000: 14130: debug : qemuProcessStartValidate:4390 : Checking for any possible (non-fatal) issues
2016-08-11 07:04:40.987+0000: 14130: warning : qemuProcessStartWarnShmem:4315 : Detected vhost-user interface without any shared memory, the interface might not be operational

Comment 11 errata-xmlrpc 2016-11-03 18:25:21 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-2016-2577.html