SUSE: Remove lxc-1.X.X workarounds

openSUSE is now using lxc-2.X.X from the OBS repository in the
lxc_hosts role so there is no need to have the lxc-1.X.X workarounds
anymore.

Change-Id: I6d6df4e15adca696e95ef680fd43c9e013765a4e
This commit is contained in:
Markos Chandras 2017-10-05 15:37:45 +01:00
parent 3c22200109
commit 99687ef5cb
2 changed files with 9 additions and 29 deletions

View File

@ -16,16 +16,11 @@
# 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 }}"

View File

@ -26,29 +26,14 @@
# the '-B' option is used, instead of the more understandable
# '--backingstore'.
# TODO(odyssey4me): Revisit this once a fix has merged
# NOTE(hwoarang) lxc-copy is only available since lxc-2.0.0 so emulate
# its behavior using the old lxc-clone command. This is only a problem
# on openSUSE so it's safe to remove it when lxc-2.X becomes the default
# option for openSUSE in the openstack-ansible-lxc_hosts role.
- block:
- name: Create container (cow)
command: >
lxc-copy --snapshot -B {{ lxc_container_backing_store }}
--name {{ lxc_container_base_name }}
--newname {{ inventory_hostname }}
-L {{ properties.container_fs_size | default(lxc_container_fs_size) }}
--logfile {{ lxc_container_log_path }}/lxc-{{ inventory_hostname }}.log
--logpriority {{ (debug | bool) | ternary('DEBUG', 'INFO') }}
delegate_to: "{{ physical_host }}"
rescue:
# NOTE(hwoarang) lxc-clone does not support the common
# --logfile/logpriority options so we just redirect everything to the log
# which is probably the best we can do.
- name: Create container (cow) (fallback)
shell: >
lxc-clone -s -B {{ lxc_container_backing_store }} -L {{ properties.container_fs_size | default(lxc_container_fs_size) }}
{{ lxc_container_base_name }} {{ inventory_hostname }} &>>
{{ lxc_container_log_path }}/lxc-{{ inventory_hostname }}.log
delegate_to: "{{ physical_host }}"
- name: Create container (cow)
command: >
lxc-copy --snapshot -B {{ lxc_container_backing_store }}
--name {{ lxc_container_base_name }}
--newname {{ inventory_hostname }}
-L {{ properties.container_fs_size | default(lxc_container_fs_size) }}
--logfile {{ lxc_container_log_path }}/lxc-{{ inventory_hostname }}.log
--logpriority {{ (debug | bool) | ternary('DEBUG', 'INFO') }}
delegate_to: "{{ physical_host }}"
when:
- lxc_container_info.rc != 0