[lxc-devel] [lxd/master] zfs: load kernel module in case it isn't

brauner on Github lxc-bot at linuxcontainers.org
Wed Mar 15 00:17:11 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170315/ddb02d7c/attachment.bin>
-------------- next part --------------
From 0b268450819f47185bfe6142bbe630a89c1f52fa Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 15 Mar 2017 01:15:11 +0100
Subject: [PATCH] zfs: load kernel module in case it isn't

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/storage_zfs.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 1d3cc86..011de41 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -63,6 +63,13 @@ func (s *storageZfs) StorageCoreInit() error {
 	}
 	s.sTypeName = typeName
 
+	if !shared.RunningInUserNS() {
+		err := loadModule("zfs")
+		if err != nil {
+			return fmt.Errorf("Failed to load ZFS kernel module.")
+		}
+	}
+
 	if !zfsIsEnabled() {
 		return fmt.Errorf("The \"zfs\" tool is not enabled.")
 	}


More information about the lxc-devel mailing list