public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager 1/1] pve8to9: add check for interfaces
@ 2025-07-17 17:50 Stefan Hanreich
  2025-07-18 10:33 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2025-07-17 17:50 UTC (permalink / raw)
  To: pve-devel

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@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


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-18 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-17 17:50 [pve-devel] [PATCH pve-manager 1/1] pve8to9: add check for interfaces Stefan Hanreich
2025-07-18 10:33 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal