mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-14 05:53:35 +00:00
get usbdevices in vm_devices_list
since usb devices do not have their own "query" command in qmp, we have to use qom-list /machines/peripheral which essentially gets a list of peripheral devices of the vm there we only get the usb devices Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
d40e5e1852
commit
deb091c500
@ -3244,6 +3244,16 @@ sub vm_devices_list {
|
||||
}
|
||||
}
|
||||
|
||||
# for usb devices there is no query-usb
|
||||
# but we can iterate over the entries in
|
||||
# qom-list path=/machine/peripheral
|
||||
my $resperipheral = vm_mon_cmd($vmid, 'qom-list', path => '/machine/peripheral');
|
||||
foreach my $per (@$resperipheral) {
|
||||
if ($per->{name} =~ m/^usb\d+$/) {
|
||||
$devices->{$per->{name}} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $devices;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user