Add cleanup service for neutron ovs bridges

Neutron used to run a neutron-ovs-cleanup service on startup and
shutdown to ensure clean configuration. Container specific version of
the cleanup service is needed as we are no longer installing neutron
packages in the overcloud image and the ordering dependencies of the
legacy services are not suitable for containerized neutron deployments.

Closes-Bug: #1786311

Change-Id: Iddd191f06b0a7cadb463abec7ef152c89fddb3cd
This commit is contained in:
beagles 2018-08-07 10:41:04 -02:30 committed by Brent Eagles
parent 46e0fbf6d6
commit 8126573718
4 changed files with 58 additions and 1 deletions

View File

@ -180,7 +180,27 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
metadata_settings:
get_attr: [NeutronOvsAgentBase, role_data, metadata_settings]
host_prep_tasks: {get_attr: [NeutronLogging, host_prep_tasks]}
host_prep_tasks:
list_concat:
- {get_attr: [NeutronLogging, host_prep_tasks]}
-
- block:
- name: Copy in cleanup script
copy:
content: {get_file: ./neutron/neutron-cleanup}
dest: '/usr/libexec/neutron-cleanup'
force: yes
mode: '0755'
- name: Copy in cleanup service
copy:
content: {get_file: ./neutron/neutron-cleanup.service}
dest: '/usr/lib/systemd/system/neutron-cleanup.service'
force: yes
- name: Enabling the cleanup service
service:
name: neutron-cleanup
enabled: yes
upgrade_tasks:
list_concat:
- get_attr: [NeutronOvsAgentBase, role_data, ovs_upgrade_tasks]

View File

@ -0,0 +1,21 @@
#!/bin/bash
# Cleanup neutron OVS bridges. To be called on startup to avoid
# "difficult-to-debug" issues with partially configured resources.
NEUTRON_OVS_CONF=/var/lib/config-data/puppet-generated/neutron/etc/neutron/plugins/ml2/openvswitch_agent.ini
if [ -e ${NEUTRON_OVS_CONF} ];
then
INT_BRIDGE=`crudini --get ${NEUTRON_OVS_CONF} ovs integration_bridge`
TUN_BRIDGE=`crudini --get ${NEUTRON_OVS_CONF} ovs tunnel_bridge`
fi
for br in ${INT_BRIDGE:-"br-int"} ${TUN_BRIDGE:-"br-tun"};
do
ovs-vsctl --if-exists del-br $br
done
# Clean up trunk port bridges
for br in $(ovs-vsctl list-br | egrep 'tbr-[0-9a-f\-]+'); do
ovs-vsctl --if-exists del-br $br
done

View File

@ -0,0 +1,12 @@
[Unit]
Description=Neutron cleanup on startup
After=openvswitch.service network.target
Before=docker.service
RefuseManualStop=yes
[Service]
Type=oneshot
ExecStart=/usr/libexec/neutron-cleanup
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,4 @@
---
features:
- |
Add cleanup services for neutron bridges that work with container based deployments.