]> git.proxmox.com Git - pve-storage.git/commitdiff
zfspoolplugin: activate_storage: minor cleanup
authorStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 19 Feb 2021 12:45:42 +0000 (13:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 19 Feb 2021 13:18:06 +0000 (14:18 +0100)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PVE/Storage/ZFSPoolPlugin.pm

index 105d802c7a586592f204900e32683ca1c5fdbf71..be7b1b92b224e6081a44e2644af4b0436a399c25 100644 (file)
@@ -529,22 +529,20 @@ sub activate_storage {
     $pool =~ s!/.*$!!;
 
     my $pool_imported = sub {
     $pool =~ s!/.*$!!;
 
     my $pool_imported = sub {
-       my @param = ('-o', 'name', '-H', "$pool");
+       my @param = ('-o', 'name', '-H', $pool);
        my $res = eval { $class->zfs_request($scfg, undef, 'zpool_list', @param) };
        my $res = eval { $class->zfs_request($scfg, undef, 'zpool_list', @param) };
-       if ($@) {
-           warn "$@\n";
-           return undef;
-       }
+       warn "$@\n" if $@;
+
        return defined($res) && $res =~ m/$pool/;
     };
 
     if (!$pool_imported->()) {
        # import can only be done if not yet imported!
        return defined($res) && $res =~ m/$pool/;
     };
 
     if (!$pool_imported->()) {
        # import can only be done if not yet imported!
-       my @param = ('-d', '/dev/disk/by-id/', '-o', 'cachefile=none', "$pool");
+       my @param = ('-d', '/dev/disk/by-id/', '-o', 'cachefile=none', $pool);
        eval { $class->zfs_request($scfg, undef, 'zpool_import', @param) };
        if (my $err = $@) {
            # just could've raced with another import, so recheck if it is imported
        eval { $class->zfs_request($scfg, undef, 'zpool_import', @param) };
        if (my $err = $@) {
            # just could've raced with another import, so recheck if it is imported
-           die "could not activate storage '$storeid', $@\n" if !$pool_imported->();
+           die "could not activate storage '$storeid', $err\n" if !$pool_imported->();
        }
     }
     return 1;
        }
     }
     return 1;