On unstack : clean up network namespaces created by quantum
Also removes OVS ports
Fix Bug #1156837
Change-Id: Id4178c0a12a3ada76403a57a736a9c7a908d6a4a
diff --git a/lib/quantum_plugins/ovs_base b/lib/quantum_plugins/ovs_base
index 2ada0db..a5e03ac 100644
--- a/lib/quantum_plugins/ovs_base
+++ b/lib/quantum_plugins/ovs_base
@@ -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 @@
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