grenade/projects/60_nova/upgrade.sh
Dan Smith 4e8cfdea17 Nova's flavor migration should be run within-kilo not from-kilo
We actually need to run migrate_flavor_data on kilo code, before we upgrade to
the new code. We want to remove that compatibility code, and this started to
fail when we tried. So, this patch makes sure that we run the within-kilo step
(as provided for in the plugin docs) and do the migrate_flavor_data there.

Change-Id: I9daa648f803218bf1d8b7b7686ab73e146eeb04b
2015-07-02 12:49:46 -07:00

92 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# ``upgrade-nova``
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
RUN_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
# Upgrade Nova
# ============
# Duplicate some setup bits from target DevStack
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/tls
source $TARGET_DEVSTACK_DIR/lib/nova
# 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
# Save current config files for posterity
[[ -d $SAVE_DIR/etc.nova ]] || cp -pr $NOVA_CONF_DIR $SAVE_DIR/etc.nova
# calls pre-upgrade hooks for within-$base before we upgrade
upgrade_project nova $RUN_DIR $BASE_DEVSTACK_BRANCH $BASE_DEVSTACK_BRANCH
# install_nova()
stack_install_service nova
# calls upgrade-nova for specific release
upgrade_project nova $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
# Simulate init_nova()
create_nova_cache_dir
create_nova_keys_dir
# Migrate the database
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync || die $LINENO "DB sync error"
# rolling nova-compute support
if ! should_upgrade "n-cpu"; then
iniset $NOVA_CONF upgrade_levels compute $(basename $BASE_DEVSTACK_BRANCH)
fi
# Start Nova
start_nova_api
if should_upgrade "n-cpu"; then
start_nova_compute
fi
start_nova_rest
# Don't succeed unless the services come up
ensure_services_started nova-api nova-conductor
ensure_logs_exist n-api n-cond
if should_upgrade "n-cpu"; then
ensure_services_started nova-compute
ensure_logs_exist n-cpu
fi
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"