summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-cinder
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-cinder
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-cinder')
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/cinder-volume38
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/cinder.init38
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh7
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh7
4 files changed, 86 insertions, 4 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume
index aec6ab0..f753810 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume
+++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume
@@ -69,6 +69,39 @@ status()
69 echo "$DESC is not running" 69 echo "$DESC is not running"
70} 70}
71 71
72reset()
73{
74 . /etc/nova/openrc
75
76 # Cleanup cinder volume
77 simple_delete "cinder list --all-tenant" "cinder delete" 1 "cinder volume"
78
79 # Cleanup cinder backup
80 simple_delete "cinder backup-list" "cinder backup-delete" 1 "cinder backup"
81
82 stop
83
84 if ! pidof postmaster > /dev/null; then
85 /etc/init.d/postgresql-init
86 /etc/init.d/postgresql start
87 fi
88 [ ! -d /var/log/cinder ] && mkdir /var/log/cinder
89 sudo -u postgres dropdb cinder
90 sudo -u postgres createdb cinder
91 cinder-manage db sync
92
93 if [ ! -f /etc/cinder/nfs_shares ]; then
94 /bin/bash /etc/cinder/drivers/nfs_setup.sh
95 fi
96
97 # Create Cinder glusterfs_share config file with default glusterfs server
98 if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then
99 /bin/bash /etc/cinder/drivers/glusterfs_setup.sh
100 fi
101
102 start
103}
104
72case "$1" in 105case "$1" in
73 start) 106 start)
74 start 107 start
@@ -83,8 +116,11 @@ case "$1" in
83 status) 116 status)
84 status 117 status
85 ;; 118 ;;
119 reset)
120 reset
121 ;;
86 *) 122 *)
87 echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" 123 echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}"
88 exit 1 124 exit 1
89 ;; 125 ;;
90esac 126esac
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder.init b/meta-openstack/recipes-devtools/python/python-cinder/cinder.init
index ecf9d66..f130ac8 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder/cinder.init
+++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder.init
@@ -71,6 +71,39 @@ 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 cinder volume
79 simple_delete "cinder list --all-tenant" "cinder delete" 1 "cinder volume"
80
81 # Cleanup cinder backup
82 simple_delete "cinder backup-list" "cinder backup-delete" 1 "cinder backup"
83
84 stop
85
86 if ! pidof postmaster > /dev/null; then
87 /etc/init.d/postgresql-init
88 /etc/init.d/postgresql start
89 fi
90 [ ! -d /var/log/cinder ] && mkdir /var/log/cinder
91 sudo -u postgres dropdb cinder
92 sudo -u postgres createdb cinder
93 cinder-manage db sync
94
95 if [ ! -f /etc/cinder/nfs_shares ]; then
96 /bin/bash /etc/cinder/drivers/nfs_setup.sh
97 fi
98
99 # Create Cinder glusterfs_share config file with default glusterfs server
100 if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then
101 /bin/bash /etc/cinder/drivers/glusterfs_setup.sh
102 fi
103
104 start
105}
106
74case "$1" in 107case "$1" in
75 start) 108 start)
76 start 109 start
@@ -85,8 +118,11 @@ case "$1" in
85 status) 118 status)
86 status 119 status
87 ;; 120 ;;
121 reset)
122 reset
123 ;;
88 *) 124 *)
89 echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" 125 echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}"
90 exit 1 126 exit 1
91 ;; 127 ;;
92esac 128esac
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh b/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh
index 30997d1..1c87ff9 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh
+++ b/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh
@@ -1,7 +1,12 @@
1#! /bin/bash 1#! /bin/bash
2 2
3is_default=%IS_DEFAULT%
4if [ $# -eq 1 ]; then
5 is_default=$1
6fi
7
3# Default setup 8# Default setup
4if [ "$1" == "1" ]; then 9if [ "$is_default" == "1" ]; then
5 mkdir /etc/cinder/glusterfs_volumes 10 mkdir /etc/cinder/glusterfs_volumes
6 /etc/init.d/glusterd start 11 /etc/init.d/glusterd start
7 gluster volume create glusterfs_volumes controller:/etc/cinder/glusterfs_volumes force 12 gluster volume create glusterfs_volumes controller:/etc/cinder/glusterfs_volumes force
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh b/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh
index 1d7c475..f07602a 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh
+++ b/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh
@@ -1,7 +1,12 @@
1#! /bin/bash 1#! /bin/bash
2 2
3is_default=%IS_DEFAULT%
4if [ $# -eq 1 ]; then
5 is_default=$1
6fi
7
3# Default setup 8# Default setup
4if [ "$1" == "1" ]; then 9if [ "$is_default" == "1" ]; then
5 mkdir /etc/cinder/nfs_volumes 10 mkdir /etc/cinder/nfs_volumes
6 echo "/etc/cinder/nfs_volumes *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)" >> /etc/exports 11 echo "/etc/cinder/nfs_volumes *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)" >> /etc/exports
7fi 12fi