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

Alwin Antreich a.antreich at proxmox.com
Wed Sep 5 18:12:48 CEST 2018


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;
 
 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);
 }
-- 
2.11.0




More information about the pve-devel mailing list