[lxc-devel] [lxd/master] Fix interactive lxd init failing to join a cluster with an existing zfs dataset
freeekanayaka on Github
lxc-bot at linuxcontainers.org
Wed Apr 4 08:12:19 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1100 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180404/71079d36/attachment.bin>
-------------- next part --------------
From 8073743b5a571a3d37acd8451e12dd8553c6c932 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Wed, 4 Apr 2018 08:04:59 +0000
Subject: [PATCH] Fix lxd init failing to join a cluster in interactive mode
with an existing zfs dataset
AFAIU, we were passing to POST /1.0/storage-pools some internal config keys that
are generated by LXD when it handles the request, and shouldn't be included in
the request payload.
For some reason doing that didn't break in the case where you were creating a
new zfs pool (setting "source" to a block device), but it does break when
setting "source" to an existing zfs pool name.
I manually tested the fix to confirm it works, since at the moment we don't have
a way to run lxd init interactively in integration tests (the main issue is how
to ask for the trust password).
The lxd init --preseed case was not affected by this bug, as long as you avoid
including those internal config keys in your YAML.
Closes #4404.
Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
lxd/main_init_interactive.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/main_init_interactive.go b/lxd/main_init_interactive.go
index 898632010..240acf0da 100644
--- a/lxd/main_init_interactive.go
+++ b/lxd/main_init_interactive.go
@@ -189,6 +189,10 @@ func (c *cmdInit) askClustering(config *initData, d lxd.ContainerServer) error {
Name: pool.Name,
}
+ // Delete config keys that are automatically populated by LXD
+ delete(newPool.Config, "volatile.initial_source")
+ delete(newPool.Config, "zfs.pool_name")
+
// Only ask for the node-specific "source" key if it's defined in the target node
if pool.Config["source"] != "" {
// Dummy validator for allowing empty strings
More information about the lxc-devel
mailing list