[pve-devel] [PATCH storage] Addition to fix #1895, use feature array directly

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Sep 6 08:50:30 CEST 2018


On 9/5/18 6:12 PM, Alwin Antreich wrote:
> The rbd_volume_info can return the feature array directly, no need for keeping
> the conversion into a string.
> 
> Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
> ---
> Cloning on a krbd enabled storage broke with the fix #1895, this patch made it
> work on my cluster.
> 
>  PVE/Storage/RBDPlugin.pm | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
> index 9536531..a069273 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -10,6 +10,7 @@ use PVE::JSONSchema qw(get_standard_option);
>  use PVE::RADOS;
>  use PVE::Storage::CephTools;
>  use JSON;
> +use Data::Dumper;

please don't introduce 'Data::Dumper' usages if not really needed,
just left-over debug code, I'd guess ;)


else looks OK, as rbd_volume_info gets only used here in this module,
and features gets only used by the $krbd_feature_disable sub.

>  >  use base qw(PVE::Storage::Plugin);
>  
> @@ -83,7 +84,7 @@ my $krbd_feature_disable = sub {
>      my $krbd_feature_blacklist = ['deep-flatten', 'fast-diff', 'object-map', 'exclusive-lock'];
>      my (undef, undef, undef, undef, $features) = rbd_volume_info($scfg, $storeid, $name);
>  
> -    my $active_features = { map { $_ => 1 } PVE::Tools::split_list($features)};
> +    my $active_features = { map { $_ => 1 } @$features };
>      my $incompatible_features = join(',', grep { %$active_features{$_} } @$krbd_feature_blacklist);
>  
>      if ($incompatible_features) {
> @@ -221,15 +222,13 @@ sub rbd_volume_info {
>      my $r = JSON::decode_json($raw);
>      $size = $r->{size};
>      $format = $r->{format};
> +    $features = $r->{features};
>      if ($r->{parent}) {
>  	$parent = $r->{parent}->{image}.'@'.$r->{parent}->{snapshot};
>      }
>      if ($r->{protected}) {
>  	$protected = 1 if $r->{protected} eq "true";
>      }
> -    if ($r->{features}) {
> -	$features = join (', ', $r->{features});
> -    }
>  
>      return ($size, $parent, $format, $protected, $features);
>  }
> 




More information about the pve-devel mailing list