when creating or cleaning up NVIDIA vGPUs, we mistakenly assumed a
PCI domain of 0000, but this might be different.

Use 'normalize_pci_id' from PVE::SysFSTools, which handles this already
correctly.

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
depends on the pve-common patch

 PVE/QemuServer.pm     | 2 +-
 PVE/QemuServer/PCI.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 577959a4..7f937a38 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6131,7 +6131,7 @@ sub cleanup_pci_devices {
     my $reservations = PVE::QemuServer::PCI::get_reservations($vmid);
     # clean up nvidia devices
     for my $id ($reservations->@*) {
-       $id = '0000:'.$id if $id !~ m/^0000:/;
+       $id = PVE::SysFSTools::normalize_pci_id($id);
 
        my $create_path = "/sys/bus/pci/devices/$id/nvidia/current_vgpu_type";
 
diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index afb60ad2..5e74bed3 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -528,7 +528,7 @@ sub parse_hostpci_devices {
 my sub create_nvidia_device {
     my ($id, $model) = @_;
 
-    $id = '0000:'.$id if $id !~ m/^0000:/;
+    $id = PVE::SysFSTools::normalize_pci_id($id);
 
     my $creation = "/sys/bus/pci/devices/$id/nvidia/current_vgpu_type";
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to