ovn-migration: Stop ml2/ovs agents before installing OVN resources

TripleO used to uninstall services if the resources were set to None. It
was not intentional and TripleO no longer does that. This patch manually
removes dhcp, l3, metadata and ovs agents from controller and compute
nodes, including its systemd service files.

Closes-Bug: #1878358
Change-Id: I140ae0c476bf9e19b4429ce388ddc7cc3f4cd421
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
This commit is contained in:
Jakub Libosvar 2020-05-13 09:40:52 +02:00
parent 08e9ec1b56
commit 4d5b9a62b9
5 changed files with 69 additions and 0 deletions

View File

@ -25,6 +25,14 @@
tags:
- setup
- name: Stop ml2/ovs resources
hosts: ovn-controllers
roles:
- stop-agents
tags:
- migration
#
# TripleO / Director is executed to deploy ovn using "br-migration" for the
# dataplane, while br-int is left intact to avoid dataplane disruption.

View File

@ -0,0 +1,3 @@
---
# defaults file for stop-agents
systemd_service_file_dir: /etc/systemd/system

View File

@ -0,0 +1,21 @@
---
- name: "stop and disable {{ service.name }} services and healthchecks"
systemd:
name: "{{ item }}"
state: stopped
enabled: no
become: yes
loop:
- "{{ service.healthcheck_timer_file }}"
- "{{ service.healthcheck_service_file }}"
- "{{ service.service_file }}"
- name: delete ml2 ovs systemd service files
file:
path: "{{ systemd_service_file_dir }}/{{ item }}"
state: absent
loop:
- "{{ service.service_file }}"
- "{{ service.healthcheck_service_file }}"
- "{{ service.healthcheck_timer_file }}"
become: yes

View File

@ -0,0 +1,18 @@
---
- name: populate service facts
service_facts:
- name: disable ml2 ovs services and healthchecks
include_tasks: cleanup.yml
loop: "{{ ml2_ovs_services }}"
loop_control:
loop_var: service
when: ansible_facts.services[service.service_file] is defined
- name: remove containers
become: yes
shell: |
for agent in $(podman ps -a --format {% raw %}"{{.ID}}"{% endraw %} --filter "name=(neutron_.*_agent|neutron_dhcp)"); do
echo "Cleaning up agent $agent"
podman rm -f $agent
done

View File

@ -0,0 +1,19 @@
---
# vars file for stop-agents
ml2_ovs_services:
- name: dhcp
service_file: tripleo_neutron_dhcp.service
healthcheck_service_file: tripleo_neutron_dhcp_healthcheck.service
healthcheck_timer_file: tripleo_neutron_dhcp_healthcheck.timer
- name: l3
service_file: tripleo_neutron_l3_agent.service
healthcheck_service_file: tripleo_neutron_l3_agent_healthcheck.service
healthcheck_timer_file: tripleo_neutron_l3_agent_healthcheck.timer
- name: metadata
service_file: tripleo_neutron_metadata_agent.service
healthcheck_service_file: tripleo_neutron_metadata_agent_healthcheck.service
healthcheck_timer_file: tripleo_neutron_metadata_agent_healthcheck.timer
- name: ovs
service_file: tripleo_neutron_ovs_agent.service
healthcheck_service_file: tripleo_neutron_ovs_agent_healthcheck.service
healthcheck_timer_file: tripleo_neutron_ovs_agent_healthcheck.timer