Add lxc.haltsignal to container configs

This change adds the lxc.haltsignal option to the container config which
ensures containers are gracefully stopped but quickly.

Presently, when a container is restart they can hang for 20 - 30 seconds
which is due to the fact that the default stop signal is SIGPWR.
While the hang when stopping a container is not 100% reproducible in all
environments it can be seen when simply executing `lxc-stop`. If the
user were to stream the container journal while stopping the container
it's would be seen that the container hangs when trying to shutdown some
systemd services. If the `lxc-stop` command is executed a second time the
container is stopped more forcibly with SIGRTMIN+3. This change is using
an example stop signal from the lxc documentation [0] which is
implementing a Real-time signal, SIGRTMIN+n. More on the signal used can
be found here [1].

[0] http://manpages.ubuntu.com/manpages/xenial/en/man5/lxc.container.conf.5.html
[1] http://manpages.ubuntu.com/manpages/xenial/en/man7/signal.7.html

Change-Id: I01e82eabf17d2ac5a89c13ef56616fd1fe0607dd
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-03-17 01:19:39 -05:00 committed by Kevin Carter (cloudnull)
parent f2b3780c8d
commit a372183af9
1 changed files with 2 additions and 2 deletions

View File

@ -165,8 +165,7 @@
mode: "0755"
delegate_to: "{{ physical_host }}"
# This is being defined due to an issue with dangling veth pairs.
- name: Defines a pre and post hook script
- name: Defines a pre, post, and haltsignal configs
lineinfile:
dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
line: "{{ item }}"
@ -174,6 +173,7 @@
with_items:
- "lxc.hook.pre-start = /var/lib/lxc/{{ inventory_hostname }}/veth-cleanup.sh"
- "lxc.hook.post-stop = /var/lib/lxc/{{ inventory_hostname }}/veth-cleanup.sh"
- "lxc.haltsignal = SIGRTMIN+4"
delegate_to: "{{ physical_host }}"
- name: Run veth wiring