Ok after changing
commenting out the lines 6127, 6128 (which are 6099,6100 on my local
/usr/share/perl5/PVE/QemuServer.pm
) to
Perl:
sub cleanup_pci_devices {
my ($vmid, $conf) = @_;
foreach my $key (keys %$conf) {
next if $key !~ m/^hostpci(\d+)$/;
my $hostpciindex = $1;
my $uuid = PVE::SysFSTools::generate_mdev_uuid($vmid, $hostpciindex);
my $d = parse_hostpci($conf->{$key});
if ($d->{mdev}) {
sleep(3); # also added by me!
# NOTE: avoid PVE::SysFSTools::pci_cleanup_mdev_device as it requires PCI ID and we
# don't want to break ABI just for this two liner
# my $dev_sysfs_dir = "/sys/bus/mdev/devices/$uuid";
# PVE::SysFSTools::file_write("$dev_sysfs_dir/remove", "1") if -e $dev_sysfs_dir;
}
}
PVE::QemuServer::PCI::remove_pci_reservation($vmid);
}
the shutdown works as expected.
1. Start PVE-Host
2. Auto-Start Guests were started
3.
cat /sys/bus/pci/devices/0000\:c2\:00.0/mdev_supported_types/nvidia-269/available_instances
shows
2
(which is correct)
4. Shutdown guest via Proxmox-GUI
5.
cat /sys/bus/pci/devices/0000\:c2\:00.0/mdev_supported_types/nvidia-269/available_instances
shows
3
(which is correct, before we had
2
)
6. Starting guest via Proxmox -GUI again
7.
cat /sys/bus/pci/devices/0000\:c2\:00.0/mdev_supported_types/nvidia-269/available_instances
shows
2
(which is correct, before we had
1
)