On unstack : clean up network namespaces created by quantum

Also removes OVS ports

Fix Bug #1156837

Change-Id: Id4178c0a12a3ada76403a57a736a9c7a908d6a4a
This commit is contained in:
JordanP 2013-05-16 11:16:13 +02:00
parent 7640350bb5
commit 614202fc40
8 changed files with 24 additions and 8 deletions

View File

@ -406,7 +406,14 @@ function stop_quantum() {
# cleanup_quantum() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_quantum() {
:
if is_quantum_ovs_base_plugin; then
quantum_ovs_base_cleanup
fi
# delete all namespaces created by quantum
for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do
sudo ip netns delete ${ns}
done
}
# _configure_quantum_common()
@ -502,7 +509,6 @@ function _configure_quantum_l3_agent() {
# for l3-agent, only use per tenant router if we have namespaces
Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent"
PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini
cp $QUANTUM_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE

View File

@ -17,8 +17,6 @@ OFC_DRIVER=${OFC_DRIVER:-trema}
OFC_RETRY_MAX=${OFC_RETRY_MAX:-0}
OFC_RETRY_INTERVAL=${OFC_RETRY_INTERVAL:-1}
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
# Main logic
# ---------------------------

View File

@ -8,7 +8,6 @@ set +o xtrace
source $TOP_DIR/lib/quantum_plugins/ovs_base
function setup_integration_bridge() {
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
_quantum_ovs_base_setup_bridge $OVS_BRIDGE
# Set manager to NVP controller (1st of list)
if [[ "$NVP_CONTROLLERS" != "" ]]; then

View File

@ -41,7 +41,6 @@ function quantum_plugin_configure_l3_agent() {
function quantum_plugin_configure_plugin_agent() {
# Setup integration bridge
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
_quantum_ovs_base_setup_bridge $OVS_BRIDGE
_quantum_ovs_base_configure_firewall_driver

View File

@ -5,6 +5,9 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
function is_quantum_ovs_base_plugin() {
# Yes, we use OVS.
return 0
@ -17,6 +20,18 @@ function _quantum_ovs_base_setup_bridge() {
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge
}
function quantum_ovs_base_cleanup() {
# remove all OVS ports that look like Quantum created ports
for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do
sudo ovs-vsctl del-port ${port}
done
# remove all OVS bridges created by Quantum
for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${OVS_BRIDGE} -e ${PUBLIC_BRIDGE}); do
sudo ovs-vsctl del-br ${bridge}
done
}
function _quantum_ovs_base_install_agent_packages() {
local kernel_version
# Install deps

View File

@ -45,7 +45,6 @@ function quantum_plugin_configure_l3_agent() {
function quantum_plugin_configure_plugin_agent() {
# Set up integration bridge
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
_quantum_ovs_base_setup_bridge $OVS_BRIDGE
if [ -n "$RYU_INTERNAL_INTERFACE" ]; then
sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE

View File

@ -7,7 +7,6 @@ set +o xtrace
BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633}
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
function configure_bigswitch_floodlight() {
:

View File

@ -109,4 +109,5 @@ fi
if is_service_enabled quantum; then
stop_quantum
stop_quantum_third_party
cleanup_quantum
fi