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

Alexandre Derumier aderumier at odiso.com
Tue Feb 10 17:23:09 CET 2015


This fix hotplug for devices behind bridges, like nic6->24 for example

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 59441e1..70e2ae6 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3208,8 +3208,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