diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index f5b5103e..14635ae8 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2244,6 +2244,32 @@ sub next_migrate_port { die "unable to find free migration port"; } +sub vm_devices_list { + my ($vmid) = @_; + + my $res = vm_monitor_command ($vmid, "info pci", 1); + + my @lines = split ("\n", $res); + my $devices; + my $bus; + my $addr; + my $id; + foreach my $line (@lines) { + $line =~ s/^\s+//; + if ($line =~ m/^Bus (\d+), device (\d+), function (\d+):$/) { + $bus=$1; + $addr=$2; + } + if ($line =~ m/^id "([a-z][a-z_\-]*\d*)"$/) { + $id=$1; + $devices->{$id}->{bus}=$bus; + $devices->{$id}->{addr}=$addr; + } + } + +return $devices; +} + sub vm_start { my ($storecfg, $vmid, $statefile, $skiplock) = @_;