all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v3 3/3] fix #6007: template backup: use minimized configuration for handling the full vm start
Date: Wed, 12 Feb 2025 12:04:27 +0100	[thread overview]
Message-ID: <20250212110427.33757-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250212110427.33757-1-f.ebner@proxmox.com>

Previously, the template's configuration was used as-is for the rest
of handling the VM start even if config_to_command() uses a minimized
configuration to build the command. This can lead to issues with a
network device with the 'link_down' flag set, because the network
device will not be present, but the start handling will still issue a
QMP command for it, leading to a failed backup operation.

Use the minimized configuration for the whole start-up handling to
avoid such issues.

Use the special QemuConfig::NoWrite class to safeguard against
accidentally writing out the temporarily modified config.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Changes in v3:
* use blessed object instead of config data flag.

 PVE/QemuServer.pm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 808c0e1c..c1fbd468 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -49,6 +49,7 @@ use PVE::Tools qw(run_command file_read_firstline file_get_contents dir_glob_for
 
 use PVE::QMPClient;
 use PVE::QemuConfig;
+use PVE::QemuConfig::NoWrite;
 use PVE::QemuServer::Helpers qw(config_aware_timeout min_version kvm_user_version windows_version);
 use PVE::QemuServer::Cloudinit;
 use PVE::QemuServer::CGroup;
@@ -3397,6 +3398,7 @@ sub config_to_command {
 	    bios => $conf->{bios}, # so efidisk gets included if it exists
 	    name => $conf->{name}, # so it's correct in the process list
 	};
+	$newconf = PVE::QemuConfig::NoWrite->new($newconf);
 
 	# copy all disks over
 	for my $device (PVE::QemuServer::Drive::valid_drive_names()) {
@@ -4017,7 +4019,7 @@ sub config_to_command {
 	push @$cmd, @$aa;
     }
 
-    return wantarray ? ($cmd, $vollist, $spice_port, $pci_devices) : $cmd;
+    return wantarray ? ($cmd, $vollist, $spice_port, $pci_devices, $conf) : $cmd;
 }
 
 sub check_rng_source {
@@ -5613,8 +5615,17 @@ sub vm_start_nolock {
 	print "Resuming suspended VM\n";
     }
 
-    my ($cmd, $vollist, $spice_port, $pci_devices) = config_to_command($storecfg, $vmid,
-	$conf, $defaults, $forcemachine, $forcecpu, $params->{'live-restore-backing'});
+    # Note that for certain cases like templates, the configuration is minimized, so need to ensure
+    # the rest of the function here uses the same configuration that was used to build the command
+    (my $cmd, my $vollist, my $spice_port, my $pci_devices, $conf) = config_to_command(
+	$storecfg,
+	$vmid,
+	$conf,
+	$defaults,
+	$forcemachine,
+	$forcecpu,
+	$params->{'live-restore-backing'},
+    );
 
     my $migration_ip;
     my $get_migration_ip = sub {
-- 
2.39.5



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

  parent reply	other threads:[~2025-02-12 11:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 11:04 [pve-devel] [PATCH-SERIES qemu-server v3 0/3] fix #6007: fix PBS template backup for certain configurations Fiona Ebner
2025-02-12 11:04 ` [pve-devel] [PATCH qemu-server v3 1/3] backup: also restore VM power state for early failures Fiona Ebner
2025-02-12 11:04 ` [pve-devel] [PATCH qemu-server v3 2/3] config: add special class that prevents writing the configuration Fiona Ebner
2025-02-18 11:03   ` Wolfgang Bumiller
2025-02-18 13:08     ` [pve-devel] [PATCH qemu-server 0/2] follow-ups for "v3 fix #6007: fix PBS template backup for certain configurations" Fabian Grünbichler
2025-02-18 13:08       ` [pve-devel] [PATCH qemu-server 1/2] config: revamp NoWrite interface Fabian Grünbichler
2025-02-18 13:08       ` [pve-devel] [PATCH qemu-server 2/2] config: make attempts at writing out NoWrite configs fatal Fabian Grünbichler
2025-02-18 13:18       ` [pve-devel] [PATCH qemu-server 0/2] follow-ups for "v3 fix #6007: fix PBS template backup for certain configurations" Fiona Ebner
2025-02-12 11:04 ` Fiona Ebner [this message]
2025-02-18 14:20 ` [pve-devel] applied-series: [PATCH-SERIES qemu-server v3 0/3] fix #6007: fix PBS template backup for certain configurations Fabian Grünbichler

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=20250212110427.33757-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal