[pve-devel] [PATCH] Fixes bug in calculating pool size
mir at datanom.net
mir at datanom.net
Sun Oct 13 01:51:41 CEST 2013
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
More information about the pve-devel
mailing list