[pve-devel] [PATCH qemu-server] add virtio host_mtu feature.

Alexandre DERUMIER aderumier at odiso.com
Wed Jun 3 15:45:29 CEST 2020


Hi,

any comment about this patch ?

forum users still need it 

https://forum.proxmox.com/threads/set-mtu-on-guest.45078/page-2

(and it could help too with vxlan and other tunneling where mtu need to be reduce on guest)

----- Mail original -----
De: "aderumier" <aderumier at odiso.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Cc: "aderumier" <aderumier at odiso.com>
Envoyé: Vendredi 17 Avril 2020 07:47:20
Objet: [PATCH qemu-server] add virtio host_mtu feature.

This add a new "mtu" param to vm nic, 
and force the mtu in the guest for virtio nic only. 

Special value: 1 = set the same value than the bridge 
--- 
PVE/QemuServer.pm | 19 +++++++++++++++++++ 
1 file changed, 19 insertions(+) 

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm 
index 6445508..9baa6ff 100644 
--- a/PVE/QemuServer.pm 
+++ b/PVE/QemuServer.pm 
@@ -884,6 +884,12 @@ my $net_fmt = { 
description => 'Whether this interface should be disconnected (like pulling the plug).', 
optional => 1, 
}, 
+ mtu => { 
+ type => 'integer', 
+ minimum => 1, maximum => 65520, 
+ description => 'Force mtu (virtio only). 1 = bridge mtu value', 
+ optional => 1, 
+ }, 
}; 

my $netdesc = { 
@@ -1593,6 +1599,19 @@ sub print_netdevice_full { 
} 
$tmpstr .= ",bootindex=$net->{bootindex}" if $net->{bootindex} ; 

+ if($net->{model} eq 'virtio' && $net->{mtu} && $net->{bridge}) { 
+ 
+ my $mtu = $net->{mtu}; 
+ my $bridge_mtu = PVE::Network::read_bridge_mtu($net->{bridge}); 
+ 
+ if($mtu == 1) { 
+ $mtu = $bridge_mtu; 
+ } else { 
+ die "mtu $mtu is bigger than bridge mtu $bridge_mtu" if $mtu > $bridge_mtu; 
+ } 
+ $tmpstr .= ",host_mtu=$mtu"; 
+ } 
+ 
if ($use_old_bios_files) { 
my $romfile; 
if ($device eq 'virtio-net-pci') { 
-- 
2.20.1 




More information about the pve-devel mailing list