From 200644a7f92e5a966a27acc6b1603aed0a838a41 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Tue, 10 Feb 2015 17:23:09 +0100 Subject: [PATCH] vm_devices_list : list devices behind pci bridge This fix hotplug for devices behind bridges, like nic6->24 for example Signed-off-by: Alexandre Derumier --- PVE/QemuServer.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index ee8ee8b2..0e93509e 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; + } } }