[pve-devel] applied: [PATCH storage 4/8] extend list_thinpools for multiple vgs and more information
Dietmar Maurer
dietmar at proxmox.com
Thu Aug 2 11:14:56 CEST 2018
applied a simplified version (no verbose flag)
--- a/PVE/Storage/LvmThinPlugin.pm
+++ b/PVE/Storage/LvmThinPlugin.pm
@@ -180,9 +180,13 @@ sub list_thinpools {
my $lvs = PVE::Storage::LVMPlugin::lvm_list_volumes($vg);
my $thinpools = [];
- foreach my $lvname (keys %{$lvs->{$vg}}) {
- next if $lvs->{$vg}->{$lvname}->{lv_type} ne 't';
- push @$thinpools, { lv => $lvname };
+ foreach my $vg (keys %$lvs) {
+ foreach my $lvname (keys %{$lvs->{$vg}}) {
+ next if $lvs->{$vg}->{$lvname}->{lv_type} ne 't';
+ my $lv = $lvs->{$vg}->{$lvname};
+ $lv->{lv} = $lvname;
+ push @$thinpools, $lv;
+ }
}
return $thinpools;
> On July 30, 2018 at 10:26 AM Dominik Csapak <d.csapak at proxmox.com> wrote:
>
>
> if no vg is given, give back all thinpools from all vgs
> if verbose is 1, then give back the information about the thinpools
> (like size and free)
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> PVE/Storage/LvmThinPlugin.pm | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/PVE/Storage/LvmThinPlugin.pm b/PVE/Storage/LvmThinPlugin.pm
> index db25ee3..c1719d6 100644
> --- a/PVE/Storage/LvmThinPlugin.pm
> +++ b/PVE/Storage/LvmThinPlugin.pm
> @@ -175,14 +175,23 @@ sub list_images {
> }
>
> sub list_thinpools {
> - my ($vg) = @_;
> + my ($vg, $verbose) = @_;
>
> my $lvs = PVE::Storage::LVMPlugin::lvm_list_volumes($vg);
> my $thinpools = [];
> -
> - foreach my $lvname (keys %{$lvs->{$vg}}) {
> - next if $lvs->{$vg}->{$lvname}->{lv_type} ne 't';
> - push @$thinpools, { lv => $lvname };
> + my $vgs = defined($vg) ? [ $vg ] : [keys %$lvs];
> +
> + foreach my $vg (@$vgs) {
> + foreach my $lvname (keys %{$lvs->{$vg}}) {
> + next if $lvs->{$vg}->{$lvname}->{lv_type} ne 't';
> + if ($verbose) {
> + my $lv = $lvs->{$vg}->{$lvname};
> + $lv->{lv} = $lvname;
> + push @$thinpools, $lv;
> + } else {
> + push @$thinpools, { lv => $lvname };
> + }
> + }
> }
>
> return $thinpools;
> --
> 2.11.0
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list