Bug 1940559 - interface type='vhostuser' libvirtError: Cannot set interface MTU
Summary: interface type='vhostuser' libvirtError: Cannot set interface MTU
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.4
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-18 15:50 UTC by Moshe Levi
Modified: 2021-05-31 06:14 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-31 06:14:48 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
libvirt debug log (5.77 MB, text/plain)
2021-03-25 07:45 UTC, Moshe Levi
no flags Details

Description Moshe Levi 2021-03-18 15:50:08 UTC
Description of problem:
 libvirt.libvirtError: Cannot set interface MTU on '(null)': No such device
2021-03-18 13:08:04.836 7 ERROR nova.virt.libvirt.driver [req-3f7653ff-623d-43fe-9b6c-a17aebe405aa 1c0c526e8d134914b766a1a6354b56bf 3db3d1b6a1e3469da95693d49f4fd308 - default default] [instance: 5aee63f2-7293-412e-895b-0b4282048c1d] Failed to start libvirt guest: libvirt.libvirtError: Cannot set interface MTU on '(null)': No such device

Version-Release number of selected component (if applicable):
qemu-kvm-5.1.0-14.el8.1.x86_64
libvirt-client-6.6.0-7.3.el8.x86_64

How reproducible:


Steps to Reproduce:
1.create VM with the following interface:
    <interface type='vhostuser'>
      <mac address='fa:16:3e:92:6d:79'/>
      <source type='unix' path='/var/lib/vhost_sockets/sock7f9a971a-cf3' mode='server'/>
      <model type='virtio'/>
      <driver rx_queue_size='512' tx_queue_size='512'/>
      <mtu size='8942'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>


Actual results:
libvirt.libvirtError: Cannot set interface MTU on '(null)': No such device


Expected results:
VM should start

Additional info:

Comment 1 Michal Privoznik 2021-03-19 15:37:52 UTC
Moshe, can you please attach debug logs? I vaguely recall fixing something like this, not that long ago.

Comment 2 Michal Privoznik 2021-03-19 16:36:00 UTC
Now that I'm thinking about it more, this resembles bug 1767013 where the problem is also that libvirt was unable to detect interface name (and thus could not set MTU). Moshe, can you please test this scratch build:

https://mprivozn.fedorapeople.org/ovs/

I've backported patches that fix the problem onto rhel-av-8.3.1 version of libvirt.

Comment 3 Moshe Levi 2021-03-21 21:51:20 UTC
It is not working 
: libvirt.libvirtError: Cannot set interface MTU on '': No such device
2021-03-21 09:03:37.306 7 ERROR nova.virt.libvirt.driver [req-2e152093-d6f0-409d-ba42-ee0a5ef73093 1c0c526e8d134914b766a1a6354b56bf 3db3d1b6a1e3469da95693d49f4fd308 - default default] [instance: e943d688-5947-43d3-818b-d0e1507790da] Failed to start libvirt guest: libvirt.libvirtError: Cannot set interface MTU on '': No such device

How do detect the vhost user device? is it from OVS?

Comment 4 Michal Privoznik 2021-03-22 07:48:52 UTC
Yes. It asks ovs for the name. Can you please attach debug logs?

Here's the function that constructs ovs-vsctl command and extracts the name:

https://gitlab.com/libvirt/libvirt/-/blob/master/src/util/virnetdevopenvswitch.c#L529

Comment 5 Moshe Levi 2021-03-25 07:45:20 UTC
Created attachment 1766199 [details]
libvirt debug log

Comment 6 Moshe Levi 2021-03-25 10:39:35 UTC
So I understand why it not working now. We have proprietary of  ovs-dpdk version that for vdpa but it not using the vhost-server-path. I requested them to build a new ovs-dpdk version which uses vhost-server-path and see if that solve the issue.
I will update you when I have the results.

Comment 7 Michal Privoznik 2021-03-25 10:44:40 UTC
Right, this is the command that libvirt executes in order to learn the interface name:

2021-03-25 07:35:25.138+0000: 2377188: debug : virCommandRunAsync:2619 : About to run ovs-vsctl --timeout=5 --no-headings --columns=name find Interface options:vhost-server-path=/var/lib/vhost_sockets/sockb6d8e63d-aa9
2021-03-25 07:35:25.139+0000: 2377188: debug : virCommandRunAsync:2622 : Command result 0, with PID 2377905
2021-03-25 07:35:25.148+0000: 2377188: debug : virCommandRun:2464 : Result exit status 0, stdout: '' stderr: '2021-03-25 07:35:25.139+0000: 2377905: debug : virFileClose:135 : Closed fd 35

But ovs-vsctl returned nothing. Let me know whether the ovs rebuild helped, please.

Comment 8 Moshe Levi 2021-03-29 11:03:54 UTC
so out ovs part is running in container. Is there away in libvirt to change the paramters of the ovs-vsctl? (currently I see only timeout)

Comment 9 Michal Privoznik 2021-03-29 11:17:10 UTC
That would explain why ovs-vsctl would not return anything, because it doesn't see the DB which lives inside the container. And I guess you're exposing the VHOST socket from the container (that /var/lib/vhost_sockets/sock* path), right? So what about exposing the DB socket too? On my machine ovs-vsctl tries to connect to /var/run/openvswitch/db.sock.
What arguments would you like to pass to ovs-vsctl?

Comment 10 Moshe Levi 2021-03-29 18:24:58 UTC
Just for my understanding the mtu with vhostuser will it just set the mtu in the ovs interface? 
Is it will also add the host_mtu flag to qemu args?

Comment 11 Michal Privoznik 2021-03-30 08:04:49 UTC
(In reply to Moshe Levi from comment #10)
> Just for my understanding the mtu with vhostuser will it just set the mtu in
> the ovs interface? 
> Is it will also add the host_mtu flag to qemu args?

Yes, both. But if you're running ovs in a container, why not run your VM there too?
Also, has exposing the DB socket helped? And what additional arguments would you like to pass to ovs-vsctl?

Comment 12 Moshe Levi 2021-03-30 10:52:59 UTC
It a complex solution we have ovs on the host and we use ovs-dpdk in container just to do vdpa connectivity. 
It will be nice if we can add --db flag ovs-vsctl --db unix:/forwarder/var/run/openvswitch/db.sock show so libvirt can query like this.
can I configure libvirt to run  ovs-vsctl on different different db?

Comment 13 Michal Privoznik 2021-03-30 12:22:10 UTC
There's no way to do that without rebuilding your own libvirt. This patch should do the trick:

diff --git i/src/util/virnetdevopenvswitch.c w/src/util/virnetdevopenvswitch.c
index bd840bd3b7..ef87829634 100644
--- i/src/util/virnetdevopenvswitch.c
+++ w/src/util/virnetdevopenvswitch.c
@@ -57,6 +57,7 @@ virNetDevOpenvswitchCreateCmd(void)
 {
     virCommandPtr cmd = virCommandNew(OVS_VSCTL);
     virCommandAddArgFormat(cmd, "--timeout=%u", virNetDevOpenvswitchTimeout);
+    virCommandAddArgPair(cmd, "--db", "unix:/forwarder/var/run/openvswitch/db.sock");
     return cmd;
 }



Problem with allowing users to pass arbitrary arguments to ovs-vsctl is that they may interfere with whatever libvirt sets and render whole cmd line unusable. BTW: what's stopping you from exporting the db.sock path without the "/forwarder" prefix? What if something else tries to use ovs-vsctl from outside the container?

Comment 14 Moshe Levi 2021-03-30 13:56:22 UTC
we have 2 ovs:
one on the host /var/run/openvswitch/db.sock
one on in the container /forwarder/var/run/openvswitch/db.sock

Do you think adding the db support in libvirt.conf is an option?

Comment 15 Michal Privoznik 2021-03-31 07:42:51 UTC
It is possible, yeah. However, I don't think that mimicking --timeout is not enough. The problem is that one may have plenty of containers each with its own OVS. Setting one global DB path for all of guests won't allow individual approach. We might need to expose it in domain XML.
But before I dig any deeper - has the patch from comment 13 helped? Or do you want me to provide a scratch build for you?

Comment 16 Moshe Levi 2021-03-31 07:45:32 UTC
a scratch build will be nice. We have openstack which is quited complex so scratch build will help.

Comment 17 Michal Privoznik 2021-03-31 09:40:20 UTC
Here you go:

https://mprivozn.fedorapeople.org/ovs/

What's contained in the scratch build? Mostly some patches to catch up with the upstream plus that patch from comment 13 which unconditionally passes --db path. For every command. So this may break some other use case where you want to communicate with ovs that's outside the container. But since this is only to test whether specifying db path would work I'd say it is okay.

Comment 18 Moshe Levi 2021-03-31 09:55:16 UTC
thanks I will try and update you :)

Comment 19 Michal Privoznik 2021-05-24 09:24:59 UTC
Moshe, any update?

Comment 20 Moshe Levi 2021-05-29 20:04:03 UTC
It appear that the xml was missing the vf netdevice 
<target dev='enp3s0f0v6'/> which avoid query the ovs and we are able to change the VF mtu. 
You can close this BUG as it was mis config from our side.

Comment 21 Michal Privoznik 2021-05-31 06:14:48 UTC
Very well. I'm closing this per comment 20.


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