[pve-devel] [PATCH 1/9] vm_devices_list : list devices behind pci bridge

Alexandre Derumier aderumier at odiso.com
Fri Jan 16 11:00:53 CET 2015


This fix hotplug error messages for devices behind bridges

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 55d3e0e..6d6d2f7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3127,8 +3127,18 @@ sub vm_devices_list {
     my $devices = {};
     foreach my $pcibus (@$res) {
 	foreach my $device (@{$pcibus->{devices}}) {
-	    next if !$device->{'qdev_id'};
-	    $devices->{$device->{'qdev_id'}} = 1;
+	    if ($device->{'pci_bridge'}) {
+
+		$devices->{$device->{'qdev_id'}} = 1;
+		foreach my $bridge_device (@{$device->{'pci_bridge'}->{devices}}) {
+		    next if !$bridge_device->{'qdev_id'};
+		    $devices->{$bridge_device->{'qdev_id'}} = 1;
+		    $devices->{$device->{'qdev_id'}}++;
+		}
+	    } else {
+		next if !$device->{'qdev_id'};
+		$devices->{$device->{'qdev_id'}} = 1;
+	    }
 	}
     }
 
-- 
1.7.10.4




More information about the pve-devel mailing list