The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6992

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From f36fa5adedb5d25f03084ba65ff27c1a422db553 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 6 Mar 2020 16:32:14 +0100
Subject: [PATCH] lxd/storage/zfs: Fix usage calculation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/storage/drivers/driver_zfs.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lxd/storage/drivers/driver_zfs.go 
b/lxd/storage/drivers/driver_zfs.go
index 0667aa7909..010a2747fa 100644
--- a/lxd/storage/drivers/driver_zfs.go
+++ b/lxd/storage/drivers/driver_zfs.go
@@ -398,12 +398,12 @@ func (d *zfs) Unmount() (bool, error) {
 
 func (d *zfs) GetResources() (*api.ResourcesStoragePool, error) {
        // Get the total amount of space.
-       totalStr, err := d.getDatasetProperty(d.config["zfs.pool_name"], 
"available")
+       availableStr, err := d.getDatasetProperty(d.config["zfs.pool_name"], 
"available")
        if err != nil {
                return nil, err
        }
 
-       total, err := strconv.ParseUint(strings.TrimSpace(totalStr), 10, 64)
+       available, err := strconv.ParseUint(strings.TrimSpace(availableStr), 
10, 64)
        if err != nil {
                return nil, err
        }
@@ -422,7 +422,7 @@ func (d *zfs) GetResources() (*api.ResourcesStoragePool, 
error) {
        // Build the struct.
        // Inode allocation is dynamic so no use in reporting them.
        res := api.ResourcesStoragePool{}
-       res.Space.Total = total
+       res.Space.Total = used + available
        res.Space.Used = used
 
        return &res, nil
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to