From 1491d54da84195dda8c7d5ce1fac21437f2bc519 Mon Sep 17 00:00:00 2001 From: Amy Fong Date: Thu, 24 Jul 2014 13:04:41 -0400 Subject: 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 --- .../python/python-glance/glance.init | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'meta-openstack/recipes-devtools/python/python-glance') diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance.init b/meta-openstack/recipes-devtools/python/python-glance/glance.init index cb94ed7..5b1bf74 100644 --- a/meta-openstack/recipes-devtools/python/python-glance/glance.init +++ b/meta-openstack/recipes-devtools/python/python-glance/glance.init @@ -70,6 +70,30 @@ status() echo "$DESC is not running" } +reset() +{ + . /etc/nova/openrc + + # Cleanup all glance images + simple_delete "glance image-list --all-tenant" "glance image-delete" 1 "glance image" + + stop + + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 5 + fi + + [ ! -d /var/log/glance ] && mkdir /var/log/glance + sudo -u postgres dropdb glance + sudo -u postgres createdb glance + glance-manage db_sync + + start +} + case "$1" in start) start @@ -84,8 +108,11 @@ case "$1" in status) status ;; + reset) + reset + ;; *) - echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" + echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" exit 1 ;; esac -- cgit v1.2.3-54-g00ecf