Merge "[ffwd] Rework checks for hybrid state containers" into stable/train

This commit is contained in:
Zuul 2021-04-29 22:46:03 +00:00 committed by Gerrit Code Review
commit 5197e4c2cc
4 changed files with 77 additions and 23 deletions

View File

@ -181,20 +181,34 @@ outputs:
- iscsi_service_enabled_result is changed - iscsi_service_enabled_result is changed
- iscsi_service_enabled_result.rc == 0 - iscsi_service_enabled_result.rc == 0
upgrade_tasks: upgrade_tasks:
# nova_hybrid_state
- name: Gather missing facts
setup:
gather_subset: "distribution"
when: >-
ansible_facts['distribution'] is not defined or
ansible_facts['distribution_major_version'] is not defined
tags:
- never
- nova_hybrid_state
- name: Switch iscsid to hybrid state - name: Switch iscsid to hybrid state
vars: vars:
iscsid_image: {get_param: ContainerIscsidImage} iscsid_image: {get_param: ContainerIscsidImage}
tags: tags:
- never - never
- nova_hybrid_state - nova_hybrid_state
when: step|int == 0 when:
- step|int == 0
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] is version('7', '==')
block: block:
- name: Check if we need to create iscsid paunch config - name: Check if iscsid is running with proper image
stat: shell: |
path: /var/lib/tripleo-config/docker-container-hybrid_iscsid.json docker ps | grep "{{iscsid_image}}"
failed_when: false
register: hybrid_iscsid register: hybrid_iscsid
- name: Implement the hybrid state (only if the compute is still Queens) - name: Implement the hybrid state (only if the compute is still Queens)
when: not hybrid_iscsid.stat.exists when: hybrid_iscsid.rc != 0
block: block:
- name: Update the iscsid paunch image in config - name: Update the iscsid paunch image in config
shell: | shell: |
@ -225,13 +239,24 @@ outputs:
option: registries option: registries
value: "{{ container_registry_insecure_registries }}" value: "{{ container_registry_insecure_registries }}"
register: ini_read_result register: ini_read_result
- name: Restart docker - name: Restart docker and apply the paunch config
when: when:
- container_registry_insecure_registries != [] - container_registry_insecure_registries != []
- ini_read_result is changed - ini_read_result is changed
service: shell: |
name: docker set -o pipefail
state: restarted # Get list of running containers
RUNNING="$( docker ps --format '{{ '{{' }}.Names{{ '}}' }}' )"
# Restart docker
systemctl restart docker
# Compare running containers now vs before
TO_STOP="$(grep -v -f <(echo "${RUNNING}") <(docker ps --format '{{ '{{' }}.Names{{ '}}' }}'))"
# Check if we need to stop anything and stop it
if [ -n "${TO_STOP}" ]; then
echo "${TO_STOP}" | xargs -r docker stop
fi
args:
executable: /usr/bin/bash
- name: Remove iscsid container before applying new paunch config - name: Remove iscsid container before applying new paunch config
docker_container: docker_container:
name: iscsid name: iscsid

View File

@ -247,20 +247,34 @@ outputs:
metadata_settings: metadata_settings:
get_attr: [NeutronBase, role_data, metadata_settings] get_attr: [NeutronBase, role_data, metadata_settings]
upgrade_tasks: upgrade_tasks:
# nova_hybrid_state
- name: Gather missing facts
setup:
gather_subset: "distribution"
when: >-
ansible_facts['distribution'] is not defined or
ansible_facts['distribution_major_version'] is not defined
tags:
- never
- nova_hybrid_state
- name: Switch sriov-agent to hybrid state - name: Switch sriov-agent to hybrid state
vars: vars:
neutron_sriov_image: {get_param: ContainerNeutronSriovImage} neutron_sriov_image: {get_param: ContainerNeutronSriovImage}
tags: tags:
- never - never
- nova_hybrid_state - nova_hybrid_state
when: step|int == 0 when:
- step|int == 0
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] is version('7', '==')
block: block:
- name: Check if we need to create neutron_sriov paunch config - name: Check if neutron_sriov is running with proper image
stat: shell: |
path: /var/lib/tripleo-config/docker-container-hybrid_neutron_sriov.json docker ps | grep "{{neutron_sriov_image}}"
failed_when: false
register: hybrid_neutron_sriov register: hybrid_neutron_sriov
- name: Implement the hybrid state for neutron_sriov_agent - name: Implement the hybrid state for neutron_sriov_agent
when: not hybrid_neutron_sriov.stat.exists when: hybrid_neutron_sriov != 0
block: block:
- name: Update the neutron_sriov_agent paunch image in config - name: Update the neutron_sriov_agent paunch image in config
shell: | shell: |

View File

@ -1278,20 +1278,34 @@ outputs:
- ksmtuned.service - ksmtuned.service
external_post_deploy_tasks: {get_attr: [NovaComputeCommon, nova_compute_common_deploy_steps_tasks]} external_post_deploy_tasks: {get_attr: [NovaComputeCommon, nova_compute_common_deploy_steps_tasks]}
upgrade_tasks: upgrade_tasks:
# nova_hybrid_state
- name: Gather missing facts
setup:
gather_subset: "distribution"
when: >-
ansible_facts['distribution'] is not defined or
ansible_facts['distribution_major_version'] is not defined
tags:
- never
- nova_hybrid_state
- name: Switch compute to hybrid state - name: Switch compute to hybrid state
vars: vars:
nova_compute_image: {get_param: ContainerNovaComputeImage} nova_compute_image: {get_param: ContainerNovaComputeImage}
tags: tags:
- never - never
- nova_hybrid_state - nova_hybrid_state
when: step|int == 0 when:
- step|int == 0
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] is version('7', '==')
block: block:
- name: Check if we need to create nova_compute paunch config - name: Check if nova_compute is running with proper image
stat: shell: |
path: /var/lib/tripleo-config/docker-container-hybrid_nova_compute.json docker ps | grep "{{nova_compute_image}}"
failed_when: false
register: hybrid_nova_compute register: hybrid_nova_compute
- name: Implement the hybrid state (only if the compute is still Queens) - name: Implement the hybrid state (only if the compute is still Queens)
when: not hybrid_nova_compute.stat.exists when: hybrid_nova_compute.rc != 0
block: block:
- name: Update the nova_compute paunch image in config - name: Update the nova_compute paunch image in config
shell: | shell: |

View File

@ -378,12 +378,13 @@ outputs:
- ansible_facts['distribution'] == 'RedHat' - ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] is version('7', '==') - ansible_facts['distribution_major_version'] is version('7', '==')
block: block:
- name: Check if we need to create ovn_controller paunch config - name: Check if ovn_controller is runing with proper image
stat: shell:
path: /var/lib/tripleo-config/docker-container-hybrid_ovn_controller.json docker ps | grep "{{ovn_controller_image}}"
failed_when: false
register: hybrid_ovn_controller register: hybrid_ovn_controller
- name: Implement the hybrid state for ovn_controller - name: Implement the hybrid state for ovn_controller
when: not hybrid_ovn_controller.stat.exists when: hybrid_ovn_controller.rc != 0
block: block:
- name: Update the ovn_controller paunch image in config - name: Update the ovn_controller paunch image in config
shell: | shell: |