aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-cinder
diff options
context:
space:
mode:
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 aec6ab09..f753810e 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()
echo "$DESC is not running"
}
+reset()
+{
+ . /etc/nova/openrc
+
+ # Cleanup cinder volume
+ simple_delete "cinder list --all-tenant" "cinder delete" 1 "cinder volume"
+
+ # Cleanup cinder backup
+ simple_delete "cinder backup-list" "cinder backup-delete" 1 "cinder backup"
+
+ stop
+
+ if ! pidof postmaster > /dev/null; then
+ /etc/init.d/postgresql-init
+ /etc/init.d/postgresql start
+ fi
+ [ ! -d /var/log/cinder ] && mkdir /var/log/cinder
+ sudo -u postgres dropdb cinder
+ sudo -u postgres createdb cinder
+ cinder-manage db sync
+
+ if [ ! -f /etc/cinder/nfs_shares ]; then
+ /bin/bash /etc/cinder/drivers/nfs_setup.sh
+ fi
+
+ # Create Cinder glusterfs_share config file with default glusterfs server
+ if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then
+ /bin/bash /etc/cinder/drivers/glusterfs_setup.sh
+ fi
+
+ start
+}
+
case "$1" in
start)
start
@@ -83,8 +116,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
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder.init b/meta-openstack/recipes-devtools/python/python-cinder/cinder.init
index ecf9d66e..f130ac81 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()
echo "$DESC is not running"
}
+reset()
+{
+ . /etc/nova/openrc
+
+ # Cleanup cinder volume
+ simple_delete "cinder list --all-tenant" "cinder delete" 1 "cinder volume"
+
+ # Cleanup cinder backup
+ simple_delete "cinder backup-list" "cinder backup-delete" 1 "cinder backup"
+
+ stop
+
+ if ! pidof postmaster > /dev/null; then
+ /etc/init.d/postgresql-init
+ /etc/init.d/postgresql start
+ fi
+ [ ! -d /var/log/cinder ] && mkdir /var/log/cinder
+ sudo -u postgres dropdb cinder
+ sudo -u postgres createdb cinder
+ cinder-manage db sync
+
+ if [ ! -f /etc/cinder/nfs_shares ]; then
+ /bin/bash /etc/cinder/drivers/nfs_setup.sh
+ fi
+
+ # Create Cinder glusterfs_share config file with default glusterfs server
+ if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then
+ /bin/bash /etc/cinder/drivers/glusterfs_setup.sh
+ fi
+
+ start
+}
+
case "$1" in
start)
start
@@ -85,8 +118,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
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 30997d12..1c87ff9d 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 @@
#! /bin/bash
+is_default=%IS_DEFAULT%
+if [ $# -eq 1 ]; then
+ is_default=$1
+fi
+
# Default setup
-if [ "$1" == "1" ]; then
+if [ "$is_default" == "1" ]; then
mkdir /etc/cinder/glusterfs_volumes
/etc/init.d/glusterd start
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 1d7c475e..f07602a3 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 @@
#! /bin/bash
+is_default=%IS_DEFAULT%
+if [ $# -eq 1 ]; then
+ is_default=$1
+fi
+
# Default setup
-if [ "$1" == "1" ]; then
+if [ "$is_default" == "1" ]; then
mkdir /etc/cinder/nfs_volumes
echo "/etc/cinder/nfs_volumes *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)" >> /etc/exports
fi