summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init
diff options
context:
space:
mode:
authorAmy Fong <amy.fong@windriver.com>2014-07-24 13:04:41 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-07-25 15:45:25 -0400
commit3bbd08214617f5a5e7b54253f9f8b786623546c8 (patch)
treed782a074f3a013b302446817ef9d147ddee6bb60 /meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init
parentce99c21125614dfa72428a9ef3ed563db8c99c93 (diff)
downloadmeta-cloud-services-3bbd08214617f5a5e7b54253f9f8b786623546c8.tar.gz
openstack initscript: add reset
Some of the openstack data is associated with external resources (ie glance may have external files), we explicitly invoke the delete commands on those in additional to dropping and recreating the databases. Signed-off-by: Amy Fong <amy.fong@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init')
-rw-r--r--meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init50
1 files changed, 49 insertions, 1 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init b/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init
index 63440e8..0c78de6 100644
--- a/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init
+++ b/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init
@@ -71,6 +71,51 @@ status()
71 echo "$DESC is not running" 71 echo "$DESC is not running"
72} 72}
73 73
74reset()
75{
76 . /etc/nova/openrc
77
78 # Cleanup all neutron floating ip
79 simple_delete "neutron floatingip-list --all-tenant" "neutron floatingip-delete" 1 "neutron floatingip"
80
81 # Cleanup all neutron router
82 neutron router-list | while read line; do
83 router_id=`echo $line | get_field 1`
84 neutron router-port-list $router_id | while read line_port; do
85 port_id=`echo $line_port | get_field 1`
86 subnet_id=`echo $line_port | get_field 4 | cut -d ' ' -f 2 | cut -d '"' -f 2`
87 if [ ! -z "$router_id" ] && [ ! -z "$subnet_id" ] ; then
88 echo ">>> Delete router-port: router_id=$router_id, port_id=$port_id, subnet_id=$subnet_id"
89 neutron router-interface-delete $router_id $subnet_id > /dev/null 2>&1
90 fi
91 done
92 if [ ! -z "$router_id" ] ; then
93 echo ">>> Delete router: router_id=$router_id"
94 neutron router-delete $router_id > /dev/null 2>&1
95 fi
96 done
97
98 # Cleanup all neutron ports
99 simple_delete "neutron port-list --all-tenant" "neutron port-delete" 1 "neutron port"
100
101 # Cleanup all neutron net
102 simple_delete "neutron net-list --all-tenant" "neutron net-delete" 1 "neutron net"
103
104 stop
105
106 # This is to make sure postgres is configured and running
107 if ! pidof postmaster > /dev/null; then
108 /etc/init.d/postgresql-init
109 /etc/init.d/postgresql start
110 sleep 2
111 fi
112
113 sudo -u postgres dropdb ovs_neutron
114 sudo -u postgres createdb ovs_neutron
115
116 start
117}
118
74case "$1" in 119case "$1" in
75 start) 120 start)
76 start 121 start
@@ -85,8 +130,11 @@ case "$1" in
85 status) 130 status)
86 status 131 status
87 ;; 132 ;;
133 reset)
134 reset
135 ;;
88 *) 136 *)
89 echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" 137 echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}"
90 exit 1 138 exit 1
91 ;; 139 ;;
92esac 140esac