public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 1/1] pve8to9: add check for interfaces
Date: Thu, 17 Jul 2025 19:50:18 +0200	[thread overview]
Message-ID: <20250717175018.606662-1-s.hanreich@proxmox.com> (raw)

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


             reply	other threads:[~2025-07-17 17:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 17:50 Stefan Hanreich [this message]
2025-07-18 10:33 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250717175018.606662-1-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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