relax the regex for hostpci to allow different pci domains than 0000

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 PVE/QemuServer.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1890448..709dcdb 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1337,7 +1337,7 @@ my $usbdesc = {
 };
 PVE::JSONSchema::register_standard_option("pve-qm-usb", $usbdesc);
 
-my $PCIRE = qr/[a-f0-9]{2}:[a-f0-9]{2}(?:\.[a-f0-9])?/;
+my $PCIRE = qr/([a-f0-9]{4}:)?[a-f0-9]{2}:[a-f0-9]{2}(?:\.[a-f0-9])?/;
 my $hostpci_fmt = {
     host => {
        default_key => 1,
@@ -3709,7 +3709,7 @@ sub config_to_command {
        if ($d->{mdev} && scalar(@$pcidevices) == 1) {
            my $pci_id = $pcidevices->[0]->{id};
            my $uuid = PVE::SysFSTools::generate_mdev_uuid($vmid, $i);
-           $sysfspath = "/sys/bus/pci/devices/0000:$pci_id/$uuid";
+           $sysfspath = "/sys/bus/pci/devices/$pci_id/$uuid";
        } elsif ($d->{mdev}) {
            warn "ignoring mediated device '$id' with multifunction device\n";
        }
@@ -5394,7 +5394,7 @@ sub vm_start {
          foreach my $pcidevice (@$pcidevices) {
                my $pciid = $pcidevice->{id};
 
-               my $info = PVE::SysFSTools::pci_device_info("0000:$pciid");
+               my $info = PVE::SysFSTools::pci_device_info("$pciid");
                die "IOMMU not present\n" if 
!PVE::SysFSTools::check_iommu_support();
                die "no pci device info for device '$pciid'\n" if !$info;
 
-- 
2.20.1


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

Reply via email to