Bug 1630164 - virsh domiflist/domifstat return NULL(Interface & Source)/error for attached vhostuser interface
Summary: virsh domiflist/domifstat return NULL(Interface & Source)/error for attached ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.0
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
: 1630143 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-18 06:16 UTC by chhu
Modified: 2020-03-11 22:32 UTC (History)
6 users (show)

Fixed In Version: libvirt-5.0.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-11 22:32:55 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
The ovs env preparation script (2.24 KB, application/x-shellscript)
2019-06-10 13:15 UTC, yalzhang@redhat.com
no flags Details

Description chhu 2018-09-18 06:16:41 UTC
Description of problem:
virsh domiflist return NULL(Interface & Source) for attached vhostuser interface

Version-Release number of selected component (if applicable):
libvirt-4.5.0-9.el7.x86_64
qemu-kvm-rhev-2.12.0-15.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
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>
    ......
    <numa>
      <cell id='0' cpus='0-1' memory='1048576' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>
  ......
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:dd'/>
      <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 vhostuser1
Domain vhostuser1 started

3. Attach another interface to the guest successfully. Login to the guest, there are two interfaces.
# cat i2.xml
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:db'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
      <model type='virtio'/>
    </interface>

# virsh attach-device vhostuser1 i2.xml
Device attached successfully

4. Check the virsh domiflist for the second interface, the "Interface" and "Source" are NULL.

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

Actual results:
In step4: the "Interface" and "Source" are NULL.

Expected results:
In step4: the "Interface" and "Source" are not NULL.

Additional info:

Comment 2 chhu 2018-09-18 06:39:41 UTC
Step 5: Test for domifstat:

Check the domifstat, get info for the first interface, failed to get info for the attached interface.

# virsh domifstat vhostuser1 52:54:00:93:51:dd  => vhost-user1
52:54:00:93:51:dd rx_bytes 20518
52:54:00:93:51:dd rx_packets 121
52:54:00:93:51:dd rx_drop 0
52:54:00:93:51:dd tx_bytes 195314
52:54:00:93:51:dd tx_packets 1175
52:54:00:93:51:dd tx_errs 0
52:54:00:93:51:dd tx_drop 0

# virsh domifstat vhostuser1 52:54:00:93:51:db
error: Failed to get interface stats vhostuser1 52:54:00:93:51:db
error: internal error: Interface not found

Comment 3 Michal Privoznik 2018-09-18 08:48:13 UTC
(In reply to chhu from comment #0)

> Expected results:
> In step4: the "Interface" and "Source" are not NULL.
> 

I can see why "Interface" shouldn't be NULL. However, I'm not sure what do you want to see under "Source". For other types we display source bridge, device, network there. Is the unix socket acceptable?

Comment 4 Michal Privoznik 2018-09-18 08:57:01 UTC
*** Bug 1630143 has been marked as a duplicate of this bug. ***

Comment 5 chhu 2018-09-20 05:27:33 UTC
(In reply to Michal Privoznik from comment #3)
> (In reply to chhu from comment #0)
> 
> > Expected results:
> > In step4: the "Interface" and "Source" are not NULL.
> > 
> 
> I can see why "Interface" shouldn't be NULL. However, I'm not sure what do
> you want to see under "Source". For other types we display source bridge,
> device, network there. Is the unix socket acceptable?

Currently, only type='unix' is supported. But I'm not sure if customer will have other requirement later. I think unix socket is OK now. Or we can use Bug 1630143 to mark this issue, and fix the "Interface" in this bug. Thank you!

Comment 6 Michal Privoznik 2018-09-20 06:08:20 UTC
(In reply to chhu from comment #5)
> (In reply to Michal Privoznik from comment #3)
> > (In reply to chhu from comment #0)
> > 
> > > Expected results:
> > > In step4: the "Interface" and "Source" are not NULL.
> > > 
> > 
> > I can see why "Interface" shouldn't be NULL. However, I'm not sure what do
> > you want to see under "Source". For other types we display source bridge,
> > device, network there. Is the unix socket acceptable?
> 
> Currently, only type='unix' is supported. But I'm not sure if customer will
> have other requirement later. I think unix socket is OK now. Or we can use
> Bug 1630143 to mark this issue, and fix the "Interface" in this bug. Thank
> you!

Returning "unix" is not much helpful. For instance, this is output from a domain I have:

# virsh -q domiflist fedora
-          network    default    virtio      52:54:00:a4:6f:91

"network default" gives me all the information I am looking for. "vhostuser unix" doesn't. However, "vhostuser /path/to/unix/socket" is better. So I think we need to go with this one.

Comment 7 chhu 2018-09-20 06:44:26 UTC
(In reply to Michal Privoznik from comment #6)
> (In reply to chhu from comment #5)
> > (In reply to Michal Privoznik from comment #3)
> 
> Returning "unix" is not much helpful. For instance, this is output from a
> domain I have:
> 
> # virsh -q domiflist fedora
> -          network    default    virtio      52:54:00:a4:6f:91
> 
> "network default" gives me all the information I am looking for. "vhostuser
> unix" doesn't. However, "vhostuser /path/to/unix/socket" is better. So I
> think we need to go with this one.

I agree, "vhostuser /path/to/unix/socket" provide more information!

Comment 8 Michal Privoznik 2018-09-21 11:04:26 UTC
Patches posted upstream:

https://www.redhat.com/archives/libvir-list/2018-September/msg01139.html

Comment 9 Michal Privoznik 2018-09-21 13:19:10 UTC
To POST:

commit c846767bfaea8ea0e7b57001a3d0563ad75562cc
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue Sep 18 11:01:53 2018 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Fri Sep 21 15:01:29 2018 +0200

    virsh: Display vhostuser socket path in domiflist
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1630164
    
    The domiflist command is designed to show a brief information on
    domain interfaces. One piece of information that is shows is
    "Source" - source network, device, name, bridge. However, it's
    ignoring vhostuser for which we can show the unix socket it's
    associated with.
    
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Andrea Bolognani <abologna>

commit c88ef717c83a148062192239c94e2008c57bfa0f
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue Sep 18 10:59:05 2018 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Fri Sep 21 14:59:35 2018 +0200

    qemu_hotplug: Fetch vhostuser ifname on hotplug
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1630164
    
    Since 2a13a0a1033 we are querying the vhostuser's interface name
    when building qemu command line. However, we forgot to do so on
    hotplug.
    
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Andrea Bolognani <abologna>


v4.7.0-196-gc846767bfa

Comment 10 yalzhang@redhat.com 2019-06-10 13:15:23 UTC
Created attachment 1579031 [details]
The ovs env preparation script

Hi Michal, I found that once the DB_SOCK directory is not "/var/run/openvswitch/db.sock", the 'domiflist' cmd can not get the interface name. Could you please help to check if this is expected?

(test on libvirt-4.5.0-21.el7.x86_64 with the fix of bug 1459091)
# virsh domiflist vhostuser1_vm
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          vhostuser  -          virtio      52:54:00:93:51:db

After change the "export DB_SOCK=/var/tmp/avocado_FhP0N7/openvswitch/db.sock" in the script to "export DB_SOCK=/var/run/openvswitch/db.sock", it can get the interface name:
# virsh domiflist vhostuser1_vm
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vhost-user1 vhostuser  -          virtio      52:54:00:93:51:db

Comment 11 Michal Privoznik 2019-06-13 08:09:19 UTC
(In reply to yalzhang from comment #10)
> Created attachment 1579031 [details]
> The ovs env preparation script
> 
> Hi Michal, I found that once the DB_SOCK directory is not
> "/var/run/openvswitch/db.sock", the 'domiflist' cmd can not get the
> interface name. Could you please help to check if this is expected?
> 
> (test on libvirt-4.5.0-21.el7.x86_64 with the fix of bug 1459091)
> # virsh domiflist vhostuser1_vm
> Interface  Type       Source     Model       MAC
> -------------------------------------------------------
> -          vhostuser  -          virtio      52:54:00:93:51:db
> 
> After change the "export
> DB_SOCK=/var/tmp/avocado_FhP0N7/openvswitch/db.sock" in the script to
> "export DB_SOCK=/var/run/openvswitch/db.sock", it can get the interface name:
> # virsh domiflist vhostuser1_vm
> Interface  Type       Source     Model       MAC
> -------------------------------------------------------
> vhost-user1 vhostuser  -          virtio      52:54:00:93:51:db

What's your libvirt version? With the current git HEAD libvirt tries to get vhostuser interface name when starting the domain up. It does this by contacting ovs daemon. So are you restarting the domain between these two runs? Because looking into the code, once we get the interface name we store it and it is not updated on 'dumpxml' (which is what domiflist is effectively doing).

Comment 12 yalzhang@redhat.com 2019-06-17 10:06:42 UTC
Comment 10 is tested on libvirt-4.5.0-22.el7.x86_64.

No, I didn't restart the domain, I did destroy-start for the domain between these two runs. 

I also test it on rhel8 libvirt-5.0.0-10.module+el8.0.1+3363+49e420ce.x86_64, if I change the path of the db.sock, it can not get the interface name either.

Details for test on libvirt-5.0.0-10.module+el8.0.1+3363+49e420ce.x86_64:
1.Check the script as attached:
# cat ovs_env.sh
...
export DB_SOCK=/var/run/openvswitch/db.sock
#export DB_SOCK=/var/tmp/avocado_FhP0N7/openvswitch/db.sock
...

# ./ovs_env.sh

2. Start the vm with interface as below:

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

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

3. Edit the script to update the path of the db.sock:
# cat ovs_env.sh 
...
#export DB_SOCK=/var/run/openvswitch/db.sock
export DB_SOCK=/var/tmp/avocado_FhP0N7/openvswitch/db.sock
...

# virsh destroy vhostuser1
Domain vhostuser1 destroyed

# ./ovs_env.sh

# virsh start vhostuser1
Domain vhostuser1 started

# virsh domiflist vhostuser1
 Interface   Type        Source                             Model    MAC
----------------------------------------------------------------------------------------
 -           vhostuser   /var/run/openvswitch/vhost-user1   virtio   52:54:00:93:51:dd
=========> the interface name is null if set db.sock to patch other than /var/run/openvswitch/db.sock

Comment 13 yalzhang@redhat.com 2019-06-17 10:10:08 UTC
Maybe we can find clues in bug 1459091

Comment 15 yalzhang@redhat.com 2019-07-09 06:08:27 UTC
Test on libvirt-5.0.0-11.module+el8.0.1+3459+e357ef2f.x86_64:

1. Start guest with vhostuser type interface, then check the domiflist output:

# virsh domiflist rhel
 Interface     Type        Source                             Model    MAC
------------------------------------------------------------------------------------------
 vhost-user2   vhostuser   /var/run/openvswitch/vhost-user2   virtio   52:54:00:93:51:dd

# virsh domiflist rh
 Interface     Type        Source                             Model    MAC
------------------------------------------------------------------------------------------
 vhost-user1   vhostuser   /var/run/openvswitch/vhost-user1   virtio   52:54:00:93:51:db

# virsh domifstat rhel vhost-user2
vhost-user2 rx_bytes 195522
vhost-user2 rx_packets 1175
vhost-user2 rx_drop 0
vhost-user2 tx_bytes 188570
vhost-user2 tx_packets 1129
vhost-user2 tx_errs 0
vhost-user2 tx_drop 0

2. Start a guest without any vhostuser type interface, then test hotplug:
# virsh  attach-device rhel interface.xml
Device attached successfully

# virsh domiflist rhel
 Interface     Type        Source                             Model    MAC
------------------------------------------------------------------------------------------
 vhost-user2   vhostuser   /var/run/openvswitch/vhost-user2   virtio   52:54:00:93:51:db

# virsh dumpxml rhel | grep /interface -B7
    <interface type='vhostuser'>
      <mac address='52:54:00:93:51:db'/>
      <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='0x01' slot='0x00' function='0x0'/>
    </interface>

Comment 16 Jeff Nelson 2020-03-11 22:32:55 UTC
This was verified and shipped long ago. Closing the bug report.


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