[pve-devel] [PATCH storage 2/3] fix #6338: rbd: use image-/snap-spec consistently

Fiona Ebner f.ebner at proxmox.com
Mon May 5 16:24:30 CEST 2025


Am 23.04.25 um 15:59 schrieb Fabian Grünbichler:
> diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
> index 8c67a37..3bb5807 100644
> --- a/src/PVE/Storage/RBDPlugin.pm
> +++ b/src/PVE/Storage/RBDPlugin.pm
> @@ -89,22 +89,17 @@ my $rbd_cmd = sub {
>      my ($scfg, $storeid, $op, @options) = @_;
>  
>      my $cmd_option = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
> -    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
>  
>      my $cmd = ['/usr/bin/rbd'];
> -    if ($op eq 'import') {
> -	push $cmd->@*, '--dest-pool', $pool;
> -    } else {
> +    # `ls` doesn't take an image-spec, otherwise pool and namespace should be specified there
> +    if ($op eq 'ls') {
> +	my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
>  	push $cmd->@*, '-p', $pool;
> +	if (defined($scfg->{namespace})) {
> +	    push @$cmd, '--namespace', $cfg->{namespace};

Typo here that's fixed in next commit

> @@ -890,7 +890,9 @@ sub volume_export {
>  
>      my ($size) = $class->volume_size_info($scfg, $storeid, $volname);
>      PVE::Storage::Plugin::write_common_header($fh, $size);
> -    my $cmd = $rbd_cmd->($scfg, $storeid, 'export', '--export-format', '1', $volname, '-');
> +
> +    my $snap_spec = get_rbd_path($scfg, $volname, $snapshot);
> +    my $cmd = $rbd_cmd->($scfg, $storeid, 'export', '--export-format', '1', $snap_spec, '-');
>      run_rbd_command(
>  	$cmd,
>  	errmsg => 'could not export image',

Oh, so a snapshot was never exported before, but always the image? Mea
culpa. Can only be reached via manual CLI luckily, but still good to get
fixed. You'll need to adapt getting the size too in the lines above,
that still uses just $volname.

Other than those, looks good to me.




More information about the pve-devel mailing list