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:
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
(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?
*** Bug 1630143 has been marked as a duplicate of this bug. ***
(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!
(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.
(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!
Patches posted upstream: https://www.redhat.com/archives/libvir-list/2018-September/msg01139.html
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
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
(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 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
Maybe we can find clues in bug 1459091
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>
This was verified and shipped long ago. Closing the bug report.