[lxc-devel] [lxd/master] storage: Fix xfs_growfs command for older versions

Ne02ptzero on Github lxc-bot at linuxcontainers.org
Thu Jan 23 21:59:33 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 648 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200123/9b4e8c49/attachment.bin>
-------------- next part --------------
From 341b8679fa73f0d35f949d7599058244aecfc398 Mon Sep 17 00:00:00 2001
From: Louis Solofrizzo <lsolofrizzo at online.net>
Date: Thu, 23 Jan 2020 22:01:08 +0100
Subject: [PATCH] storage: Fix xfs_growfs command for older versions

On debian 9.9 xfs_growfs version, the binary does not accept the block
device as an argument, but the mount point. Since this behavior is also
supported on later versions, I've replaced the command from the block
device to the mount point, in order not to crash older versions of XFS.

Signed-off-by: Louis Solofrizzo <lsolofrizzo at online.net>
---
 lxd/storage/utils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage/utils.go b/lxd/storage/utils.go
index a36580b522..8fc854c05a 100644
--- a/lxd/storage/utils.go
+++ b/lxd/storage/utils.go
@@ -168,7 +168,7 @@ func GrowFileSystem(fsType string, devPath string, mntpoint string) error {
 	case "ext4":
 		msg, err = shared.TryRunCommand("resize2fs", devPath)
 	case "xfs":
-		msg, err = shared.TryRunCommand("xfs_growfs", devPath)
+		msg, err = shared.TryRunCommand("xfs_growfs", mntpoint)
 	case "btrfs":
 		msg, err = shared.TryRunCommand("btrfs", "filesystem", "resize", "max", mntpoint)
 	default:


More information about the lxc-devel mailing list