[pve-devel] [PATCH pve-manager 1/1] pve8to9: add check for interfaces

Stefan Hanreich s.hanreich at proxmox.com
Thu Jul 17 19:50:18 CEST 2025


PVE 9 will automatically set the host_mtu parameter for VMs to the
bridge MTU if the MTU field of the network device is unset. Check for
any interface that would be affected by a change in MTU after the
upgrade.

Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
only works with current stable-bookworm branch, since the QemuServer
functions moved

 PVE/CLI/pve8to9.pm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm
index e70b162aa..f76b188f5 100644
--- a/PVE/CLI/pve8to9.pm
+++ b/PVE/CLI/pve8to9.pm
@@ -19,6 +19,7 @@ use PVE::Corosync;
 use PVE::INotify;
 use PVE::Jobs;
 use PVE::JSONSchema;
+use PVE::Network;
 use PVE::NodeConfig;
 use PVE::RPCEnvironment;
 use PVE::Storage;
@@ -1747,6 +1748,28 @@ sub check_glusterfs_storage_usage {
     return undef;
 }
 
+sub check_bridge_mtu {
+    log_info("Checking for VirtIO devices that would change their MTU...");
+
+    my $vms = PVE::QemuServer::config_list();
+
+    for my $vmid (sort { $a <=> $b } keys %$vms) {
+        my $config = PVE::QemuConfig->load_config($vmid);
+
+        for my $opt (sort keys $config->%*) {
+            next if $opt !~ m/^net\d+$/;
+            my $net = PVE::QemuServer::parse_net($config->{$opt});
+
+            next if $net->{model} ne 'virtio' || defined($net->{mtu});
+
+            my $bridge_mtu = PVE::Network::read_bridge_mtu($net->{bridge});
+
+            log_notice("network interface $opt of vm $vmid will have its mtu forced to $bridge_mtu")
+                if $bridge_mtu != 1500;
+        }
+    }
+}
+
 sub check_misc {
     print_header("MISCELLANEOUS CHECKS");
     my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') };
@@ -1859,6 +1882,7 @@ sub check_misc {
     check_legacy_notification_sections();
     check_legacy_backup_job_options();
     check_lvm_autoactivation();
+    check_bridge_mtu();
 }
 
 my sub colored_if {
-- 
2.39.5




More information about the pve-devel mailing list