Upgrade placement independent of nova

Until now we haven't needed this because placement was being upgraded
as part of nova and placement was not requiring a db sync to upgrade.

Now it does, so an upgrade.sh is added to 15_placement, based on
keystone's (which is simpler than nova's), and the repeated parts
in nova's upgrade.sh are removed. a settings file is also added

Change-Id: I5354a6b32b73c613018bbe17f0691c69f7839b5f
Needed-By: https://review.opendev.org/669170
This commit is contained in:
Chris Dent 2019-09-02 14:54:20 +01:00
parent 1fa49abbc8
commit bb14e02a46
3 changed files with 78 additions and 5 deletions

View File

@ -0,0 +1,4 @@
if is_service_enabled placement-api; then
register_project_for_upgrade placement
register_db_to_save placement
fi

View File

@ -0,0 +1,72 @@
#!/usr/bin/env bash
# ``upgrade-placement``
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
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/apache
source $TARGET_DEVSTACK_DIR/lib/tls
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 along as the install occurs.
set -o xtrace
# Temporary setting until venv change is in DevStack
if [[ -z $PLACEMENT_BIN_DIR ]]; then
PLACEMENT_BIN_DIR=$(dirname $(which placement-manage))
fi
# Save current config files for posterity
[[ -d $SAVE_DIR/etc.placement ]] || cp -pr $PLACEMENT_CONF_DIR $SAVE_DIR/etc.placement
# install_placement()
stack_install_service placement
# calls upgrade-placement for specific release
upgrade_project placement $RUN_DIR $BASE_DEVSTACK_BRANCH
# Simulate init_placement()
# Migrate the database
$PLACEMENT_BIN_DIR/placement-manage db sync || die $LINENO "DB sync error"
# Start Placement:
start_placement
# ensure the service has started
ensure_services_started placement
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"

View File

@ -48,7 +48,6 @@ source $TARGET_DEVSTACK_DIR/lib/apache
source $TARGET_DEVSTACK_DIR/lib/nova
source $TARGET_DEVSTACK_DIR/lib/database
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.
@ -60,9 +59,8 @@ set -o xtrace
# calls pre-upgrade hooks for within-$base before we upgrade
upgrade_project nova $RUN_DIR $BASE_DEVSTACK_BRANCH $BASE_DEVSTACK_BRANCH
# install_nova() and placement
# install_nova()
stack_install_service nova
stack_install_service placement
# calls upgrade-nova for specific release
upgrade_project nova $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
@ -85,10 +83,9 @@ fi
$NOVA_BIN_DIR/nova-manage cell_v2 map_cell0 --database_connection $(database_connection_url nova_cell0)
$NOVA_BIN_DIR/nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url)
# Start the Placement service - this needs to be running before the nova-status
# Ensure the Placement service - this needs to be running before the nova-status
# upgrade check command is run since that validates that we can connect to
# the placement endpoint.
start_placement
ensure_services_started placement-api
# Run the nova-status upgrade check, which was only available starting in Ocata