Bug 1947824

Summary: Libvirt shouldn't set the MTU of an unmanaged tap/macvtap device, it should just pass the mtu to the guest
Product: Red Hat Enterprise Linux 9 Reporter: Yanqiu Zhang <yanqzhan>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED CURRENTRELEASE QA Contact: Yanqiu Zhang <yanqzhan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: abologna, alkaplan, crobinso, ehadley, fdeutsch, jdenemar, jsuchane, laine, lmen, mduarted, mprivozn, mtessun, phoracek, pkrempa, rmohr, virt-maint, xuzhang, yalzhang, yanqzhan, ymankad
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.3.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1905929 Environment:
Last Closed: 2021-12-07 21:57:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 7.1.0
Embargoed:
Bug Depends On: 1905929    
Bug Blocks: 1904132, 1920437, 1924681    

Comment 1 Peter Krempa 2021-04-09 10:53:56 UTC
Fixed upstream by:

commit 3bb87556b8ab010e5b808ac6775af7c10ea3d05d
Author: Laine Stump <laine>
Date:   Tue Jan 12 14:10:05 2021 -0500

    qemu: don't set interface MTU when managed='no'

v7.0.0-10-g3bb87556b8

Comment 6 Yanqiu Zhang 2021-06-07 10:21:34 UTC
Verified on:
ibvirt-daemon-7.3.0-1.el9.x86_64
qemu-kvm-6.0.0-4.el9.x86_64

Steps:
1.set the mtu of the interface to be smaller than the the pre-created tap device
mtu of the precreated device: 2000
mtu set in the interface: 1400

# ip tuntap add mode tap name mytap0
# ip l set dev mytap0 mtu 2000
# ip l show mytap0
53: mytap0: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 46:fa:12:4f:33:be brd ff:ff:ff:ff:ff:ff

# virsh start avocado-vt-vm1 
Domain 'avocado-vt-vm1' started

# virsh dumpxml avocado-vt-vm1 |grep /inter -B8
    </controller>
    <interface type='ethernet'>
      <mac address='52:54:00:93:0f:bc'/>
      <target dev='mytap0' managed='no'/>
      <model type='virtio'/>
      <mtu size='1400'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>

# ip l show mytap0 
53: mytap0: <BROADCAST,MULTICAST> mtu 2000 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 46:fa:12:4f:33:be brd ff:ff:ff:ff:ff:ff

# virsh console avocado-vt-vm1 
Connected to domain 'avocado-vt-vm1'
Escape character is ^] (Ctrl + ])

nsstest login: root
Password: 
Last login: Mon May 10 18:43:55 from 192.168.122.1
# ip l show enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:93:0f:bc brd ff:ff:ff:ff:ff:ff

2.set the mtu of the interface to be larger than the the pre-created tap device
mtu of the precreated device: 2000
mtu set in the interface: 3000

 # virsh edit avocado-vt-vm1 
   <interface type='ethernet'>
      <mac address='52:54:00:93:0f:bc'/>
      <target dev='mytap0' managed='no'/>
      <model type='virtio'/>
      <mtu size='3000'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>

# virsh start avocado-vt-vm1 
Domain 'avocado-vt-vm1' started

# ip l show mytap0 
53: mytap0: <BROADCAST,MULTICAST> mtu 2000 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 46:fa:12:4f:33:be brd ff:ff:ff:ff:ff:ff

# virsh console avocado-vt-vm1 
Connected to domain 'avocado-vt-vm1'
Escape character is ^] (Ctrl + ])

nsstest login: root
Password: 
Last login: Mon Jun  7 18:01:28 on ttyS0
[root@nsstest ~]# ip l show enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 3000 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:93:0f:bc brd ff:ff:ff:ff:ff:ff