public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 1/3] fix #8354: config: gracefully handle empty 'running-nets-host-mtu'
Date: Fri, 20 Nov 2026 12:19:16 +0100	[thread overview]
Message-ID: <20261120111949.71436-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20261120111949.71436-1-f.ebner@proxmox.com>

For a VM without any VirtIO NICs (or if failing to query via QMP), the
result from get_nets_host_mtu() is an empty string. The schema
verification when writing out the configuration is currently
incomplete and for example, does not check the 'pattern' of a
property. The result verification for a 'qm config' command uses
tighter checks, so it would run into an error for an empty value:
> 400 Result verification failed
> running-nets-host-mtu: value does not match the regex pattern

Avoid writing out an empty 'running-nets-host-mtu' value to the
configuration and ignore it upon parsing to unbreak already written
out values.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuConfig.pm | 2 +-
 src/PVE/QemuServer.pm | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm
index e7adfbfb..29a4b8b3 100644
--- a/src/PVE/QemuConfig.pm
+++ b/src/PVE/QemuConfig.pm
@@ -274,7 +274,7 @@ sub __snapshot_save_vmstate {
     $conf->{vmstate} = $statefile;
     $conf->{runningmachine} = $runningmachine;
     $conf->{runningcpu} = $runningcpu;
-    $conf->{'running-nets-host-mtu'} = $nets_host_mtu;
+    $conf->{'running-nets-host-mtu'} = $nets_host_mtu if $nets_host_mtu;
 
     return $statefile;
 }
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index c14b7f51..763cfd39 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2021,6 +2021,10 @@ sub parse_vm_config {
         } elsif ($line =~ m/^([a-z][a-z_\-]*\d*):\s*(.+?)\s*$/) {
             my $key = $1;
             my $value = $2;
+
+            # Ignore accidentally written empty 'running-nets-host-mtu'.
+            next if $key eq 'running-nets-host-mtu' && $value !~ m/\S/;
+
             if ($section->{name} eq 'cloudinit' && $section->{type} eq 'special') {
                 # ignore validation only used for informative purpose
                 $conf->{$key} = $value;
-- 
2.47.3





  reply	other threads:[~2026-11-20 11:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 11:19 [PATCH-SERIES qemu-server/container 0/3] fix #8354: config: gracefully handle empty 'running-nets-host-mtu' Fiona Ebner
2026-11-20 11:19 ` Fiona Ebner [this message]
2026-11-20 11:19 ` [PATCH qemu-server 2/3] config: check type: add reminder to improve checks for major release Fiona Ebner
2026-11-20 11:19 ` [PATCH container 3/3] " Fiona Ebner
2026-11-20 12:00 ` applied: [PATCH-SERIES qemu-server/container 0/3] fix #8354: config: gracefully handle empty 'running-nets-host-mtu' 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=20261120111949.71436-2-f.ebner@proxmox.com \
    --to=f.ebner@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