Stop Neutron advanced service external processes
Some of Neutron advanced services (LBaaS, VPNaaS, ....) creates
external processes and they should be stopped in unstack.
This commit defines neutron_<XaaS>_stop functions for all services
and implements the cleanup logics if necessary.
Also cleanup_neutron removes netns used by LBaaS haproxy.
Change-Id: Ied3a2c374ffcb6b59ecaf1027fb6e6083eded2ae
diff --git a/lib/neutron b/lib/neutron
index b05b16d..851b2ac 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -508,6 +508,19 @@
pid=$(ps aux | awk '/neutron-ns-metadata-proxy/ { print $2 }')
[ ! -z "$pid" ] && sudo kill -9 $pid
fi
+
+ if is_service_enabled q-lbaas; then
+ neutron_lbaas_stop
+ fi
+ if is_service_enabled q-fwaas; then
+ neutron_fwaas_stop
+ fi
+ if is_service_enabled q-vpn; then
+ neutron_vpn_stop
+ fi
+ if is_service_enabled q-metering; then
+ neutron_metering_stop
+ fi
}
# cleanup_neutron() - Remove residual data files, anything left over from previous
@@ -518,7 +531,7 @@
fi
# delete all namespaces created by neutron
- for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do
+ for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas)-[0-9a-f-]*'); do
sudo ip netns delete ${ns}
done
}
diff --git a/lib/neutron_plugins/services/firewall b/lib/neutron_plugins/services/firewall
index 1597e85..580071f 100644
--- a/lib/neutron_plugins/services/firewall
+++ b/lib/neutron_plugins/services/firewall
@@ -23,5 +23,9 @@
iniset_multiline $FWAAS_DRIVER_CONF_FILENAME fwaas driver "neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver"
}
+function neutron_fwaas_stop() {
+ :
+}
+
# Restore xtrace
$MY_XTRACE
diff --git a/lib/neutron_plugins/services/loadbalancer b/lib/neutron_plugins/services/loadbalancer
index c38f904..2699a9b 100644
--- a/lib/neutron_plugins/services/loadbalancer
+++ b/lib/neutron_plugins/services/loadbalancer
@@ -45,5 +45,10 @@
fi
}
+function neutron_lbaas_stop() {
+ pids=$(ps aux | awk '/haproxy/ { print $2 }')
+ [ ! -z "$pids" ] && sudo kill $pids
+}
+
# Restore xtrace
$MY_XTRACE
diff --git a/lib/neutron_plugins/services/metering b/lib/neutron_plugins/services/metering
index 629f3b7..b105429 100644
--- a/lib/neutron_plugins/services/metering
+++ b/lib/neutron_plugins/services/metering
@@ -26,5 +26,9 @@
cp $NEUTRON_DIR/etc/metering_agent.ini $METERING_AGENT_CONF_FILENAME
}
+function neutron_metering_stop() {
+ :
+}
+
# Restore xtrace
$MY_XTRACE
diff --git a/lib/neutron_plugins/services/vpn b/lib/neutron_plugins/services/vpn
index b8f5c7d..55d0a76 100644
--- a/lib/neutron_plugins/services/vpn
+++ b/lib/neutron_plugins/services/vpn
@@ -22,5 +22,16 @@
fi
}
+function neutron_vpn_stop() {
+ local ipsec_data_dir=$DATA_DIR/neutron/ipsec
+ local pids
+ if [ -d $ipsec_data_dir ]; then
+ pids=$(find $ipsec_data_dir -name 'pluto.pid' -exec cat {} \;)
+ fi
+ if [ -n "$pids" ]; then
+ sudo kill $pids
+ fi
+}
+
# Restore xtrace
$MY_XTRACE