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
1diff --git a/reactive/juju_lxd.py b/reactive/juju_lxd.py
2index 25177e5..7b4d2d9 100644
3--- a/reactive/juju_lxd.py
4+++ b/reactive/juju_lxd.py
5@@ -30,6 +30,7 @@ import grp
6 def install_charm_juju_lxd():
7 git_repo()
8 lxd_init()
9+ limits_config()
10 status_set("active", "Ready")
11 set_state('juju-lxd.installed')
12
13@@ -114,6 +115,41 @@ def lxd_init():
14 pass
15
16
17+def limits_config():
18+ # These settings should be equivalent to those documented here:
19+ # https://github.com/lxc/lxd/blob/master/doc/production-setup.md
20+ # If not, please update.
21+ with open('/etc/security/limits.d/50-juju-lxd.conf', 'w') as outfile:
22+ outfile.write("""\
23+* soft nofile 1048576
24+* hard nofile 1048576
25+root soft nofile 1048576
26+root hard nofile 1048576
27+* soft memlock unlimited
28+* hard memlock unlimited
29+""")
30+ with open('/etc/sysctl.d/50-juju-lxd.conf', 'w') as outfile:
31+ outfile.write("""\
32+fs.inotify.max_queued_events=1048576
33+vm.max_map_count=262144
34+kernel.dmesg_restrict=1
35+net.ipv4.neigh.default.gc_thresh3=8192
36+net.ipv6.neigh.default.gc_thresh3=8192
37+kernel.keys.maxkeys=2000
38+
39+# Skipping max_user_(instances|watches) here due to https://bugs.launchpad.net/juju/+bug/1817774.
40+# Set via /usr/lib/sysctl.d/z50-juju-lxd.conf instead.
41+""")
42+ with open('/usr/lib/sysctl.d/z50-juju-lxd.conf', 'w') as outfile:
43+ outfile.write("""\
44+# These get overridden via /usr/lib/sysctl.d/juju-2.conf; re-setting them here.
45+# (https://bugs.launchpad.net/juju/+bug/1817774)
46+fs.inotify.max_user_instances = 1048576
47+fs.inotify.max_user_watches = 1048576
48+""")
49+ subprocess.call(['systemctl', 'restart', 'systemd-sysctl'])
50+
51+
52 def git_repo():
53 subprocess.call(['git', 'clone',
54 'https://github.com/openstack-charmers/openstack-on-lxd'])

Subscribers

People subscribed via source and target branches

to all changes: