From 322d51de8417142c6ffbf024b198b26069a53f46 Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Wed, 9 Apr 2014 19:59:09 -0400 Subject: swift: add setup package Introduce swift setup package. At boot time, this package setups a simple swift cluster including: * 3 zones * each zone has 1 storage device which are based on loopback devices which the backing files size is controlled by variable SWIFT_BACKING_FILE_SIZE The script /etc/swift/swift_setup.sh is also provided to ease the task of setting up a complicated Swift cluster. It reads a cluster config file, which describes what storage devices are included in what rings, and constructs the cluster. For details of how to use swift_setup.sh and the format of Swift cluster config file please refer to the script's help: $ swift_setup.sh Signed-off-by: Vu Tran --- .../python/python-swift/swift.init | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 meta-openstack/recipes-devtools/python/python-swift/swift.init (limited to 'meta-openstack/recipes-devtools/python/python-swift/swift.init') diff --git a/meta-openstack/recipes-devtools/python/python-swift/swift.init b/meta-openstack/recipes-devtools/python/python-swift/swift.init new file mode 100644 index 0000000..cf12066 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-swift/swift.init @@ -0,0 +1,74 @@ +#!/bin/sh + +# chkconfig: 2345 20 20 + +### BEGIN INIT INFO +# Provides: swift-openstack +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: OpenStack Swift +# Description: OpenStack Swift +### END INIT INFO + + +DESC="Swift Cluster" +SWIFT_HOME=/etc/swift +SWIFT_INIT=/usr/bin/swift-init + +start () +{ + echo -n "Starting $DESC..." + if [ ! -e $SWIFT_HOME/account.builder -a ! -e $SWIFT_HOME/container.builder -a ! -e $SWIFT_HOME/object.builder ]; then + echo "no Swift cluster has been setup, failed." + exit 1 + fi + /etc/swift/swift_setup.sh mountdevs + $SWIFT_INIT proxy-server start + $SWIFT_INIT account-server start + $SWIFT_INIT container-server start + $SWIFT_INIT object-server start + echo "done." +} + + +stop () +{ + echo -n "Stopping $DESC..." + $SWIFT_INIT all stop + /etc/swift/swift_setup.sh unmountdevs + echo "done." +} + + +status () +{ + $SWIFT_INIT proxy-server status + $SWIFT_INIT account-server status + $SWIFT_INIT container-server status + $SWIFT_INIT object-server status +} + + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + start + ;; + status) + status + ;; + *) + echo "Usage: swift {start|stop|force-reload|restart|status}" + exit 1 + ;; +esac + +exit 0 -- cgit v1.2.3-54-g00ecf