Bug 1627781

Summary: virsh domiflist return NULL for the vhostuser interface name and source [rhel-7.4.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: chhu
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: chhu, dyuan, jherrman, jraju, jsuchane, lmen, mabaakou, mprivozn, rbalakri, rhodain, xuzhang, yalzhang
Target Milestone: rcKeywords: Upstream, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.2.0-14.el7_4.12 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.
Story Points: ---
Clone Of: 1459091 Environment:
Last Closed: 2018-09-25 20:46:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1459091    
Bug Blocks:    

Description Oneata Mircea Teodor 2018-09-11 13:01:35 UTC
This bug has been copied from bug #1459091 and has been proposed to be backported to 7.4 z-stream (EUS).

Comment 7 yalzhang@redhat.com 2018-09-13 09:26:28 UTC
Hi Michal, please help to confirm below questions:

1. In step 2-3), if there is a pre-set "target dev" in the inactive xml, after start vm, it will be override, is it expected and acceptable?

2. The bug description says "...return NULL for... interface name and source", currently, the interface name is exposed, but the source is still null. Is it acceptable?


1. Reproduce on libvirt-3.2.0-14.el7.x86_64:

1)start vm with xml without "target dev", such as:
# virsh dumpxml vhostuser1 --inactive| grep /interface -B5
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh start vhostuser1

2) check the live xml, still no "target dev", and the domiflist show null for Interface and Source:
# virsh dumpxml vhostuser1 | grep /interface -B6
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh domiflist vhostuser1
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          vhostuser  -          virtio      52:54:00:93:51:dd

2. update libvirt to libvirt-3.2.0-14.el7_4.12.x86_64, then restart libvirtd, and do destroy -> start for the guest:

1) the "target dev" is added automatically into the live xml, and it is the same as the socket name:
# virsh  dumpxml vhostuser1 | grep /interface -B7
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
      <target dev='vhost-user2'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2) The "Interface" is the same as "target dev" in the 1) step;
# virsh domiflist vhostuser1 
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vhost-user2 vhostuser  -          virtio      52:54:00:93:51:dd


3) set "target dev" in the xml, then start guest:
# virsh dumpxml vhostuser1 | grep /interface -B6
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
      ** <target dev='myguest'/> **
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh domiflist vhostuser1
Interface  Type       Source     Model       MAC
-------------------------------------------------------
** vhost-user2 ** vhostuser  -          virtio      52:54:00:93:51:dd

after guest start, the "target dev" in the live xml changed:
# virsh dumpxml vhostuser1 | grep /interface -B7
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
     ** <target dev='vhost-user2'/> **
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Comment 8 Michal Privoznik 2018-09-13 10:02:29 UTC
(In reply to yalzhang from comment #7)
> Hi Michal, please help to confirm below questions:
> 
> 1. In step 2-3), if there is a pre-set "target dev" in the inactive xml,
> after start vm, it will be override, is it expected and acceptable?

Yes. Keeping "target dev" would make no sense because that is not what ovs call the interface. We have to report the actual name that ovs uses.

> 
> 2. The bug description says "...return NULL for... interface name and
> source", currently, the interface name is exposed, but the source is still
> null. Is it acceptable?

Yes, this was never reported. Nor even when 7.5 bug was verified:

https://bugzilla.redhat.com/show_bug.cgi?id=1459091#c8

Comment 9 chhu 2018-09-18 07:22:01 UTC
Verified with packages:
libvirt-3.2.0-14.el7_4.12.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.18.x86_64

Test steps:
1. Start guest with vhostuser interface successfully.
# virsh start vhostuser1
Domain vhostuser1 started

# virsh dumpxml vhostuser1|grep interface -A 10
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <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>

2. Check the virsh domiflist, the "Interface" is listed. For the "Source" use Bug 1630143 to track.

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

3. Check the virsh domifstat:
# virsh domifstat vhostuser1 vhost-user1
vhost-user1 rx_bytes 762322076
vhost-user1 rx_packets 515304
vhost-user1 rx_drop 747
vhost-user1 tx_bytes 556820974
vhost-user1 tx_packets 384243
vhost-user1 tx_errs 0

Comment 10 chhu 2018-09-18 07:30:46 UTC
According the comment7,8,9 set the bug status to "VERIFIED".

Comment 12 errata-xmlrpc 2018-09-25 20:46:11 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/RHBA-2018:2780