pci: cleanup pci: unregister mdev directly inline

not worth the hassle of a break/depends cycle

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-11-10 17:01:48 +01:00
parent c963efc882
commit faf72d6cbf

View File

@ -5930,7 +5930,12 @@ sub cleanup_pci_devices {
my $hostpciindex = $1;
my $uuid = PVE::SysFSTools::generate_mdev_uuid($vmid, $hostpciindex);
my $d = parse_hostpci($conf->{$key});
PVE::SysFSTools::pci_cleanup_mdev_device($uuid) if $d->{mdev};
if ($d->{mdev}) {
# 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);
}