tripleo-heat-templates/docker/services/neutron/neutron-cleanup
Brent Eagles a9c0fa5ce5 neutron-cleanup skips ports marked skip_cleanup=true
The neutron-cleanup script was destroying the entire neutron integration
bridge including ports that are tagged to skip the cleanup process. This
adds logic to skip those ports.

Change-Id: If77933310b5602c5e0d4197584d66d929fc4d8db
Closes-Bug: #1804288
2018-12-03 20:21:01 +00:00

28 lines
901 B
Bash

#!/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 port in `ovs-vsctl list-ports ${INT_BRIDGE:-"br-int"}`;
do
skip_cleanup=`ovs-vsctl --if-exists get Interface $port external_ids:skip_cleanup`
if ! [[ "x$skip_cleanup" == "x\"true\"" ]];
then
ovs-vsctl del-port ${INT_BRIDGE:-"br-int"} $port
fi
done
ovs-vsctl --if-exists del-br ${TUN_BRIDGE:-"br-tun"}
# 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