#1104431 libvirt-daemon-driver-lxc: Starting libvirt_lxc container with MTU set to != 1500 doesn't set specified MTU on veth devices

Package:
libvirt-daemon-driver-lxc
Source:
libvirt-daemon-driver-lxc
Description:
Virtualization daemon LXC connection driver
Submitter:
Gary Hawkins
Date:
2025-06-01 20:13:01 UTC
Severity:
normal
#1104431#5
Date:
2025-04-29 22:17:53 UTC
From:
To:
Dear Maintainer,

When I start an LXC container using virsh -c lxc:///system start <name> where the domain XML file for that container contains something along the lines of:

<interface type='bridge'>
      <mac address='52:54:00:03:87:f2'/>
      <source bridge='ovs0'/>
      <vlan trunk='yes'>
        <tag id='2'/>
      </vlan>
      <virtualport type='openvswitch'>
        <parameters interfaceid='c8304245-b238-4c61-a7c1-6a8bc905e251'/>
      </virtualport>
      <mtu size='9000'/>
</interface>

the container starts as expected, but the "vnet<n>" veth device(s) created as a result are always set to exactly 1500 MTU regardless of what is specified for MTU in the domain
XML.  This only happens when using LXC containers with libvirt; qemu/KVM VMs started with libvirt set the MTU correctly.  I am unsure whether this is a bug in libvirt or whether
the underlying systemd-container process is handling this incorrectly.  While it is possible to alter the MTU of the veth device once started and make it work, that's not a
workable solution in the long term.

What I expect to happen is that either the MTU is set on the veth device as specified in the domain XML, or the XML does not allow MTU to be set, but I cannot see anything in the
libvirt documentation to suggest that setting MTU is not a valid option here.

https://libvirt.org/formatdomain.html#mtu-configuration does not seem to specify that <mtu size='...'/> is unacceptable for LXC containers, so I assume this was meant to work.

This is reproducible in the current 11.0.2-2 in trixie and also 11.0.2-3 in experimental.  (I have downgraded back to 11.0.2-2 now)

#1104431#10
Date:
2025-04-29 22:28:33 UTC
From:
To:
Apologies, that last sentence should have read:

This is reproducible in the current 11.2.0-2 in trixie and also 11.2.0-3 in experimental.  (I have downgraded back to 11.0.2-2 now)

#1104431#15
Date:
2025-06-01 20:04:55 UTC
From:
To:
To clarify, this doesn't work with 11.0.2-2 either, right? So it's
not a regression in trixie compared to bookworm.

Based on a quick look at the code, it seems that the necessary
functionality has only been wired up in the QEMU and Cloud Hypervisor
driver. Someone would have to modify the LXC driver to reach feature
parity.

I recommend that you file an upstream feature requrest here:

https://gitlab.com/libvirt/libvirt/-/issues

Once you've done so, we can mark this bug as "forwarded".