[ovn] Deleting ovn agents during scale down tasks
When we scale down nodes, we need to make sure that the ovn agents are
deleted otherwise it's going to cause issues.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2017827
Closes-Bug: #1949203
Change-Id: I9a253e77178bfe1cdd867a31e8b9adc310238819
(cherry-picked from 1314f345fa
)
This commit is contained in:
parent
57b19da8a9
commit
aa28158da1
|
@ -444,3 +444,47 @@ outputs:
|
|||
ovn_bridge_mappings: {get_attr: [OVNBridgeMappingsValue, value, ovn_bridge_mappings]}
|
||||
ovn_static_bridge_mac_mappings: {get_attr: [OVNBridgeMappingsValue, value, ovn_static_bridge_mac_mappings]}
|
||||
upgrade_tasks: []
|
||||
scale_tasks:
|
||||
- when:
|
||||
- step|int == 1
|
||||
- container_cli == 'podman'
|
||||
tags: down
|
||||
environment:
|
||||
OS_CLOUD: {get_param: RootStackName}
|
||||
block:
|
||||
# Some tasks are running from the Undercloud which has
|
||||
# the OpenStack clients installed.
|
||||
- name: Get neutron agents ID
|
||||
command: openstack network agent list --column ID --column Host --column Binary --format yaml
|
||||
register: neutron_agents_result
|
||||
delegate_to: "{{ groups['Undercloud'] | first }}"
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
- name: Filter only current host
|
||||
set_fact:
|
||||
neutron_agents: "{{ neutron_agents_result.stdout | from_yaml | selectattr('Host', 'match', ansible_facts['fqdn'] ~ '.*') | list }}"
|
||||
delegate_to: "{{ groups['Undercloud'] | first }}"
|
||||
check_mode: false
|
||||
- name: Deleting OVN agents
|
||||
block:
|
||||
- name: Stop OVN containers
|
||||
loop:
|
||||
- tripleo_ovn_controller
|
||||
- tripleo_ovn_metadata_agent
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
enabled: false
|
||||
become: true
|
||||
register: stop_containers
|
||||
failed_when: "('msg' in stop_containers and
|
||||
'Could not find the requested service' not in stop_containers.msg) or
|
||||
('rc' in stop_containers and stop_containers.rc != 0)"
|
||||
- name: Delete neutron agents
|
||||
loop: "{{ neutron_agents }}"
|
||||
loop_control:
|
||||
loop_var: agent
|
||||
label: "{{ agent.Host }}/{{ agent.Binary }}"
|
||||
command: openstack network agent delete {{ agent.ID }}
|
||||
delegate_to: "{{ groups['Undercloud'] | first }}"
|
||||
check_mode: false
|
||||
|
|
Loading…
Reference in New Issue