You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-containers/lxd/files/lxd-5.0.2-fix-btrfs-driver-...

28 lines
1.1 KiB

From 37779fd75dbcd02fab03a8327a1ec7a6f3273371 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott@canonical.com>
Date: Wed, 4 Jan 2023 09:59:37 +0000
Subject: [PATCH] lxd/storage/drivers/driver/btrfs/utils: Fix getQGroup to
suport BTRFS >= 6.0.1
Fixes #11210
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
---
lxd/storage/drivers/driver_btrfs_utils.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lxd/storage/drivers/driver_btrfs_utils.go b/lxd/storage/drivers/driver_btrfs_utils.go
index 8f0846d2fc9f..e1468e4b1a59 100644
--- a/lxd/storage/drivers/driver_btrfs_utils.go
+++ b/lxd/storage/drivers/driver_btrfs_utils.go
@@ -247,7 +247,8 @@ func (d *btrfs) getQGroup(path string) (string, int64, error) {
var qgroup string
usage := int64(-1)
for _, line := range strings.Split(output, "\n") {
- if line == "" || strings.HasPrefix(line, "qgroupid") || strings.HasPrefix(line, "---") {
+ // Use case-insensitive field title match because BTRFS tooling changed casing between versions.
+ if line == "" || strings.HasPrefix(strings.ToLower(line), "qgroupid") || strings.HasPrefix(line, "-") {
continue
}