[pve-devel] [PATCH storage v2 1/3] zfspoolplugin: activate_storage: minor cleanup

Stoiko Ivanov s.ivanov at proxmox.com
Fri Feb 19 13:45:42 CET 2021


Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 105d802..be7b1b9 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -529,22 +529,20 @@ sub activate_storage {
     $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) };
-	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!
-	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
-	    die "could not activate storage '$storeid', $@\n" if !$pool_imported->();
+	    die "could not activate storage '$storeid', $err\n" if !$pool_imported->();
 	}
     }
     return 1;
-- 
2.20.1






More information about the pve-devel mailing list