From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0C5431FF189 for ; Thu, 4 Sep 2025 14:41:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6F2312EA84; Thu, 4 Sep 2025 14:41:56 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 4 Sep 2025 14:40:50 +0200 Message-ID: <20250904124113.81772-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250904124113.81772-1-f.ebner@proxmox.com> References: <20250904124113.81772-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1756989664302 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.023 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server v3 6/8] snapshot: introduce running-nets-host-mtu property X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" For VirtIO network devices, it is necessary to preserve the values and presence of the host_mtu setting when restoring a snapshot. See commit "migration: preserve host_mtu for virtio-net devices" for details. Signed-off-by: Fiona Ebner --- New in v3. src/PVE/API2/Qemu.pm | 1 + src/PVE/QemuConfig.pm | 6 ++++++ src/PVE/QemuServer.pm | 9 +++++++++ src/PVE/QemuServer/RunState.pm | 3 ++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm index 4770fbf8..ec9f31d8 100644 --- a/src/PVE/API2/Qemu.pm +++ b/src/PVE/API2/Qemu.pm @@ -2113,6 +2113,7 @@ my $update_vm_api = sub { } push @delete, 'runningmachine' if $conf->{runningmachine}; push @delete, 'runningcpu' if $conf->{runningcpu}; + push @delete, 'running-nets-host-mtu' if $conf->{'running-nets-host-mtu'}; } PVE::QemuConfig->check_lock($conf) if !$skiplock; diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm index 33cac3be..d0844c4c 100644 --- a/src/PVE/QemuConfig.pm +++ b/src/PVE/QemuConfig.pm @@ -247,6 +247,8 @@ sub __snapshot_save_vmstate { or die "cannot obtain PID for VM $vmid!\n"; my $runningcpu = PVE::QemuServer::CPUConfig::get_cpu_from_running_vm($pid); + my $nets_host_mtu = PVE::QemuServer::Network::get_nets_host_mtu($vmid, $conf); + if (!$suspend) { $conf = $conf->{snapshots}->{$snapname}; } @@ -254,6 +256,7 @@ sub __snapshot_save_vmstate { $conf->{vmstate} = $statefile; $conf->{runningmachine} = $runningmachine; $conf->{runningcpu} = $runningcpu; + $conf->{'running-nets-host-mtu'} = $nets_host_mtu; return $statefile; } @@ -473,6 +476,8 @@ sub __snapshot_rollback_hook { # re-initializing its random number generator $conf->{vmgenid} = PVE::QemuServer::generate_uuid(); } + + $data->{'nets-host-mtu'} = delete($conf->{'running-nets-host-mtu'}); } return; @@ -513,6 +518,7 @@ sub __snapshot_rollback_vm_start { statefile => $vmstate, forcemachine => $data->{forcemachine}, forcecpu => $data->{forcecpu}, + 'nets-host-mtu' => $data->{'nets-host-mtu'}, }; PVE::QemuServer::vm_start($storecfg, $vmid, $params); } diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 20e26cd5..e312acb6 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -635,6 +635,15 @@ EODESCR pattern => $PVE::QemuServer::CPUConfig::qemu_cmdline_cpu_re, format_description => 'QEMU -cpu parameter', }, + 'running-nets-host-mtu' => { + type => 'string', + pattern => 'net\d+=\d+(,net\d+=\d+)*', + optional => 1, + description => + 'List of VirtIO network devices and their effective host_mtu setting. A value of 0' + . ' means that the host_mtu parameter is to be avoided for the corresponding device.' + . ' This is used internally for snapshots.', + }, machine => get_standard_option('pve-qemu-machine'), arch => { description => "Virtual processor architecture. Defaults to the host.", diff --git a/src/PVE/QemuServer/RunState.pm b/src/PVE/QemuServer/RunState.pm index 05e7fb47..6a5fdbd7 100644 --- a/src/PVE/QemuServer/RunState.pm +++ b/src/PVE/QemuServer/RunState.pm @@ -104,7 +104,8 @@ sub vm_suspend { warn $@ if $@; PVE::Storage::deactivate_volumes($storecfg, [$vmstate]); PVE::Storage::vdisk_free($storecfg, $vmstate); - delete $conf->@{qw(vmstate runningmachine runningcpu)}; + delete $conf->@{ + qw(vmstate runningmachine runningcpu running-nets-host-mtu)}; PVE::QemuConfig->write_config($vmid, $conf); }; warn $@ if $@; -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel