all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 1/2] lvm thin: status: code cleanup
Date: Fri,  5 Nov 2021 11:29:44 +0100	[thread overview]
Message-ID: <20211105102945.185988-1-f.ebner@proxmox.com> (raw)

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/Storage/LvmThinPlugin.pm | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/PVE/Storage/LvmThinPlugin.pm b/PVE/Storage/LvmThinPlugin.pm
index 4ba6f90..34e57b2 100644
--- a/PVE/Storage/LvmThinPlugin.pm
+++ b/PVE/Storage/LvmThinPlugin.pm
@@ -194,23 +194,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 {
-- 
2.30.2





             reply	other threads:[~2021-11-05 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 10:29 Fabian Ebner [this message]
2021-11-05 10:29 ` [pve-devel] [PATCH storage 2/2] lvm thin: don't assume that a thin pool and its volumes are active Fabian Ebner
2021-11-08  7:49   ` Fabian Ebner
2021-11-10 13:31     ` [pve-devel] applied-series: " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105102945.185988-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal