3 # neutron-netns-cleanup OpenStack Neutron netns cleanup utility
6 # description: OpenStack Neutron netns cleanup utility
8 # This is a one-shot init.d script with the next properties:
10 # * It accepts 3 verbs: start, stop, status
11 # * It cleans unused resources during start (system or agents startup)
12 # * It cleans everything on stop (agents migration to other hosts)
13 # * Once started, it will respond with status = OK
14 # * Once stopped, it will respond with status = DEAD
18 . /etc/rc.d/init.d/functions
21 prog=$proj-netns-cleanup
24 "/usr/share/$proj/$proj-dist.conf" \
25 "/etc/$proj/$proj.conf" \
26 "/etc/$proj/dhcp_agent.ini"
28 configs_str=${configs[@]/#/--config-file }
30 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
32 lockfile=/var/lock/subsys/$prog
36 [ -x $exec ] || exit 5
37 for config in ${configs[@]}; do
38 [ -f $config ] || exit 6
40 runuser -s /bin/bash neutron -c "$exec $cleanopts --log-file /var/log/$proj/netns-cleanup.log $configs_str &>/dev/null"
41 if [ "x$1" == "x--force" ]; then
42 killall neutron-ns-metadata-proxy 2>/dev/null || :
43 killall neutron-keepalived-state-change 2>/dev/null || :
44 kill $(ps ax | grep -e "keepalived.*\.pid-vrrp" | awk '{print $1}') 2>/dev/null || :
45 kill $(ps ax | grep -e "radvd.*\.pid\.radvd" | awk '{print $1}') 2>/dev/null || :
56 [ $retval -eq 0 ] && touch $lockfile
61 [ $retval -eq 0 ] && rm -f $lockfile
64 [ ! -f $lockfile ] && retval=3
66 restart|reload|force-reload|status|condrestart|try-restart)
70 echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"