Skip to content

Commit eb61648

Browse files
Merge pull request #937 from hjensas/neutron-cleanup
Add support for cleanup neutron agents post adopt
2 parents b6ad47b + e645249 commit eb61648

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/roles/dataplane_adoption/tasks/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@
594594
ansible.builtin.include_tasks:
595595
file: nova_verify.yaml
596596

597+
- name: Cleanup non-adopted Neutron and OVN agents
598+
ansible.builtin.include_tasks:
599+
file: neutron_agents_cleanup.yaml
600+
597601
- name: Adopted Neutron and OVN agents post-checks
598602
ansible.builtin.include_tasks:
599603
file: neutron_verify.yaml
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# These tasks will delete agents that where not adopted, but replaced by
2+
# either a new service or a new agent running on a different host post
3+
# adoption.
4+
5+
- name: delete agent type dhcp
6+
ansible.builtin.shell: |
7+
{{ shell_header }}
8+
{{ oc_header }}
9+
alias openstack="oc exec -t openstackclient -- openstack"
10+
11+
AGENT_ID=$(${BASH_ALIASES[openstack]} network agent list --agent-type dhcp --host {{ item }} -f value -c ID)
12+
if [ -n "${AGENT_ID}" ]; then
13+
${BASH_ALIASES[openstack]} network agent delete ${AGENT_ID}
14+
fi
15+
loop: "{{ neutron_dhcp_agent_cleanup_hosts | default([]) }}"
16+
17+
- name: delete OVN Gateway agents
18+
ansible.builtin.shell: |
19+
{{ shell_header }}
20+
{{ oc_header }}
21+
alias openstack="oc exec -t openstackclient -- openstack"
22+
23+
AGENT_ID=$(${BASH_ALIASES[openstack]} network agent list --agent-type ovn-controller-gateway --host {{ item }} -f value -c ID)
24+
if [ -n "${AGENT_ID}" ]; then
25+
${BASH_ALIASES[openstack]} network agent delete ${AGENT_ID}
26+
fi
27+
loop: "{{ neutron_ovn_controller_gateway_agent_cleanup_hosts | default([]) }}"

0 commit comments

Comments
 (0)