pci: do not reserve pci-ids for mediated devices

else a user cannot use more than one mdev per card per host.
We do not need to reserve them at all, since sysfs will error out
on creation/reuse anyway

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-11-15 14:07:35 +01:00 committed by Thomas Lamprecht
parent ce3fbcd456
commit 9c85548fa1

View File

@ -5501,7 +5501,12 @@ sub vm_start_nolock {
$pci_devices->{$i} = parse_hostpci($dev);
}
my $pci_id_list = [ map { $_->{id} } map { $_->{pciid}->@* } values $pci_devices->%* ];
# do not reserve pciid for mediated devices, sysfs will error out for duplicate assignment
my $real_pci_devices = [ grep { !(defined($_->{mdev}) && scalar($_->{pciid}->@*) == 1) } values $pci_devices->%* ];
# map to a flat list of pci ids
my $pci_id_list = [ map { $_->{id} } map { $_->{pciid}->@* } $real_pci_devices->@* ];
# reserve all PCI IDs before actually doing anything with them
PVE::QemuServer::PCI::reserve_pci_usage($pci_id_list, $vmid, $start_timeout);