summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-neutron
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:30 -0400
commit1491d54da84195dda8c7d5ce1fac21437f2bc519 (patch)
treecc16576ec9471de2c9d18de8987f5a046971df0f /meta-openstack/recipes-devtools/python/python-neutron
parent3085fa57f54335cfa3794aaf1f45928f5300b000 (diff)
downloadmeta-cloud-services-1491d54da84195dda8c7d5ce1fac21437f2bc519.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')
-rw-r--r--meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init4
-rw-r--r--meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init50
2 files changed, 51 insertions, 3 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init b/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init
index 8bd4c23..8b11a27 100644
--- a/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init
+++ b/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init
@@ -75,7 +75,7 @@ case "$1" in
75 stop) 75 stop)
76 stop 76 stop
77 ;; 77 ;;
78 restart|force-reload|reload) 78 restart|force-reload|reload|reset)
79 stop 79 stop
80 start 80 start
81 ;; 81 ;;
@@ -83,7 +83,7 @@ case "$1" in
83 status 83 status
84 ;; 84 ;;
85 *) 85 *)
86 echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" 86 echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}"
87 exit 1 87 exit 1
88 ;; 88 ;;
89esac 89esac
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