[lxc-devel] [lxd/master] lxd/init: Auto-detect and use Ubuntu ZFS setup
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Apr 27 17:21:13 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/20200427/d45a9e0f/attachment.bin>
-------------- next part --------------
From 87d16a008b8ce7c6861951268d517a36bee99a23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 27 Apr 2020 13:20:58 -0400
Subject: [PATCH] lxd/init: Auto-detect and use Ubuntu ZFS setup
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/main_init_interactive.go | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lxd/main_init_interactive.go b/lxd/main_init_interactive.go
index 8c848b4adb..9418e8dc11 100644
--- a/lxd/main_init_interactive.go
+++ b/lxd/main_init_interactive.go
@@ -506,6 +506,16 @@ func (c *cmdInit) askStoragePool(config *cmdInitData, d lxd.InstanceServer, pool
}
}
+ // Optimization for zfs on zfs (when using Ubuntu's bpool/rpool)
+ if pool.Driver == "zfs" && backingFs == "zfs" {
+ poolName, _ := shared.RunCommand("zpool", "get", "-H", "-o", "value", "name", "rpool")
+ if strings.TrimSpace(poolName) == "rpool" && cli.AskBool("Would you like to create a new zfs dataset under rpool/lxd? (yes/no) [default=yes]: ", "yes") {
+ pool.Config["source"] = "rpool/lxd"
+ config.Node.StoragePools = append(config.Node.StoragePools, pool)
+ break
+ }
+ }
+
if cli.AskBool(fmt.Sprintf("Create a new %s pool? (yes/no) [default=yes]: ", strings.ToUpper(pool.Driver)), "yes") {
if pool.Driver == "ceph" {
// Ask for the name of the cluster
More information about the lxc-devel
mailing list