5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-24 02:04:13 +03:00

zfs: list zvol: return empty hash rather than undef

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>
This commit is contained in:
Fiona Ebner 2023-01-10 13:52:41 +01:00 committed by Wolfgang Bumiller
parent b539bb46a8
commit ebcb12ee09

View 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};