[pve-devel] [PATCH] Fixes bug in calculating pool size

Dietmar Maurer dietmar at proxmox.com
Mon Oct 14 07:21:31 CEST 2013


applied, thanks.

> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of mir at datanom.net
> Sent: Sonntag, 13. Oktober 2013 01:52
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH] Fixes bug in calculating pool size
> 
> From: Michael Rasmussen <mir at datanom.net>
> 
> Signed-off-by: Michael Rasmussen <mir at datanom.net>
> ---
>  PVE/Storage/ZFSPlugin.pm | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm index
> efcdd04..a50f7cb 100644
> --- a/PVE/Storage/ZFSPlugin.pm
> +++ b/PVE/Storage/ZFSPlugin.pm
> @@ -93,7 +93,7 @@ sub zfs_parse_size {
>  sub zfs_get_pool_stats {
>      my ($scfg) = @_;
> 
> -    my $size = 0;
> +    my $available = 0;
>      my $used = 0;
> 
>      my $text = zfs_request($scfg, undef, 'get', '-o', 'value', '-Hp', @@ -102,14
> +102,14 @@ sub zfs_get_pool_stats {
>      my @lines = split /\n/, $text;
> 
>      if($lines[0] =~ /^(\d+)$/) {
> -	$size = $1;
> +	$available = $1;
>      }
> 
>      if($lines[1] =~ /^(\d+)$/) {
>  	$used = $1;
>      }
> 
> -    return ($size, $used);
> +    return ($available, $used);
>  }
> 
>  sub zfs_parse_zvol_list {
> @@ -512,9 +512,9 @@ sub status {
>      my $active = 0;
> 
>      eval {
> -	($total, $used) = zfs_get_pool_stats($scfg);
> +	($free, $used) = zfs_get_pool_stats($scfg);
>  	$active = 1;
> -	$free = $total - $used;
> +	$total = $free + $used;
>      };
>      warn $@ if $@;
> 
> --
> 1.8.4.rc3
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel





More information about the pve-devel mailing list