]> git.proxmox.com Git - qemu-server.git/commitdiff
vm_devices_list : list devices behind pci bridge
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 10 Feb 2015 16:23:09 +0000 (17:23 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Feb 2015 07:31:22 +0000 (08:31 +0100)
This fix hotplug for devices behind bridges, like nic6->24 for example

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index ee8ee8b2422e49bf3ce055f9ce3b14a649e57177..0e93509e297cf73b5736cadd5c545ea2c730933d 100644 (file)
@@ -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;
+           }
        }
     }