]> git.proxmox.com Git - pve-storage.git/commitdiff
zfs: list zvol: return empty hash rather than undef
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 10 Jan 2023 12:52:41 +0000 (13:52 +0100)
committerWolfgang Bumiller <w.bumiller@errno.eu>
Tue, 10 Jan 2023 13:28:14 +0000 (14:28 +0100)
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 <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/Storage/ZFSPoolPlugin.pm

index f829b86d94baf6a729048d50fd403fe62a72dabc..bce360fbb0973ef02dd7aa0343eb97a7feda0570 100644 (file)
@@ -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};