Also removes OVS ports
Fix Bug #1156837
Change-Id: Id4178c0a12a3ada76403a57a736a9c7a908d6a4a
... | ... |
@@ -406,7 +406,14 @@ function stop_quantum() { |
406 | 406 |
# cleanup_quantum() - Remove residual data files, anything left over from previous |
407 | 407 |
# runs that a clean run would need to clean up |
408 | 408 |
function cleanup_quantum() { |
409 |
- : |
|
409 |
+ if is_quantum_ovs_base_plugin; then |
|
410 |
+ quantum_ovs_base_cleanup |
|
411 |
+ fi |
|
412 |
+ |
|
413 |
+ # delete all namespaces created by quantum |
|
414 |
+ for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do |
|
415 |
+ sudo ip netns delete ${ns} |
|
416 |
+ done |
|
410 | 417 |
} |
411 | 418 |
|
412 | 419 |
# _configure_quantum_common() |
... | ... |
@@ -502,7 +509,6 @@ function _configure_quantum_l3_agent() { |
502 | 502 |
# for l3-agent, only use per tenant router if we have namespaces |
503 | 503 |
Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE |
504 | 504 |
AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent" |
505 |
- PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} |
|
506 | 505 |
Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini |
507 | 506 |
|
508 | 507 |
cp $QUANTUM_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE |
... | ... |
@@ -8,7 +8,6 @@ set +o xtrace |
8 | 8 |
source $TOP_DIR/lib/quantum_plugins/ovs_base |
9 | 9 |
|
10 | 10 |
function setup_integration_bridge() { |
11 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
12 | 11 |
_quantum_ovs_base_setup_bridge $OVS_BRIDGE |
13 | 12 |
# Set manager to NVP controller (1st of list) |
14 | 13 |
if [[ "$NVP_CONTROLLERS" != "" ]]; then |
... | ... |
@@ -41,7 +41,6 @@ function quantum_plugin_configure_l3_agent() { |
41 | 41 |
|
42 | 42 |
function quantum_plugin_configure_plugin_agent() { |
43 | 43 |
# Setup integration bridge |
44 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
45 | 44 |
_quantum_ovs_base_setup_bridge $OVS_BRIDGE |
46 | 45 |
_quantum_ovs_base_configure_firewall_driver |
47 | 46 |
|
... | ... |
@@ -5,6 +5,9 @@ |
5 | 5 |
MY_XTRACE=$(set +o | grep xtrace) |
6 | 6 |
set +o xtrace |
7 | 7 |
|
8 |
+OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
9 |
+PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} |
|
10 |
+ |
|
8 | 11 |
function is_quantum_ovs_base_plugin() { |
9 | 12 |
# Yes, we use OVS. |
10 | 13 |
return 0 |
... | ... |
@@ -17,6 +20,18 @@ function _quantum_ovs_base_setup_bridge() { |
17 | 17 |
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
18 | 18 |
} |
19 | 19 |
|
20 |
+function quantum_ovs_base_cleanup() { |
|
21 |
+ # remove all OVS ports that look like Quantum created ports |
|
22 |
+ for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do |
|
23 |
+ sudo ovs-vsctl del-port ${port} |
|
24 |
+ done |
|
25 |
+ |
|
26 |
+ # remove all OVS bridges created by Quantum |
|
27 |
+ for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${OVS_BRIDGE} -e ${PUBLIC_BRIDGE}); do |
|
28 |
+ sudo ovs-vsctl del-br ${bridge} |
|
29 |
+ done |
|
30 |
+} |
|
31 |
+ |
|
20 | 32 |
function _quantum_ovs_base_install_agent_packages() { |
21 | 33 |
local kernel_version |
22 | 34 |
# Install deps |
... | ... |
@@ -45,7 +45,6 @@ function quantum_plugin_configure_l3_agent() { |
45 | 45 |
|
46 | 46 |
function quantum_plugin_configure_plugin_agent() { |
47 | 47 |
# Set up integration bridge |
48 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
49 | 48 |
_quantum_ovs_base_setup_bridge $OVS_BRIDGE |
50 | 49 |
if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
51 | 50 |
sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |