From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] fix #5543: pci: don't use pci devices when starting templates
Date: Wed, 19 Jun 2024 08:37:24 +0200 [thread overview]
Message-ID: <20240619063724.200453-1-d.csapak@proxmox.com> (raw)
templates can only be started in context of a pbs backup, and there
we don't need or want to use the configured pci devices, since
they cannot be started normally anyway.
Without this, users can get into a situation where the template
cannot be backed up when the pci device is not available, even
if it's actually not needed.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
PVE/QemuServer.pm | 3 +++
PVE/QemuServer/PCI.pm | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 7815b608..c1cc27f3 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6137,6 +6137,9 @@ sub get_vm_volumes {
sub cleanup_pci_devices {
my ($vmid, $conf) = @_;
+ # templates don't use pci devices
+ return if $conf->{template};
+
foreach my $key (keys %$conf) {
next if $key !~ m/^hostpci(\d+)$/;
my $hostpciindex = $1;
diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index 1673041b..4aa4a52c 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -576,9 +576,13 @@ sub print_hostpci_devices {
my $kvm_off = 0;
my $gpu_passthrough = 0;
my $legacy_igd = 0;
+ my $pci_devices = {};
+
+ # templates can only start for backup where we don't want pci devices, so return early
+ return ($kvm_off, $gpu_passthrough, $legacy_igd, $pci_devices) if $conf->{template};
my $pciaddr;
- my $pci_devices = choose_hostpci_devices(parse_hostpci_devices($conf), $vmid);
+ $pci_devices = choose_hostpci_devices(parse_hostpci_devices($conf), $vmid);
for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++) {
my $id = "hostpci$i";
--
2.39.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2024-06-19 6:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 6:37 Dominik Csapak [this message]
2024-06-19 8:14 ` Fiona Ebner
2024-06-19 8:17 ` Fiona Ebner
2024-06-19 8:28 ` Dominik Csapak
2024-06-19 8:55 ` Fiona Ebner
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=20240619063724.200453-1-d.csapak@proxmox.com \
--to=d.csapak@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.