fix #1405: sort pci ids by functions

QemuServer::lspci() iterates over /sys/bus/pci/devices which
doesn't guarantee any order which means functions sometimes
ended up in the wrong order and it was never clear which
one would get the additional options such as x-vga passed
to them.
This commit is contained in:
Wolfgang Bumiller 2017-06-08 09:18:25 +02:00 committed by Dietmar Maurer
parent ba5acf88a1
commit 5ee3847149

View File

@ -6304,6 +6304,12 @@ sub lspci {
push @{$devices->{$id}}, $res;
});
# Entries should be sorted by functions.
foreach my $id (keys %$devices) {
my $dev = $devices->{$id};
$devices->{$id} = [ sort { $a->{function} <=> $b->{function} } @$dev ];
}
return $devices;
}