mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-03 15:45:49 +00:00
fix #3577: prevent suspension for VMs with pci passthrough
Prevent the user from suspending the vm at all, as while suspension itself may finish, the saved state is incomplete as we can neither save nor restore PCIe device state in any generic fashion, so resuming will almost certainly break. The single case when it could work is when the guest OS didn't uses the passed through device at all, so there's no state, but that's really odd (as why bother passing through then), and the user should rather remove the hostpci entry in that case. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> [ T: reword commit message slightly ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
50164179db
commit
227a298f7f
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user