]> git.proxmox.com Git - pve-storage.git/commitdiff
rdb: followup cleanups
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 6 Sep 2018 13:19:16 +0000 (15:19 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 6 Sep 2018 13:19:16 +0000 (15:19 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/Storage/RBDPlugin.pm

index c3b0cd96cd0c36f93ec8be01bd365246603d020c..9f0afb681814ffd8b437ba3050b147bad6fa6fc0 100644 (file)
@@ -157,10 +157,7 @@ sub rbd_ls {
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
 
     my $raw = '';
-
-    my $parser = sub {
-       $raw .= shift;
-    };
+    my $parser = sub { $raw .= shift };
 
     eval {
        run_rbd_command($cmd, errmsg => "rbd error", errfunc => sub {}, outfunc => $parser);
@@ -197,29 +194,21 @@ sub rbd_volume_info {
     my $cmd = undef;
 
     my @options = ('info', $volname, '--format', 'json');
-    if($snap){
+    if ($snap) {
        push @options, '--snap', $snap;
     }
 
     $cmd = &$rbd_cmd($scfg, $storeid, @options);
 
-    my $size = undef;
-    my $parent = undef;
-    my $format = undef;
-    my $protected = undef;
-    my $features = undef;
-
     my $raw = '';
-    my $parser = sub {
-       $raw .= shift;
-    };
+    my $parser = sub { $raw .= shift };
 
     run_rbd_command($cmd, errmsg => "rbd error", errfunc => sub {}, outfunc => $parser);
+
     my $volume = $raw ne '' ? JSON::decode_json($raw) : {};
+
     $volume->{parent} = $get_parent_image_name->($volume->{parent});
-    if (defined($volume->{protected})) {
-       $volume->{protected} = $volume->{protected} eq "true" ? 1 : undef;
-    }
+    $volume->{protected} = defined($volume->{protected}) && $volume->{protected} eq "true" ? 1 : undef;
 
     return $volume->@{qw(size parent format protected features)};
 }