Clear all l3 related namespace before starting neutron-l3-agent

Remove all l3 related namespaces in case of multiple active routers in
l3 high available mode. The root cause is that keepalived does not
remove the vip address from nic during starting.

neutron-vpnaas-agent is subclass of l3 agent, so should remove all l3
related namespace before starting vpnaas agent.

Closes-Bug: #1703078
Depends-On: Ic9417d2eb03e0dd93f7c668b189b4ad9c72eae0f
Change-Id: I05c1faf2551bb5e70c299e884adf58cd2af52739
This commit is contained in:
Jeffrey Zhang 2017-07-08 13:58:46 +08:00
parent f2a19a4811
commit 58964d6825
6 changed files with 75 additions and 2 deletions

View File

@ -210,6 +210,7 @@
or neutron_l3_agent_ini | changed
or neutron_fwaas_driver_ini | changed
or policy_json | changed
or neutron_l3_agent_wrapper | changed
or neutron_l3_agent_container | changed
- name: Restart neutron-lbaas-agent container
@ -290,6 +291,7 @@
or neutron_fwaas_driver_ini | changed
or neutron_vpnaas_agent_ini | changed
or policy_json | changed
or neutron_vpnaas_agent_wrapper | changed
or neutron_vpnaas_agent_container | changed
- name: Restart neutron-bgp-dragent container

View File

@ -310,6 +310,34 @@
notify:
- "Restart {{ item.key }} container"
- name: Copy neutron-l3-agent-wrapper script
vars:
service_name: "neutron-l3-agent"
service: "{{ neutron_services[service_name] }}"
template:
src: neutron-l3-agent-wrapper.sh.j2
dest: "{{ node_config_directory }}/{{ service_name }}/neutron-l3-agent-wrapper.sh"
register: neutron_l3_agent_wrapper
when:
- service.enabled | bool
- service.host_in_groups | bool
notify:
- "Restart {{ service_name }} container"
- name: Copy neutron-vpnaas-agent-wrapper script
vars:
service_name: "neutron-vpnaas-agent"
service: "{{ neutron_services[service_name] }}"
template:
src: neutron-vpnaas-agent-wrapper.sh.j2
dest: "{{ node_config_directory }}/{{ service_name }}/neutron-vpnaas-agent-wrapper.sh"
register: neutron_vpnaas_agent_wrapper
when:
- service.enabled | bool
- service.host_in_groups | bool
notify:
- "Restart {{ service_name }} container"
# TODO check the environment change
- name: Check neutron containers
kolla_docker:

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -o errexit
# NOTE(jeffrey4l): Remove all l3 related netns in case of multiple active routers in l3 high available mode.
neutron-netns-cleanup \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/l3_agent.ini \
--config-file /etc/neutron/fwaas_driver.ini \
--force --agent-type l3
neutron-l3-agent \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/l3_agent.ini \
--config-file /etc/neutron/fwaas_driver.ini

View File

@ -1,6 +1,12 @@
{
"command": "neutron-l3-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini",
"command": "/usr/local/bin/neutron-l3-agent-wrapper.sh",
"config_files": [
{
"source": "{{ container_config_directory }}/neutron-l3-agent-wrapper.sh",
"dest": "/usr/local/bin/neutron-l3-agent-wrapper.sh",
"owner": "root",
"perm": "0755"
},
{
"source": "{{ container_config_directory }}/neutron.conf",
"dest": "/etc/neutron/neutron.conf",

View File

@ -0,0 +1,16 @@
#!/bin/bash
set -o errexit
# NOTE(jeffrey4l): Remove all l3 related netns in case of multiple active routers in l3 high available mode.
neutron-netns-cleanup \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/fwaas_driver.ini \
--config-file /etc/neutron/l3_agent.ini \
--force --agent-type l3
neutron-vpn-agent \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/fwaas_driver.ini \
--config-file /etc/neutron/l3_agent.ini \
--config-file /etc/neutron/vpnaas_agent.ini

View File

@ -1,6 +1,12 @@
{
"command": "neutron-vpn-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/fwaas_driver.ini --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/vpnaas_agent.ini",
"command": "/usr/local/bin/neutron-vpnaas-agent-wrapper.sh",
"config_files": [
{
"source": "{{ container_config_directory }}/neutron-vpnaas-agent-wrapper.sh",
"dest": "/usr/local/bin/neutron-vpnaas-agent-wrapper.sh",
"owner": "root",
"perm": "0755"
},
{
"source": "{{ container_config_directory }}/neutron.conf",
"dest": "/etc/neutron/neutron.conf",