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:
Dominik Csapak 2016-06-14 10:50:38 +02:00 committed by Wolfgang Bumiller
parent d40e5e1852
commit deb091c500

View File

@ -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;
}