[pve-devel] [PATCH qemu-server stable-bookworm v2 3/4] migration: only use nets-host-mtu for PVE 8 target if actually required
Fiona Ebner
f.ebner at proxmox.com
Tue Sep 9 11:16:59 CEST 2025
Commit 1736fbeb ("migration: preserve host_mtu for virtio-net
devices") addresses probblematic migration scenarios with VirtIO-net
devices which inherit the MTU from the bridge. In Proxmox VE 9, the
default behavior changed to inherit the MTU from the bridge, but for
Proxmox VE 8, only an explicit mtu=1 will do so and thus be
potentially problematic.
By not using the nets-host-mtu parameter for unproblematic migrations,
fricition is reduced, because backwards migrations to not-yet-upgraded
Proxmox VE 8 nodes will still work.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/QemuMigrate.pm | 8 +++++---
src/PVE/QemuServer.pm | 3 ++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 3cd7069a..ea35e54d 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -1148,9 +1148,11 @@ sub phase2 {
},
};
- if (my $nets_host_mtu = PVE::QemuServer::get_nets_host_mtu($vmid, $conf)) {
- $params->{start_params}->{'nets-host-mtu'} = $nets_host_mtu;
- }
+ my $target_version = PVE::QemuServer::Helpers::get_node_pvecfg_version($self->{node});
+ my $only_inherited_mtus =
+ $target_version && !PVE::QemuServer::Helpers::pvecfg_min_version($target_version, 9, 0, 0);
+ my $nets_host_mtu = PVE::QemuServer::get_nets_host_mtu($vmid, $conf, $only_inherited_mtus);
+ $params->{start_params}->{'nets-host-mtu'} = $nets_host_mtu if $nets_host_mtu;
my ($tunnel_info, $spice_port);
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index b2a9f816..8bc55def 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -9535,13 +9535,14 @@ sub delete_ifaces_ipams_ips {
}
sub get_nets_host_mtu {
- my ($vmid, $conf) = @_;
+ my ($vmid, $conf, $only_inherited_mtus) = @_;
my $nets_host_mtu = [];
for my $opt (sort keys $conf->%*) {
next if $opt !~ m/^net(\d+)$/;
my $net = parse_net($conf->{$opt});
next if $net->{model} ne 'virtio';
+ next if $only_inherited_mtus && !($net->{mtu} && $net->{mtu} == 1);
my $host_mtu = eval {
mon_cmd(
--
2.39.5
More information about the pve-devel
mailing list