handlers: main: Force kill a container on openSUSE if it takes too long to stop

It appears that lxc-1.1.5 is very slow when stopping a container. As a
result of which we pass the timeout (-t) option on openSUSE whilst this
is being investigated on the distribution level. This can also be
removed when lxc-2.X.X becomes the default option on openSUSE.

Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1054609
Change-Id: I02299cb17477f63970e11ce3c8455cb12773a541
This commit is contained in:
Markos Chandras 2017-08-19 20:33:53 +01:00
parent 723a259607
commit 5209c77270
1 changed files with 5 additions and 0 deletions

View File

@ -16,11 +16,16 @@
# Due to https://github.com/ansible/ansible-modules-extras/issues/2691
# this uses the LXC CLI tools to ensure that we get logging.
# TODO(odyssey4me): revisit this once the bug is fixed and released
# NOTE(hwoarang): We pass the timeout (-t) option on openSUSE due to
# https://bugzilla.opensuse.org/show_bug.cgi?id=1054609. Feel free to
# remove this workaround when the bug is closed or lxc-2.X.X becomes the
# default on openSUSE.
- name: Lxc container restart
command: >
lxc-stop --name {{ inventory_hostname }}
--logfile {{ lxc_container_log_path }}/lxc-{{ inventory_hostname }}.log
--logpriority {{ (debug | bool) | ternary('DEBUG', 'INFO') }}
"{{ (hostvars[physical_host]['ansible_pkg_mgr'] == 'zypper') | ternary('-t 10', '') }}"
notify:
- Start Container
delegate_to: "{{ physical_host }}"