From ebcb12ee0961c478e46af8dd566a5a5ec53c5b41 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Tue, 10 Jan 2023 13:52:41 +0100 Subject: [PATCH] zfs: list zvol: return empty hash rather than undef MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Avoids the need for the fallback for the (only existing) caller. Note that the old my $list = (); is a rather intransparent way of assigning undef. Suggested-by: Fabian Grünbichler Signed-off-by: Fiona Ebner --- PVE/Storage/ZFSPoolPlugin.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm index f829b86..bce360f 100644 --- a/PVE/Storage/ZFSPoolPlugin.pm +++ b/PVE/Storage/ZFSPoolPlugin.pm @@ -254,7 +254,7 @@ sub free_image { sub list_images { my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_; - my $zfs_list = $class->zfs_list_zvol($scfg) // {}; + my $zfs_list = $class->zfs_list_zvol($scfg); my $res = []; @@ -381,9 +381,9 @@ sub zfs_list_zvol { $scfg->{pool}, ); my $zvols = zfs_parse_zvol_list($text); - return undef if !$zvols; + return {} if !$zvols; - my $list = (); + my $list = {}; foreach my $zvol (@$zvols) { # The "pool" in $scfg is not the same as ZFS pool, so it's necessary to filter here. next if $scfg->{pool} ne $zvol->{pool}; -- 2.39.2