[lxc-devel] [lxd/master] lxd/storage/drivers/utils: Corrects argument order of mkfs in makeFSType for wider compatibility
tomponline on Github
lxc-bot at linuxcontainers.org
Mon Sep 14 08:52:18 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 376 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200914/b10b00e9/attachment.bin>
-------------- next part --------------
From 5f925f00a4c9f967bdefd809cae5f7afb7aade84 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 14 Sep 2020 09:49:22 +0100
Subject: [PATCH] lxd/storage/drivers/utils: Corrects argument order of mkfs in
makeFSType for wider compatibility
Fixes #7858
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage/drivers/utils.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lxd/storage/drivers/utils.go b/lxd/storage/drivers/utils.go
index 0408e2fc64..437efda622 100644
--- a/lxd/storage/drivers/utils.go
+++ b/lxd/storage/drivers/utils.go
@@ -384,7 +384,7 @@ func makeFSType(path string, fsType string, options *mkfsOptions) (string, error
fsOptions = &mkfsOptions{}
}
- cmd := []string{fmt.Sprintf("mkfs.%s", fsType), path}
+ cmd := []string{fmt.Sprintf("mkfs.%s", fsType)}
if fsOptions.Label != "" {
cmd = append(cmd, "-L", fsOptions.Label)
}
@@ -393,6 +393,9 @@ func makeFSType(path string, fsType string, options *mkfsOptions) (string, error
cmd = append(cmd, "-E", "nodiscard,lazy_itable_init=0,lazy_journal_init=0")
}
+ // Always add the path to the device as the last argument for wider compatibility with versions of mkfs.
+ cmd = append(cmd, path)
+
msg, err = shared.TryRunCommand(cmd[0], cmd[1:]...)
if err != nil {
return msg, err
More information about the lxc-devel
mailing list