[lxc-devel] [lxd/master] lxd/storage/zfs: Fix argument ordering

stgraber on Github lxc-bot at linuxcontainers.org
Wed Oct 21 16:37:12 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 453 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201021/485b8825/attachment.bin>
-------------- next part --------------
From da09d9fec580938778af2daaa199e88cec0303ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 21 Oct 2020 12:36:30 -0400
Subject: [PATCH] lxd/storage/zfs: Fix argument ordering
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On some distributions, the argument parser is very picky and needs
options to be passed first.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage/drivers/driver_zfs_volumes.go | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lxd/storage/drivers/driver_zfs_volumes.go b/lxd/storage/drivers/driver_zfs_volumes.go
index 0f06215306..dd5de84e3a 100644
--- a/lxd/storage/drivers/driver_zfs_volumes.go
+++ b/lxd/storage/drivers/driver_zfs_volumes.go
@@ -565,17 +565,15 @@ func (d *zfs) CreateVolumeFromCopy(vol Volume, srcVol Volume, copySnapshots bool
 		}
 	} else {
 		// Perform volume clone.
-		args := []string{
-			"clone",
-			srcSnapshot,
-			d.dataset(vol, false),
-		}
+		args := []string{"clone"}
 
 		if vol.contentType == ContentTypeBlock {
 			// Use volmode=none so volume is invisible until mounted.
 			args = append(args, "-o", "volmode=none")
 		}
 
+		args = append(args, srcSnapshot, d.dataset(vol, false))
+
 		// Clone the snapshot.
 		_, err := shared.RunCommand("zfs", args...)
 		if err != nil {


More information about the lxc-devel mailing list