public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] fix #3577: prevent vms with pci passthrough to suspend to disk
@ 2022-06-21 14:07 Dominik Csapak
  2022-08-30  8:26 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Csapak @ 2022-06-21 14:07 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] fix #3577: prevent vms with pci passthrough to suspend to disk
  2022-06-21 14:07 [pve-devel] [PATCH qemu-server] fix #3577: prevent vms with pci passthrough to suspend to disk Dominik Csapak
@ 2022-08-30  8:26 ` Thomas Lamprecht
  2022-08-31  0:18   ` DERUMIER, Alexandre
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Lamprecht @ 2022-08-30  8:26 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 21/06/2022 um 16:07 schrieb Dominik Csapak:
> 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(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] applied: [PATCH qemu-server] fix #3577: prevent vms with pci passthrough to suspend to disk
  2022-08-30  8:26 ` [pve-devel] applied: " Thomas Lamprecht
@ 2022-08-31  0:18   ` DERUMIER, Alexandre
  0 siblings, 0 replies; 3+ messages in thread
From: DERUMIER, Alexandre @ 2022-08-31  0:18 UTC (permalink / raw)
  To: pve-devel

I don't known if it's allowed currently, but snapshot with memory state 
shouldn't be allowed too.

(only mdev with vfio + migration flag=on should works)

Le 30/08/22 à 10:26, Thomas Lamprecht a écrit :
> Am 21/06/2022 um 16:07 schrieb Dominik Csapak:
>> 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(-)
>>
>>
> 
> applied, thanks!
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://antiphishing.cetsi.fr/proxy/v3?i=Zk92VEFKaGQ4Ums4cnZEUWMTpfHaXFQGRw1_CnOoOH0&r=bHA1dGV3NWJQVUloaWNFUZPu0fK2BfWNnEHaDLDwG0rtDedpluZBIffSL1M5cj3F&f=SlhDbE9uS2laS2JaZFpNWvmsxai1zlJP9llgnl5HIv-4jAji8Dh2BQawzxID5bzr6Uv-3EQd-eluQbsPfcUOTg&u=https%3A//lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel&k=XRKU
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-31  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 14:07 [pve-devel] [PATCH qemu-server] fix #3577: prevent vms with pci passthrough to suspend to disk Dominik Csapak
2022-08-30  8:26 ` [pve-devel] applied: " Thomas Lamprecht
2022-08-31  0:18   ` DERUMIER, Alexandre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal