From df628089066d347293475735d49cbd97c983d8dc Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 18 Feb 2013 14:14:30 -0600 Subject: [PATCH] Add upgrade-swift --- devstack.localrc.base | 4 ++ devstack.localrc.target | 4 ++ grenade.sh | 5 +++ stop-base | 3 ++ upgrade-swift | 91 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100755 upgrade-swift diff --git a/devstack.localrc.base b/devstack.localrc.base index 7572414f..c3bf8116 100644 --- a/devstack.localrc.base +++ b/devstack.localrc.base @@ -26,3 +26,7 @@ SERVICE_TOKEN=cd0d1a03-b701-4fcb-801a-8b4d0bc3d06e SKIP_EXERCISES=boot_from_volume STACK_LOG=stack.sh.log VOLUME_BACKING_FILE_SIZE=10000M + +enable_service swift +SWIFT_HASH=8213897fads879789asdf789 +SWIFT_REPLICAS=1 diff --git a/devstack.localrc.target b/devstack.localrc.target index e51e7505..c7ae086f 100644 --- a/devstack.localrc.target +++ b/devstack.localrc.target @@ -27,3 +27,7 @@ SERVICE_TOKEN=cd0d1a03-b701-4fcb-801a-8b4d0bc3d06e SKIP_EXERCISES=boot_from_volume STACK_LOG=stack.sh.log VOLUME_BACKING_FILE_SIZE=10000M + +enable_service swift +SWIFT_HASH=8213897fads879789asdf789 +SWIFT_REPLICAS=1 diff --git a/grenade.sh b/grenade.sh index ba9caf58..7ff867f2 100755 --- a/grenade.sh +++ b/grenade.sh @@ -233,6 +233,11 @@ echo_summary "Running upgrade-cinder" $GRENADE_DIR/upgrade-cinder || die "Failure in upgrade-cinder" stop $STOP upgrade-cinder 270 +# Upgrade Swift +echo_summary "Running upgrade-swift" +$GRENADE_DIR/upgrade-swift || die "Failure in upgrade-swift" +stop $STOP upgrade-swift 280 + # Upgrade Tests # ============= diff --git a/stop-base b/stop-base index 09ebedcf..3a0e26a2 100755 --- a/stop-base +++ b/stop-base @@ -50,3 +50,6 @@ fi sudo vgchange -a n stack-volumes DEV=$(sudo losetup -j $DATA_DIR/${VOLUME_GROUP}-backing-file | awk -F':' '/backing-file/ { print $1 }') sudo losetup -d $DEV + +# Unplumb the Swift data +sudo umount ${DATA_DIR}/swift/drives/images/swift.img diff --git a/upgrade-swift b/upgrade-swift new file mode 100755 index 00000000..ca30f2a2 --- /dev/null +++ b/upgrade-swift @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +# ``upgrade-swift`` + +echo "*********************************************************************" +echo "Begin $0" +echo "*********************************************************************" + +# Clean up any resources that may be in use +cleanup() { + set +o errexit + + echo "*********************************************************************" + echo "ERROR: Abort $0" + echo "*********************************************************************" + + # Kill ourselves to signal any calling process + trap 2; kill -2 $$ +} + +trap cleanup SIGHUP SIGINT SIGTERM + +# Keep track of the grenade directory +GRENADE_DIR=$(cd $(dirname "$0") && pwd) + +# Import common functions +source $GRENADE_DIR/functions + +# Determine what system we are running on. This provides ``os_VENDOR``, +# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` +# and ``DISTRO`` +GetDistro + +# Source params +source $GRENADE_DIR/grenaderc + +# This script exits on an error so that errors don't compound and you see +# only the first error that occured. +set -o errexit + +# Print the commands being run so that we can see the command that triggers +# an error. It is also useful for following allowing as the install occurs. +set -o xtrace + +# Set for DevStack compatibility +TOP_DIR=$TARGET_DEVSTACK_DIR + + +# Upgrade Swift +# ============= + +# Kill running Cinder processes +for serv in swift; do + screen -S $SCREEN_NAME -p $serv -X kill +done + +MYSQL_HOST=${MYSQL_HOST:-localhost} +MYSQL_USER=${MYSQL_USER:-root} +BASE_SQL_CONN=$(source $BASE_DEVSTACK_DIR/stackrc; echo ${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST}) + +# Duplicate some setup bits from target DevStack +cd $TARGET_DEVSTACK_DIR +source $TARGET_DEVSTACK_DIR/stackrc +DATA_DIR=${DEST}/data +#SERVICE_HOST=${SERVICE_HOST:-localhost} +#SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http} +SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service} +SERVICE_TOKEN=${SERVICE_TOKEN:-aa-token-bb} +#source $TARGET_DEVSTACK_DIR/lib/database +#source $TARGET_DEVSTACK_DIR/lib/rpc_backend +source $TARGET_DEVSTACK_DIR/lib/keystone + +source $TARGET_DEVSTACK_DIR/lib/swift + +# install_swift() +install_swift +install_swiftclient + +# configure_swift() +configure_swift +configure_swiftclient + +# Simulate init_swift() +init_swift + +start_swift + +set +o xtrace +echo "*********************************************************************" +echo "SUCCESS: End $0" +echo "*********************************************************************"