From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] fix #3577: prevent vms with pci passthrough to suspend to disk
Date: Tue, 21 Jun 2022 16:07:04 +0200 [thread overview]
Message-ID: <20220621140704.142671-1-d.csapak@proxmox.com> (raw)
while it may work to suspend, resume will most likely not work, because
we do/can not save/restore the hardware state of the devices
instead, prevent the user from suspending the vm at all.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
PVE/API2/Qemu.pm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 99b426e..24d0f59 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2977,10 +2977,17 @@ __PACKAGE__->register_method({
# early check for storage permission, for better user feedback
if ($todisk) {
$rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.Disk']);
+ my $conf = PVE::QemuConfig->load_config($vmid);
+
+ # check for hostpci devices (suspend will maybe work, resume won't),
+ # so prevent users from suspending in the first place
+ for my $key (keys %$conf) {
+ next if $key !~ /^hostpci\d+/;
+ die "Cannot suspend VM to disk with assigned PCI devices\n";
+ }
if (!$statestorage) {
# get statestorage from config if none is given
- my $conf = PVE::QemuConfig->load_config($vmid);
my $storecfg = PVE::Storage::config();
$statestorage = PVE::QemuServer::find_vmstate_storage($conf, $storecfg);
}
--
2.30.2
next reply other threads:[~2022-06-21 14:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 14:07 Dominik Csapak [this message]
2022-08-30 8:26 ` [pve-devel] applied: " Thomas Lamprecht
2022-08-31 0:18 ` DERUMIER, Alexandre
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=20220621140704.142671-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox