From faf72d6cbfec065aee0b31d7b39d677daf663552 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 10 Nov 2022 17:01:48 +0100 Subject: [PATCH] pci: cleanup pci: unregister mdev directly inline not worth the hassle of a break/depends cycle Signed-off-by: Thomas Lamprecht --- PVE/QemuServer.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 0a8442c..d5a957b 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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); } -- 2.39.2