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 1459091 - virsh domiflist return NULL for the vhostuser interface name and source
Summary: virsh domiflist return NULL for the vhostuser interface name and source
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: chhu
URL:
Whiteboard:
Depends On:
Blocks: 1397940 1473046 1627781
TreeView+ depends on / blocked
 
Reported: 2017-06-06 09:19 UTC by chhu
Modified: 2021-12-10 15:05 UTC (History)
9 users (show)

Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: Bug Fix
Doc Text:
Prior to this update, the name of vhostuser interfaces were in some cases missing from XML configurations of virtual machines (VMs). Now, vhostuser interfaces are queried during VM startup instead of during VM defining, and the interface names are thus set up in the XM configuration correctly.
Clone Of:
: 1627781 (view as bug list)
Environment:
Last Closed: 2018-04-10 10:46:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3549532 0 None None None 2018-08-01 11:19:11 UTC
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:48:00 UTC

Internal Links: 1767013

Description chhu 2017-06-06 09:19:36 UTC
Description of problem:
virsh domiflist return NULL for the vhostuser interface name and source

Version-Release number of selected component (if applicable):
libvirt-3.2.0-7.el7.x86_64
qemu-kvm-rhev-2.9.0-7.el7.x86_64
kernel-3.10.0-677.el7.x86_64

Test steps:
1. Prepare guest with xml:

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB'/>
    </hugepages>
  </memoryBacking>
  ......
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Broadwell</model>
    ......
    <feature policy='require' name='abm'/>
    <numa>
      <cell id='0' cpus='0-1' memory='1048576' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>
  ......
    <interface type='vhostuser'>
      <mac address='52:54:01:93:55b'/>
      <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='0x08' function='0x0'/>
    </interface>

2. Start the guests with vhostuser interface
#virsh start r7-4t1
Domain r7-4t1 started

#virsh list --all
 Id    Name                           State
----------------------------------------------------
 6     r7-4t1                         running

#virsh dumpxml r7-4t1| grep interface -A 10
    <interface type='vhostuser'>
      <mac address='52:54:01:93:55b'/>
      <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='0x08' function='0x0'/>
    </interface>

#ps -ef|grep qemu-kvm| grep vhost
qemu       7408      1  0 May22 ?        00:03:12 /usr/libexec/qemu-kvm -name guest=r7-4t1,debug-threads=on
-S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-8-r7-4t1/master-key.aes
-machine pc-i440fx-rhel7.4.0,accel=kvm,usb=off,dump-guest-core=off
......
-chardev socket,id=charnet0,path=/var/run/openvswitch/vhost-user1 -netdev vhost-user,chardev=charnet0,id=hostnet0
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:01:93:55b,bus=pci.0,addr=0x8 -chardev pty,id=charserial0
......

3. Check the virsh domiflist: no Interface is listed
#virsh domiflist r7-4t1
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          vhostuser  -          virtio      52:54:01:93:55b

4. Can't get the network statistics by `virsh domifstat <domain> <interface>`
#virsh domifstat r7-4t1 vhostuser1
error: Failed to get interface stats r7-4t1 vhostuser1
error: invalid argument: invalid path, 'vhostuser1' is not a known interface

# virsh domifstat r7-4t1 vhostuser
error: Failed to get interface stats r7-4t1 vhostuser
error: invalid argument: invalid path, 'vhostuser' is not a known interface

#virsh domifstat r7-4t1 eth0
error: Failed to get interface stats r7-4t1 eth0
error: invalid argument: invalid path, 'eth0' is not a known interface


Actual results:
In step3, the virsh domiflist return NULL for the vhostuser interface name and source

Expected results:
In step3, the virsh domiflist return the vhostuser interface name and source

Comment 2 Mehdi ABAAKOUK 2017-06-06 09:49:40 UTC
I'm guessing this commit is missing: http://libvirt.org/git/?p=libvirt.git;a=commit;h=57b5e27d3d74f8dbb77ac909b405d99d555eca46

Comment 3 Jaroslav Suchanek 2017-06-06 10:37:35 UTC
(In reply to Mehdi ABAAKOUK from comment #2)
> I'm guessing this commit is missing:
> http://libvirt.org/git/?p=libvirt.git;a=commit;
> h=57b5e27d3d74f8dbb77ac909b405d99d555eca46

Build libvirt-3.2.0-7.el7 contains that commit. Something else might be missing.

Comment 4 Jaroslav Suchanek 2017-06-07 14:10:25 UTC
Per comment https://bugzilla.redhat.com/show_bug.cgi?id=1397940#c10 I am
moving this one to rhel-7.5.

Comment 5 Michal Privoznik 2017-06-07 15:42:09 UTC
Patches proposed upstream:

https://www.redhat.com/archives/libvir-list/2017-June/msg00392.html

Comment 6 Michal Privoznik 2017-06-08 13:24:44 UTC
I've pushed patches online:

commit f3908d8557dc609e2262099d76c57b0bcc4b0917
Author:     Michal Privoznik <mprivozn>
AuthorDate: Thu Jun 8 14:58:22 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 8 15:02:23 2017 +0200

    virNetDevOpenvswitchGetVhostuserIfname: Fix off by one error
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1459091
    
    We try to get the last element of the passed path by calling
    strrch(path, '/'). However, the pointer that strrchr() returns
    points at the slash, We want string that starts right after that.
    
    Signed-off-by: Michal Privoznik <mprivozn>

commit 2a13a0a103340878b05a5ae0b9f454721f67dbb3
Author:     Michal Privoznik <mprivozn>
AuthorDate: Wed Jun 7 15:43:58 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 8 15:02:22 2017 +0200

    qemu: Query for vhostuser iface names at runtime
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1459091
    
    Currently, we are querying for vhostuser interface name in post
    parse callback. At that time interface might not yet exist.
    However, it has to exist when starting domain. Therefore it makes
    more sense to query its name at that point. This partially
    reverts 57b5e27.
    
    Signed-off-by: Michal Privoznik <mprivozn>

v3.4.0-66-gf3908d855

Comment 8 yalzhang@redhat.com 2017-09-28 02:16:15 UTC
Test on libvirt-3.7.0-2.el7.x86_64, the result is as expected, set this bug to be verified.


1. start the guest with vhostuser interface without <target dev=...> element, check the xml

# virsh dumpxml vhost1 --inactive | grep /interface -B5
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:db'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

<== no <target dev=...> set in inactive xml

# virsh dumpxml vhost1 | grep /interface -B7
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:db'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <target dev='vhost-user1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

<== the "<target dev='vhost-user1'/>" will generate automatically in the active xml

2. domiflist get the interface name

# virsh domiflist vhost1
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vhost-user1 vhostuser  -          virtio      52:54:00:93:51:db

# virsh domiflist vhost1 --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          vhostuser  -          virtio      52:54:00:93:51:db


3. set <target dev> in xml

# virsh dumpxml vhost1 --inactive | grep /interface -B6
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:db'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <target dev='blah'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

<=== set <target dev='blah'/> in xml

# virsh dumpxml vhost1  | grep /interface -B7
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:db'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <target dev='vhost-user1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

<=== when the vm start, the target dev will be override


4. check by domiflist for the interface name

# virsh domiflist vhost1
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vhost-user1 vhostuser  -          virtio      52:54:00:93:51:db

# virsh domiflist vhost1 --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
blah       vhostuser  -          virtio      52:54:00:93:51:db


# virsh domifstat vhost1  blah
error: Failed to get interface stats vhost1 blah
error: invalid argument: invalid path, 'blah' is not a known interface

# virsh domifstat vhost1  vhost-user1
vhost-user1 rx_bytes 132144
vhost-user1 rx_packets 1375
vhost-user1 rx_drop 0
vhost-user1 tx_bytes 133096
vhost-user1 tx_packets 1387
vhost-user1 tx_errs 0
vhost-user1 tx_drop 0

Comment 12 errata-xmlrpc 2018-04-10 10:46:43 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/RHEA-2018:0704


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