[lxc-devel] [lxd/master] lxd/storage/zfs: Skip volmode on 0.6

stgraber on Github lxc-bot at linuxcontainers.org
Thu Feb 27 13:31:32 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/20200227/aa3dfa68/attachment-0001.bin>
-------------- next part --------------
From 7c824cfed876dc94483edf841dd03e3656b65a21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 27 Feb 2020 08:31:07 -0500
Subject: [PATCH] lxd/storage/zfs: Skip volmode 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.go         | 6 +++++-
 lxd/storage/drivers/driver_zfs_patches.go | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lxd/storage/drivers/driver_zfs.go b/lxd/storage/drivers/driver_zfs.go
index d4c584afe5..0667aa7909 100644
--- a/lxd/storage/drivers/driver_zfs.go
+++ b/lxd/storage/drivers/driver_zfs.go
@@ -245,7 +245,11 @@ func (d *zfs) Create() error {
 
 		properties := []string{"mountpoint=none"}
 		if shared.StringInSlice(dataset, []string{"virtual-machines", "deleted/virtual-machines"}) {
-			properties = append(properties, "volmode=none")
+			if len(zfsVersion) >= 3 && zfsVersion[0:3] == "0.6" {
+				d.logger.Warn("Unable to set volmode on parent virtual-machines datasets due to ZFS being too old")
+			} else {
+				properties = append(properties, "volmode=none")
+			}
 		}
 
 		err := d.createDataset(filepath.Join(d.config["zfs.pool_name"], dataset), properties...)
diff --git a/lxd/storage/drivers/driver_zfs_patches.go b/lxd/storage/drivers/driver_zfs_patches.go
index ae147a7834..abf8d09879 100644
--- a/lxd/storage/drivers/driver_zfs_patches.go
+++ b/lxd/storage/drivers/driver_zfs_patches.go
@@ -88,6 +88,11 @@ func (d *zfs) patchStorageZFSMount() error {
 }
 
 func (d *zfs) patchStorageZFSVolMode() error {
+	if len(zfsVersion) >= 3 && zfsVersion[0:3] == "0.6" {
+		d.logger.Warn("Unable to set volmode on parent virtual-machines datasets due to ZFS being too old")
+		return nil
+	}
+
 	// Set volmode=none on the parent virtual-machines directory
 	err := d.setDatasetProperties(filepath.Join(d.config["zfs.pool_name"], "virtual-machines"), "volmode=none")
 	if err != nil {


More information about the lxc-devel mailing list