From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v2 2/5] code cleanup: cfg2cmd: check if configuration is for template centrally
Date: Tue, 12 Aug 2025 16:37:40 +0200 [thread overview]
Message-ID: <20250812143900.138723-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250812143900.138723-1-f.ebner@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuServer.pm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index d6657a1f..67db9bc3 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3205,9 +3205,11 @@ sub config_to_command {
my ($forcemachine, $forcecpu, $live_restore_backing, $dry_run) =
$options->@{qw(force-machine force-cpu live-restore-backing dry-run)};
+ my $is_template = PVE::QemuConfig->is_template($conf);
+
# minimize config for templates, they can only start for backup,
# so most options besides the disks are irrelevant
- if (PVE::QemuConfig->is_template($conf)) {
+ if ($is_template) {
my $newconf = {
template => 1, # in case below code checks that
kvm => 0, # to prevent an error on hosts without virtualization extensions
@@ -3361,7 +3363,6 @@ sub config_to_command {
'machine-version' => $machine_version,
q35 => $q35,
};
- my $is_template = PVE::QemuConfig->is_template($conf);
my ($ovmf_cmd, $ovmf_machine_flags) = PVE::QemuServer::OVMF::print_ovmf_commandline(
$conf, $storecfg, $vmid, $hw_info, $version_guard, $is_template,
);
@@ -3463,7 +3464,7 @@ sub config_to_command {
# Add a TPM only if the VM is not a template,
# to support backing up template VMs even if the TPM disk is write-protected.
- add_tpm_device($vmid, $devices, $conf) if (!PVE::QemuConfig->is_template($conf));
+ add_tpm_device($vmid, $devices, $conf) if !$is_template;
my $sockets = 1;
$sockets = $conf->{smp} if $conf->{smp}; # old style - no longer iused
@@ -3900,7 +3901,7 @@ sub config_to_command {
print "activating and using '$vmstate' as vmstate\n";
}
- if (PVE::QemuConfig->is_template($conf)) {
+ if ($is_template) {
# needed to workaround base volumes being read-only
push @$cmd, '-snapshot';
}
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-08-12 14:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 14:37 [pve-devel] [PATCH-SERIES qemu-server v2 0/5] fix #6675: template backup: fix regression with IDE/SATA and blockdev Fiona Ebner
2025-08-12 14:37 ` [pve-devel] [PATCH qemu-server v2 1/5] ovmf: pass along whether the VM is a template Fiona Ebner
2025-08-13 7:37 ` Fabian Grünbichler
2025-08-12 14:37 ` Fiona Ebner [this message]
2025-08-12 14:37 ` [pve-devel] [PATCH qemu-server v2 3/5] fix #6675: template backup: fix regression with IDE/SATA and blockdev Fiona Ebner
2025-08-12 14:37 ` [pve-devel] [PATCH qemu-server v2 4/5] code cleanup: drive: get rid of outdated drive_is_read_only() helper Fiona Ebner
2025-08-12 14:37 ` [pve-devel] [PATCH qemu-server v2 5/5] cfg2cmd: add reminder comments to remove template handling for -drive Fiona Ebner
2025-08-13 7:34 ` [pve-devel] applied-series: [PATCH-SERIES qemu-server v2 0/5] fix #6675: template backup: fix regression with IDE/SATA and blockdev 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=20250812143900.138723-3-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.