From 0e9e26834c9eea39c59d9d2619883f4d95ddc42b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sat, 11 Apr 2015 07:27:16 -0400 Subject: [PATCH] consolidate all target setup into prep-target There were a remarkable number of scripts that we ran during the target setup phase, that all boiled down to very small activities. - upgrade-devstack - copied 1 file - upgrade-infra - cloned gr - upgrade-oslo - actually *did nothing* (now that we install libraries from pypi) Consolidating them all into a unified prep-target makes understanding what's happening on the target setup simpler. Change-Id: I0a1a41714fd9749857ccfc0825414f331f44ec2a --- grenade.sh | 27 ++++----------------------- prep-target | 45 +++++++++++++++++++++++++++++++++++++++------ start-dstat | 30 ------------------------------ upgrade-devstack | 47 ----------------------------------------------- upgrade-infra | 30 ------------------------------ upgrade-oslo | 33 --------------------------------- 6 files changed, 43 insertions(+), 169 deletions(-) delete mode 100755 start-dstat delete mode 100755 upgrade-devstack delete mode 100755 upgrade-infra delete mode 100755 upgrade-oslo diff --git a/grenade.sh b/grenade.sh index cd7614fe..c171d244 100755 --- a/grenade.sh +++ b/grenade.sh @@ -273,30 +273,11 @@ fi # ======== if [[ "$RUN_TARGET" == "True" ]]; then - # Get target bits ready - echo_summary "Running prep-target" + # Get target devstack tree ready for services to be run from it, + # including trying to reuse any existing files we pulled during + # the base run. + echo_summary "Preparing the target devstack environment" $GRENADE_DIR/prep-target - stop $STOP prep-target 210 - - # Upgrade DevStack - echo_summary "Running upgrade-devstack" - #$GRENADE_DIR/upgrade-devstack - stop $STOP upgrade-devstack 230 - - # Upgrade Infra - echo_summary "Running upgrade-infra" - $GRENADE_DIR/upgrade-infra || die $LINENO "Failure in upgrade-infra" - stop $STOP upgrade-infra 232 - - # Upgrade Oslo - echo_summary "Running upgrade-oslo" - $GRENADE_DIR/upgrade-oslo || die $LINENO "Failure in upgrade-oslo" - stop $STOP upgrade-oslo 235 - - # Start dstat - echo_summary "Running start-dstat" - $GRENADE_DIR/start-dstat - stop $STOP start-dstat 238 # upgrade all the projects in order echo "Upgrade projects: $UPGRADE_PROJECTS" diff --git a/prep-target b/prep-target index 48ae68fb..89891608 100755 --- a/prep-target +++ b/prep-target @@ -7,6 +7,9 @@ # Keep track of the devstack directory GRENADE_DIR=$(cd $(dirname "$0") && pwd) +# Source params +source $GRENADE_DIR/grenaderc + # Import common functions source $GRENADE_DIR/functions @@ -15,13 +18,9 @@ source $GRENADE_DIR/functions # and ``DISTRO`` GetDistro -# Source params -source $GRENADE_DIR/grenaderc - # For debugging set -o xtrace - # System Preparation # ================== @@ -43,11 +42,16 @@ fi source $TARGET_DEVSTACK_DIR/functions source $TARGET_DEVSTACK_DIR/stackrc -# Set a reasonable statusbar +# Set a reasonable screen statusbar SCREEN_HARDSTATUS=${SCREEN_HARDSTATUS:-'%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'} screen -r $SCREEN_NAME -X hardstatus alwayslastline "$SCREEN_HARDSTATUS" -# Prep the service check bits +# Set up needed directories +# ========================= +# +# This ensures that we have a clean service status directory so that +# we know for sure if services are coming up / down when we expect +# them. init_service_check @@ -79,3 +83,32 @@ fi if [[ -n "$SCREEN_LOGDIR" ]]; then mkdir -p $SCREEN_LOGDIR fi + + +# Retain credentials +# ================== + +# Preserve accrc files for future usage +cp -a $BASE_DEVSTACK_DIR/accrc $TARGET_DEVSTACK_DIR/accrc + + +# Set up requirements +# =================== + +# Pull down the new global requirements repository +# +# FIXME: this also pulls in new pbr which is not really needed, we +# should separate that in the future. +source $TARGET_DEVSTACK_DIR/lib/infra + +install_infra + +# Start helper services +# ===================== + +# Start dstat if it's in the ENABLED_SERVICES list. We really want +# this running before any services start to see what's going on when +# they start up, especialy if there are failures. +source $TARGET_DEVSTACK_DIR/lib/dstat + +start_dstat diff --git a/start-dstat b/start-dstat deleted file mode 100755 index 5853e7fa..00000000 --- a/start-dstat +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# ``start-dstat`` - -# 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 - -# For debugging -set -o xtrace - - -# start dstat -# ============ -cd $TARGET_DEVSTACK_DIR -source $TARGET_DEVSTACK_DIR/functions -source $TARGET_DEVSTACK_DIR/stackrc -source $TARGET_DEVSTACK_DIR/lib/dstat - -start_dstat diff --git a/upgrade-devstack b/upgrade-devstack deleted file mode 100755 index 7bc3b021..00000000 --- a/upgrade-devstack +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# ``upgrade-devstack`` - -# 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 - -# For debugging -set -o xtrace - - -# Upgrade DevStack -# ================ - -# calls upgrade-devstack for specific release -upgrade_project devstack $GRENADE_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH - -# Preserve accrc files for future usage -cp -a $BASE_DEVSTACK_DIR/accrc $TARGET_DEVSTACK_DIR/accrc - - -# Translate Services -# ------------------ - -#BASE_ENABLED_SERVICES=$(source $BASE_DEVSTACK_DIR/stackrc; echo $ENABLED_SERVICES) -#ENABLED_SERVICES="" - -# NOOP for now! - -# Write new config to target DevStack -#echo -e "\nENABLED_SERVICES=$ENABLED_SERVICES" >>$TARGET_DEVSTACK_DIR/localrc - -# Handle Defaults Changes -# ----------------------- - -# NOOP for now! diff --git a/upgrade-infra b/upgrade-infra deleted file mode 100755 index e357c6ae..00000000 --- a/upgrade-infra +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# ``upgrade-infra`` - -# 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 - -# For debugging -set -o xtrace - - -# Upgrade Infra -# ================ -cd $TARGET_DEVSTACK_DIR -source $TARGET_DEVSTACK_DIR/functions -source $TARGET_DEVSTACK_DIR/stackrc -source $TARGET_DEVSTACK_DIR/lib/infra - -install_infra diff --git a/upgrade-oslo b/upgrade-oslo deleted file mode 100755 index 35862dd9..00000000 --- a/upgrade-oslo +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -# ``upgrade-oslo`` - -# 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 - -# For debugging -set -o xtrace - - -# Upgrade Oslo -# ================ -cd $TARGET_DEVSTACK_DIR -source $TARGET_DEVSTACK_DIR/functions -source $TARGET_DEVSTACK_DIR/stackrc -source $TARGET_DEVSTACK_DIR/lib/oslo - -# calls upgrade-oslo for specific release -upgrade_project oslo $GRENADE_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH - -install_oslo