]> git.proxmox.com Git - qemu-server.git/commitdiff
pci: cleanup pci: unregister mdev directly inline
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 10 Nov 2022 16:01:48 +0000 (17:01 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 10 Nov 2022 16:02:34 +0000 (17:02 +0100)
not worth the hassle of a break/depends cycle

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm

index 0a8442c3d7d081c780956961394208a404c2838b..d5a957b6484fc4389bfc6a8b4a61e9370d32a604 100644 (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);
 }