--- Begin Message ---
Hi Fabian,
> @@ -3937,11 +3937,12 @@ sub vm_devices_list {
> $devices_to_check = $to_check;
> }
>
> + #block devices need to be queried at qdev level, as a device
> + #don't always have a blockdev drive media attached (cdrom for
> example)
> my $resblock = mon_cmd($vmid, 'query-block');
> - foreach my $block (@$resblock) {
> - if($block->{device} =~ m/^drive-(\S+)/){
> - $devices->{$1} = 1;
> - }
> + $resblock = { map { $_->{qdev} => $_ } $resblock->@* };
>>here you map the full thing
> + foreach my $blockid (keys %$resblock) {
> + $devices->{$blockid} = 1;
>>but you are only interested in the IDs anyway?
>>so you could just do it like above for PCI devices:
>>
>>
>>foreach my $block (@$resblock) {
>> my $qdev_id = $block->{qdev};
>> $devices->{$qdev_id} = 1 if $qdev_id;
>>}
>>that way you don't need to loop twice ;)
ok thanks!
>>this now returns more devices than before/different values for some
>>cases? e.g., efidisk0 has a really different qdev ID compared to its
>>device name, the UEFI firmware (pflash0) is also contained even
>>though it is not a drive, and that's just for the first test VM I
>>checked ;)
>>
>>would it maybe make more sense to special-case the CD drive(s) here?
I didn't have converted pflash device yet (I'm currently doing test
with them), as previously the -drive syntax was more a hack (from qemu-
devel discussion I have seen)
so,I need to verify with full blockdev implementation.
(note the vm_devices_list() is only used by hotplug code, to known if a
device is already plugged. so for pflash, they are no impact anyway)
I'll try to send a patch series next week with all your requested
changed.
have a good weekend !
Alexandre
--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel