Add boot priorities to containers

This change adds boot priorities to some container types where it'd be
beneficial. LXC allows containers with higher priority values to be
started ahead of others. The container default is 0 and all integers
greater than 0 will be started in descending order.

This change has no upgrade impact as the additional config is only used
on boot and will not require a container to be restarted.

Change-Id: I89703a24516d47d560c9c888538c384ad2228eb7
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-11-05 17:18:45 -05:00 committed by Jesse Pretorius (odyssey4me)
parent 3b8601fdaa
commit 11c7b27235
10 changed files with 44 additions and 0 deletions

View File

@ -81,6 +81,16 @@
register: _ec register: _ec
when: not is_metal | bool when: not is_metal | bool
- name: Extra lxc config no restart
lineinfile:
dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
line: "{{ item.split('=')[0] }} = {{ item.split('=', 1)[1] }}"
insertafter: "^{{ item.split('=')[0] }}"
backup: "true"
with_items: "{{ extra_container_config_no_restart | default([]) }}"
delegate_to: "{{ physical_host }}"
when: not is_metal | bool
# Due to https://github.com/ansible/ansible-modules-extras/issues/2691 # Due to https://github.com/ansible/ansible-modules-extras/issues/2691
# this uses the LXC CLI tools to ensure that we get logging. # this uses the LXC CLI tools to ensure that we get logging.
# TODO(odyssey4me): revisit this once the bug is fixed and released # TODO(odyssey4me): revisit this once the bug is fixed and released

View File

@ -29,6 +29,8 @@
list_of_bind_mounts: list_of_bind_mounts:
- bind_dir_path: "/var/lib/mysql" - bind_dir_path: "/var/lib/mysql"
mount_path: "/openstack/{{ inventory_hostname }}" mount_path: "/openstack/{{ inventory_hostname }}"
extra_container_config_no_restart:
- "lxc.start.order=99"
- include: common-tasks/package-cache-proxy.yml - include: common-tasks/package-cache-proxy.yml
vars: vars:
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"

View File

@ -51,6 +51,8 @@
- "lxc.autodev=0" - "lxc.autodev=0"
- "lxc.cgroup.devices.allow=a *:* rmw" - "lxc.cgroup.devices.allow=a *:* rmw"
- "lxc.mount.entry=udev dev devtmpfs defaults 0 0" - "lxc.mount.entry=udev dev devtmpfs defaults 0 0"
extra_container_config_no_restart:
- "lxc.start.order=79"
when: when:
- inventory_hostname in groups['cinder_volume'] - inventory_hostname in groups['cinder_volume']
- cinder_backend_lvm_inuse | bool - cinder_backend_lvm_inuse | bool

View File

@ -20,6 +20,9 @@
user: root user: root
pre_tasks: pre_tasks:
- include: common-tasks/os-lxc-container-setup.yml - include: common-tasks/os-lxc-container-setup.yml
vars:
extra_container_config_no_restart:
- "lxc.start.order=89"
- include: common-tasks/rabbitmq-vhost-user.yml - include: common-tasks/rabbitmq-vhost-user.yml
static: no static: no
vars: vars:

View File

@ -28,6 +28,8 @@
mount_path: "/lib/modules" mount_path: "/lib/modules"
extra_container_config: extra_container_config:
- "lxc.cgroup.devices.allow=a *:* rmw" - "lxc.cgroup.devices.allow=a *:* rmw"
extra_container_config_no_restart:
- "lxc.start.order=79"
when: when:
- inventory_hostname in groups['neutron_agent'] - inventory_hostname in groups['neutron_agent']
- ansible_pkg_mgr == 'apt' - ansible_pkg_mgr == 'apt'

View File

@ -20,6 +20,9 @@
user: root user: root
pre_tasks: pre_tasks:
- include: common-tasks/os-lxc-container-setup.yml - include: common-tasks/os-lxc-container-setup.yml
vars:
extra_container_config_no_restart:
- "lxc.start.order=69"
- include: common-tasks/rabbitmq-vhost-user.yml - include: common-tasks/rabbitmq-vhost-user.yml
static: no static: no
vars: vars:

View File

@ -20,6 +20,9 @@
user: root user: root
pre_tasks: pre_tasks:
- include: common-tasks/os-lxc-container-setup.yml - include: common-tasks/os-lxc-container-setup.yml
vars:
extra_container_config_no_restart:
- "lxc.start.order=79"
- include: common-tasks/os-log-dir-setup.yml - include: common-tasks/os-log-dir-setup.yml
vars: vars:
log_dirs: log_dirs:

View File

@ -20,6 +20,10 @@
user: root user: root
pre_tasks: pre_tasks:
- include: common-tasks/os-lxc-container-setup.yml - include: common-tasks/os-lxc-container-setup.yml
static:
vars:
extra_container_config_no_restart:
- "lxc.start.order=99"
- include: common-tasks/package-cache-proxy.yml - include: common-tasks/package-cache-proxy.yml
roles: roles:
- role: "system_crontab_coordination" - role: "system_crontab_coordination"

View File

@ -24,6 +24,8 @@
list_of_bind_mounts: list_of_bind_mounts:
- bind_dir_path: "{{ rsyslog_server_storage_directory }}" - bind_dir_path: "{{ rsyslog_server_storage_directory }}"
mount_path: "/openstack/{{ inventory_hostname }}/log-storage" mount_path: "/openstack/{{ inventory_hostname }}/log-storage"
extra_container_config_no_restart:
- "lxc.start.order=99"
- include: common-tasks/package-cache-proxy.yml - include: common-tasks/package-cache-proxy.yml
roles: roles:
- role: "rsyslog_server" - role: "rsyslog_server"

View File

@ -0,0 +1,13 @@
---
features:
- Container boot ordering has been implemented on container types
where it would be beneficial. This change ensures that stateful
systems running within a container are started ahead of
non-stateful systems. While this change has no impact on a running
deployment it will assist with faster recovery should any node
hosting container go down or simply need to be restarted.
- A new task has been added to the "os-lxc-container-setup.yml"
common-tasks file. This new task will allow for additional
configurations to be added without having to restart the
container. This change is helpful in cases where non-impacting
config needs to be added or updated to a running containers.