Remove workarounds for old systemd bugs

These are now resolved:

Were are now later than systemd v231
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1497420
https://github.com/lxc/lxc/issues/713

Change-Id: I3c427bc670815ee5bac677925b56df644f460271
This commit is contained in:
Jonathan Rosser 2021-02-17 17:02:43 +00:00
parent 611e278642
commit 3f8a5b4ca3

View File

@ -74,62 +74,6 @@
tags:
- lxc-config
# NOTE(hwoarang): The previous task only affected newly created services.
# However, for particular systemd versions like v228 the default one for
# started scopes is 512
# See https://github.com/systemd/systemd/commit/9ded9cd14cc03c67291b10a5c42ce5094ba0912f
# This has later been fixed in v231
# https://github.com/systemd/systemd/commit/79baeeb96d58676853521e10a358e85d83dac7f1
# The only way to change the value for already started services and scopes is
# by using the sysfs interface. Moreover, it appears that lxc places itself into the
# init.scope group which is being created during boot and as such it always uses
# the default value. There are variours reports that the init.scope breaks things
# for LXC such as
# https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1497420
# https://github.com/lxc/lxc/issues/713
# https://bugs.archlinux.org/index.php?do=details&action=details.addvote&task_id=47303
# In any case, it's best to also edit the pids controller to ensure that a
# better max value is used in the init.scope
- name: Check that the init.scope support the pid controller
stat:
path: "/sys/fs/cgroup/pids/init.scope/pids.max"
register: _init_scope_pid
tags:
- lxc-config
- block:
- name: Get init.scope pids.max value
slurp:
src: "/sys/fs/cgroup/pids/init.scope/pids.max"
register: init_scope_cgroup_pids_max
changed_when: false
# NOTE(cloudnull): The "shell" module is being used instead of "copy" with
# content as we need direct write access to the sysFS.
- name: Set systemd pids.max in init.scope
shell: "echo {{ lxc_default_tasks_max }} > /sys/fs/cgroup/pids/init.scope/pids.max"
when:
- (init_scope_cgroup_pids_max.content | b64decode) != lxc_default_tasks_max
tags:
- skip_ansible_lint
rescue:
- name: Notice regarding setting the init.scope/pids.max
debug:
msg: |
Failed writing to "/sys/fs/cgroup/pids/init.scope/pids.max". While
we prefer setting this option it's not required. See the following
issues on why this is desired and what can be done when the cgroup
hierarchy exists.
* https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1497420
* https://github.com/lxc/lxc/issues/713
* https://bugs.archlinux.org/index.php?do=details&action=details.addvote&task_id=47303
when: _init_scope_pid.stat.exists
tags:
- lxc-config
# Ensure apparmor reindex runs before other things that may fail
- meta: flush_handlers
- name: Tuning kernel for lxc
sysctl:
name: "{{ item.key }}"