52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
From e7c852e43c0479060e630adb50342d2552a6cdad Mon Sep 17 00:00:00 2001
|
|
From: Thomas Parrott <thomas.parrott@canonical.com>
|
|
Date: Tue, 7 Feb 2023 10:04:27 +0000
|
|
Subject: [PATCH] lxd/storage/drivers/driver/btrfs/utils: Only check for
|
|
minimum number of columns in `btrfs qgroup show` command
|
|
|
|
Previously we expected 4 columns, but in btrfs-progs >= 6.0 this has changed to 5 columns.
|
|
|
|
E.g. in Jammy btrfs-progs v5.16.2:
|
|
|
|
```
|
|
sudo btrfs qgroup show /var/lib/lxd/storage-pools/btrfs
|
|
qgroupid rfer excl
|
|
-------- ---- ----
|
|
0/5 16.00KiB 16.00KiB
|
|
0/256 9.66MiB 400.00KiB
|
|
0/257 9.66MiB 392.00KiB
|
|
```
|
|
|
|
And in Lunar btrfs-progs v6.1.3:
|
|
|
|
```
|
|
btrfs qgroup show /var/lib/lxd/storage-pools/btrfs
|
|
Qgroupid Referenced Exclusive Path
|
|
-------- ---------- --------- ----
|
|
0/5 16.00KiB 16.00KiB <toplevel>
|
|
0/256 9.63MiB 400.00KiB images/1f81470478d136f0008c856e3a47369e0ac863f0402ce0e31c56dd29e9fdd4d7
|
|
0/257 9.64MiB 404.00KiB containers/c1
|
|
```
|
|
|
|
Fixes #11210
|
|
|
|
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
|
|
---
|
|
lxd/storage/drivers/driver_btrfs_utils.go | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lxd/storage/drivers/driver_btrfs_utils.go b/lxd/storage/drivers/driver_btrfs_utils.go
|
|
index e1468e4b1a59..722a2de20978 100644
|
|
--- a/lxd/storage/drivers/driver_btrfs_utils.go
|
|
+++ b/lxd/storage/drivers/driver_btrfs_utils.go
|
|
@@ -253,7 +253,9 @@ func (d *btrfs) getQGroup(path string) (string, int64, error) {
|
|
}
|
|
|
|
fields := strings.Fields(line)
|
|
- if len(fields) != 4 {
|
|
+
|
|
+ // The BTRFS tooling changed the number of columns between versions so we only check for minimum.
|
|
+ if len(fields) < 3 {
|
|
continue
|
|
}
|
|
|