Files
grenade/projects/60_nova/upgrade.sh
Sylvain Bauza a1ea5cec06 Run the placement service when upgrading to Ocata
Now the placement service is mandatory in Ocata, we need to modify Grenade
to deploy that service even if the source local.conf is not providing it.

Note that we need to do this as part of nova right now because the
code for placement is in the nova tree. If we do it before and separately,
we end up starting a newton placement service, which is not enough for
ocata nova (and/or we partially upgrade nova from 55_placement, which
breaks within-$release and my brain).

Change-Id: I573149b9415da2a8bb3951a4c4ce71c4c3e48c6f
2017-01-27 16:32:38 -08:00

101 lines
3.2 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/apache
source $TARGET_DEVSTACK_DIR/lib/nova
source $TARGET_DEVSTACK_DIR/lib/rpc_backend
source $TARGET_DEVSTACK_DIR/lib/placement
# 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_keys_dir
# Migrate the database
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync || die $LINENO "DB sync error"
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync || die $LINENO "API DB sync error"
iniset $NOVA_CONF upgrade_levels compute auto
if [[ "$FORCE_ONLINE_MIGRATIONS" == "True" ]]; then
# Run "online" migrations that can complete before we start
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations || die $LINENO "Failed to run online_data_migrations"
fi
# Setup cellsv2 records, if necessary.
if [ "$NOVA_CONFIGURE_CELLSV2" == "True" ]; then
($NOVA_BIN_DIR/nova-manage cell_v2 map_cell0 --database_connection $(database_connection_url nova_cell0) || true)
$NOVA_BIN_DIR/nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url)
fi
# Start Nova
start_nova_api
start_nova
start_placement
# Don't succeed unless the services come up
ensure_services_started nova-api nova-conductor nova-compute placement
ensure_logs_exist n-api n-cond n-cpu
if [[ "$FORCE_ONLINE_MIGRATIONS" == "True" ]]; then
# Run "online" migrations after we've got all the services running
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations || die $LINENO "Failed to run online_data_migrations"
fi
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"