[lxc-devel] [lxd/master] lxd/storage/drivers/btrfs: Fix quota

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Mar 23 07:54:19 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 644 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200323/17e506e4/attachment.bin>
-------------- next part --------------
From 1114eb11905240aec07ba0673046418fd77b1882 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 23 Mar 2020 08:51:38 +0100
Subject: [PATCH] lxd/storage/drivers/btrfs: Fix quota

This adds the `--raw` flags to `btrfs qgroup show`. The flag is needed
as the sizes in the output are listed with suffixes (KiB, MiB, etc.).
Since `ParseInt` cannot deal with that, it fails and returns -1. Adding
the `--raw` flag removes all suffixes, and returns the correct usage.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/storage/drivers/driver_btrfs_utils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage/drivers/driver_btrfs_utils.go b/lxd/storage/drivers/driver_btrfs_utils.go
index deb3e02ae8..e21ba39c4f 100644
--- a/lxd/storage/drivers/driver_btrfs_utils.go
+++ b/lxd/storage/drivers/driver_btrfs_utils.go
@@ -194,7 +194,7 @@ func (d *btrfs) deleteSubvolume(path string, recursion bool) error {
 
 func (d *btrfs) getQGroup(path string) (string, int64, error) {
 	// Try to get the qgroup details.
-	output, err := shared.RunCommand("btrfs", "qgroup", "show", "-e", "-f", path)
+	output, err := shared.RunCommand("btrfs", "qgroup", "show", "-e", "-f", "--raw", path)
 	if err != nil {
 		return "", -1, errBtrfsNoQuota
 	}


More information about the lxc-devel mailing list