]> git.proxmox.com Git - pve-storage.git/commitdiff
lvm thin: status: code cleanup
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 5 Nov 2021 10:29:44 +0000 (11:29 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 10 Nov 2021 13:18:28 +0000 (14:18 +0100)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Storage/LvmThinPlugin.pm

index b0cf3d2701ad22fa77cba4a2386ff861c8aeaa1f..45360db12e6421f1ac02137effd3fbc8d1501b72 100644 (file)
@@ -195,23 +195,15 @@ sub list_thinpools {
 sub status {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    my $lvname = "$scfg->{vgname}/$scfg->{thinpool}";
+    my $lvs = $cache->{lvs} ||= PVE::Storage::LVMPlugin::lvm_list_volumes();
 
-    $cache->{lvs} = PVE::Storage::LVMPlugin::lvm_list_volumes() if !$cache->{lvs};
-
-    my $lvs = $cache->{lvs};
-
-    return undef if !$lvs->{$scfg->{vgname}};
+    return if !$lvs->{$scfg->{vgname}};
 
     my $info = $lvs->{$scfg->{vgname}}->{$scfg->{thinpool}};
 
-    return undef if !$info;
+    return if !$info || $info->{lv_type} ne 't' || !$info->{lv_size};
 
-    return undef if $info->{lv_type} ne 't';
-
-    return ($info->{lv_size}, $info->{lv_size} - $info->{used}, $info->{used}, 1) if $info->{lv_size};
-
-    return undef;
+    return ($info->{lv_size}, $info->{lv_size} - $info->{used}, $info->{used}, 1);
 }
 
 sub activate_volume {