Merge ~afreiberger/charm-juju-lxd:init_with_dir_storage into charm-juju-lxd:master

Proposed by Drew Freiberger
Status: Merged
Approved by: Drew Freiberger
Approved revision: 7c963765a20f9b336b3701f696a67c181a810432
Merged at revision: 800a2b94ffc553bfecccbac2489721b08e507178
Proposed branch: ~afreiberger/charm-juju-lxd:init_with_dir_storage
Merge into: charm-juju-lxd:master
Diff against target: 39 lines (+14/-3)
2 files modified
config.yaml (+4/-0)
reactive/juju_lxd.py (+10/-3)
Reviewer Review Type Date Requested Status
Chris Sanders (community) Approve
Review via email: mp+362753@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Drew Freiberger (afreiberger) wrote :

This is untested. we should add this as a new charm to yobuko, and rebuild one of the boxes under this charm to test dir-based lxd deployment. Charmlab3/ewah is free for this from my perspective.

This change is necessary to work around https://github.com/conjure-up/conjure-up/issues/1430 where kubernetes-worker won't run kubelet service under a zfs/btrfs backed lxd.

Revision history for this message
Chris Sanders (chris.sanders) wrote :

lgtm, one day testing for this charm would be nice, but I wouldn't block on a complete port of testing just to land this change in the charm lab.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index 698900c..8db0ec4 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -3,3 +3,7 @@ options:
6 type: string
7 default: "bootstack-squad"
8 description: user group that should have members added to local lxd group
9+ use-zfs:
10+ type: boolean
11+ default: false
12+ description: Whether to use zfs backend for LXD storage - default is dir
13diff --git a/reactive/juju_lxd.py b/reactive/juju_lxd.py
14index c48a917..c6c83ff 100644
15--- a/reactive/juju_lxd.py
16+++ b/reactive/juju_lxd.py
17@@ -78,12 +78,19 @@ def check_reconfig():
18 def lxd_init():
19 # f = open("files/lxd-init-preseed.yaml", "r")
20 # subprocess.call(['lxd', 'init', '--preseed'], stdin=f)
21+ config = hookenv.config()
22+ use_zfs = config.get('use-zfs')
23+
24 subprocess.call(['apt-get', '-t', 'xenial-backports', 'install', '-y',
25 'lxd', 'lxd-client'])
26
27- subprocess.call(['lxd', 'init', '--auto', '--storage-backend', 'zfs',
28- '--storage-pool', 'lxd', '--storage-create-loop', '100'])
29- subprocess.call(['zpool', 'set', 'autoexpand=on', 'lxd'])
30+ if use_zfs:
31+ subprocess.call(['lxd', 'init', '--auto', '--storage-backend', 'zfs',
32+ '--storage-pool', 'lxd', '--storage-create-loop', '100'])
33+ subprocess.call(['zpool', 'set', 'autoexpand=on', 'lxd'])
34+ else:
35+ subprocess.call(['lxd', 'init', '--auto', '--storage-backend', 'dir'])
36+
37
38 subprocess.call(['lxc', 'network', 'delete', 'lxdbr0'])
39 subprocess.call(['lxc', 'network', 'create', 'lxdbr0',

Subscribers

People subscribed via source and target branches

to all changes: