Am 03.12.25 um 2:29 PM schrieb Fiona Ebner:
> diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
> index 36a0ea99..52875010 100644
> --- a/src/PVE/QemuServer/Blockdev.pm
> +++ b/src/PVE/QemuServer/Blockdev.pm
> @@ -161,12 +161,22 @@ sub top_node_name {
>  }
>  
>  sub get_node_name_below_throttle {
> -    my ($vmid, $device_id, $assert_top_is_throttle) = @_;
> +    my ($qmp_peer, $device_id, $assert_top_is_throttle) = @_;
>  
> -    my $block_info = get_block_info($vmid);
> -    my $drive_id = $device_id =~ s/^drive-//r;
> -    my $top = $block_info->{$drive_id}->{inserted}
> -        or die "no block node inserted for drive '$drive_id'\n";
> +    my $top;
> +    if ($qmp_peer->{type} eq 'qmp') { # get_block_info() only works if there 
> are front-end devices.
> +        my $block_info = get_block_info($qmp_peer->{id});
> +        my $drive_id = $device_id =~ s/^drive-//r;
> +        $top = $block_info->{$drive_id}->{inserted}
> +            or die "no block node inserted for drive '$drive_id'\n";
> +    } else {
> +        my $named_block_node_info = qmp_cmd($qmp_peer, 
> 'query-named-block-nodes');
> +        for my $info ($named_block_node_info->@*) {
> +            next if $info->{'node-name'} ne $device_id;
> +            $top = $info;
> +            last;
> +        }

Since I had to look up this code for doing something similar, I now
noticed that there should be a 'die' here if no $top can be found.

> +    }
>  
>      if ($top->{drv} ne 'throttle') {
>          die "$device_id: unexpected top node $top->{'node-name'} 
> ($top->{drv})\n"


_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to