Skip to content
Snippets Groups Projects
Commit 3d6df2ea authored by Zuul's avatar Zuul Committed by Gerrit Code Review
Browse files

Merge "Optimize reconfiguration for multipathd"

parents fed5b71b 13f8aef9
No related branches found
No related tags found
No related merge requests found
--- ---
project_name: "multipathd" project_name: "multipathd"
multipathd_services:
multipathd:
container_name: multipathd
group: multipathd
enabled: true
ipc_mode: "host"
privileged: True
image: "{{ multipathd_image_full }}"
volumes:
- "{{ node_config_directory }}/multipathd/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"
- "/etc/localtime:/etc/localtime:ro"
- "/dev/:/dev/"
- "/run/:/run/:shared"
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
- "/lib/modules:/lib/modules:ro"
- "/sys/kernel/config:/configfs"
- "cinder:/var/lib/cinder"
- "iscsi_info:/etc/iscsi"
#################### ####################
# Docker # Docker
#################### ####################
......
---
- name: Restart multipathd container
vars:
service_name: "multipathd"
service: "{{ multipathd_services[service_name] }}"
config_json: "{{ multipathd_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
multipathd_conf: "{{ multipathd_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
multipathd_container: "{{ check_multipathd_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
ipc_mode: "{{ service.ipc_mode }}"
privileged: "{{ service.privileged }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or multipathd_conf.changed | bool
or multipathd_container.changed | bool
--- ---
- name: Ensuring config directories exist - name: Ensuring config directories exist
file: file:
path: "{{ node_config_directory }}/{{ item }}" path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory" state: "directory"
owner: "{{ config_owner_user }}" owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}" group: "{{ config_owner_group }}"
mode: "0770" mode: "0770"
become: true become: true
when: inventory_hostname in groups['multipathd'] when:
with_items: - inventory_hostname in groups[item.value.group]
- "multipathd" - item.value.enabled | bool
with_dict: "{{ multipathd_services }}"
- name: Copying over config.json files for services - name: Copying over config.json files for services
template: template:
src: "{{ item }}.json.j2" src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item }}/config.json" dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660" mode: "0660"
become: true become: true
when: inventory_hostname in groups['multipathd'] register: multipathd_config_jsons
with_items: when:
- "multipathd" - inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ multipathd_services }}"
notify:
- Restart multipathd container
- name: Copying over multipath.conf - name: Copying over multipath.conf
template: template:
src: "{{ role_path }}/templates/multipath.conf.j2" src: "multipath.conf.j2"
dest: "{{ node_config_directory }}/{{ item }}/multipath.conf" dest: "{{ node_config_directory }}/{{ item.key }}/multipath.conf"
mode: "0660" mode: "0660"
become: true become: true
with_items: register: multipathd_confs
- "multipathd" when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ multipathd_services }}"
notify:
- Restart multipathd container
- name: Check multipathd containers
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
ipc_mode: "{{ item.value.ipc_mode }}"
privileged: "{{ item.value.privileged | default(False) }}"
volumes: "{{ item.value.volumes }}"
register: check_multipathd_containers
when:
- kolla_action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ multipathd_services }}"
notify:
- Restart multipathd container
--- ---
- include_tasks: config.yml - include_tasks: config.yml
- include_tasks: start.yml - name: Flush handlers
meta: flush_handlers
...@@ -4,5 +4,8 @@ ...@@ -4,5 +4,8 @@
kolla_docker: kolla_docker:
action: "pull_image" action: "pull_image"
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
image: "{{ multipathd_image_full }}" image: "{{ item.value.image }}"
when: inventory_hostname in groups['multipathd'] when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ multipathd_services }}"
---
- name: Starting multipathd container
become: true
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ multipathd_image_full }}"
name: "multipathd"
ipc_mode: "host"
privileged: True
volumes:
- "{{ node_config_directory }}/multipathd/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"
- "/etc/localtime:/etc/localtime:ro"
- "/dev/:/dev/"
- "/run/:/run/:shared"
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
- "/lib/modules:/lib/modules:ro"
- "/sys/kernel/config:/configfs"
- "cinder:/var/lib/cinder"
- "iscsi_info:/etc/iscsi"
when: inventory_hostname in groups['multipathd']
--- ---
- include_tasks: config.yml - include_tasks: config.yml
- include_tasks: start.yml - name: Flush handlers
meta: flush_handlers
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment