mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-05 10:50:32 +00:00
add vm_devices_list sub
parse qemu "info pci" result Signed-off-by: Derumier Alexandre <aderumier@odiso.com>
This commit is contained in:
parent
2ff09f52e8
commit
86fdcfb229
@ -2244,6 +2244,32 @@ sub next_migrate_port {
|
|||||||
die "unable to find free migration 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 {
|
sub vm_start {
|
||||||
my ($storecfg, $vmid, $statefile, $skiplock) = @_;
|
my ($storecfg, $vmid, $statefile, $skiplock) = @_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user