summaryrefslogtreecommitdiff
path: root/app-containers/lxd/files/lxd-5.0.2-fix-btrfs-driver-to-support-btrfs-6.0.patch
blob: c6cf6c97b01373b92f7d811879cc9ba194ea1c5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
 		}