[lxc-devel] [lxd/master] lxd/storage/zfs: Fix set on 0.6

stgraber on Github lxc-bot at linuxcontainers.org
Mon Jan 13 22:15:22 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200113/ed3a09c9/attachment.bin>
-------------- next part --------------
From 122343725742ffe2d17b26f49a7043a44757c560 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 13 Jan 2020 17:15:03 -0500
Subject: [PATCH] lxd/storage/zfs: Fix set on 0.6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/lxd/storage/drivers/driver_zfs_utils.go b/lxd/storage/drivers/driver_zfs_utils.go
index 5fb81cd2a5..f0c1624a56 100644
--- a/lxd/storage/drivers/driver_zfs_utils.go
+++ b/lxd/storage/drivers/driver_zfs_utils.go
@@ -123,6 +123,18 @@ func (d *zfs) getDatasets(dataset string) ([]string, error) {
 }
 
 func (d *zfs) setDatasetProperties(dataset string, options ...string) error {
+	if len(zfsVersion) >= 3 && zfsVersion[0:3] == "0.6" {
+		// Slow path for ZFS 0.6
+		for _, option := range options {
+			_, err := shared.RunCommand("zfs", "set", option, dataset)
+			if err != nil {
+				return err
+			}
+		}
+
+		return nil
+	}
+
 	args := []string{"set"}
 	args = append(args, options...)
 	args = append(args, dataset)


More information about the lxc-devel mailing list