Merge ~vultaire/charm-juju-lxd:limit-fixes into ~afreiberger/charm-juju-lxd:init_with_dir_storage

Proposed by Paul Goins
Status: Needs review
Proposed branch: ~vultaire/charm-juju-lxd:limit-fixes
Merge into: ~afreiberger/charm-juju-lxd:init_with_dir_storage
Diff against target: 54 lines (+36/-0)
1 file modified
reactive/juju_lxd.py (+36/-0)
Reviewer Review Type Date Requested Status
Drew Freiberger Needs Fixing
Review via email: mp+370770@code.launchpad.net
To post a comment you must log in.
~vultaire/charm-juju-lxd:limit-fixes updated
fe1eab5... by Paul Goins

Minor fix

Revision history for this message
Drew Freiberger (afreiberger) wrote :

I'd like to see these added as templatable files with associated configs.

Let's at least start by making them files installed through charmhelpers.core.templating.render() and we can work on the config/jinja context bits in the future.

review: Needs Fixing
Revision history for this message
Paul Goins (vultaire) wrote :

Sounds good; will do.

Unmerged commits

fe1eab5... by Paul Goins

Minor fix

c6a37b8... by Paul Goins

Adding config for LXD production setup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/reactive/juju_lxd.py b/reactive/juju_lxd.py
index 25177e5..7b4d2d9 100644
--- a/reactive/juju_lxd.py
+++ b/reactive/juju_lxd.py
@@ -30,6 +30,7 @@ import grp
30def install_charm_juju_lxd():30def install_charm_juju_lxd():
31 git_repo()31 git_repo()
32 lxd_init()32 lxd_init()
33 limits_config()
33 status_set("active", "Ready")34 status_set("active", "Ready")
34 set_state('juju-lxd.installed')35 set_state('juju-lxd.installed')
3536
@@ -114,6 +115,41 @@ def lxd_init():
114 pass115 pass
115116
116117
118def limits_config():
119 # These settings should be equivalent to those documented here:
120 # https://github.com/lxc/lxd/blob/master/doc/production-setup.md
121 # If not, please update.
122 with open('/etc/security/limits.d/50-juju-lxd.conf', 'w') as outfile:
123 outfile.write("""\
124* soft nofile 1048576
125* hard nofile 1048576
126root soft nofile 1048576
127root hard nofile 1048576
128* soft memlock unlimited
129* hard memlock unlimited
130""")
131 with open('/etc/sysctl.d/50-juju-lxd.conf', 'w') as outfile:
132 outfile.write("""\
133fs.inotify.max_queued_events=1048576
134vm.max_map_count=262144
135kernel.dmesg_restrict=1
136net.ipv4.neigh.default.gc_thresh3=8192
137net.ipv6.neigh.default.gc_thresh3=8192
138kernel.keys.maxkeys=2000
139
140# Skipping max_user_(instances|watches) here due to https://bugs.launchpad.net/juju/+bug/1817774.
141# Set via /usr/lib/sysctl.d/z50-juju-lxd.conf instead.
142""")
143 with open('/usr/lib/sysctl.d/z50-juju-lxd.conf', 'w') as outfile:
144 outfile.write("""\
145# These get overridden via /usr/lib/sysctl.d/juju-2.conf; re-setting them here.
146# (https://bugs.launchpad.net/juju/+bug/1817774)
147fs.inotify.max_user_instances = 1048576
148fs.inotify.max_user_watches = 1048576
149""")
150 subprocess.call(['systemctl', 'restart', 'systemd-sysctl'])
151
152
117def git_repo():153def git_repo():
118 subprocess.call(['git', 'clone',154 subprocess.call(['git', 'clone',
119 'https://github.com/openstack-charmers/openstack-on-lxd'])155 'https://github.com/openstack-charmers/openstack-on-lxd'])

Subscribers

People subscribed via source and target branches

to all changes: