Merge "Remove the old release upgrade extra scripts"

This commit is contained in:
Zuul 2021-05-05 22:31:08 +00:00 committed by Gerrit Code Review
commit 703926636d
14 changed files with 0 additions and 353 deletions

View File

@ -1,60 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-keystone``
function get_new_values {
new_values=()
for i in $1; do
if [[ "$i" != "$2" ]]; then
new_values+="$i "
fi
done
echo ${new_values[*]}
}
function configure_keystone_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Remove XmlBodyMiddleware from the keystone-paste.ini file. All
# XmlBodyMiddleware has been deprecated in Keystone for a year and has been
# removed in Kilo. These options should be removed from the
# Kilo keystone-paste.ini file when testing upgrades to Kilo from previous
# releases.
sed -i '/filter:xml_body/d' $KEYSTONE_PASTE_INI
sed -i '/keystone.middleware:XmlBodyMiddleware.factory/d' $KEYSTONE_PASTE_INI
sed -i '/filter:xml_body_v2/d' $KEYSTONE_PASTE_INI
sed -i '/keystone.middleware:XmlBodyMiddlewareV2.factory/d' $KEYSTONE_PASTE_INI
sed -i '/filter:xml_body_v3/d' $KEYSTONE_PASTE_INI
sed -i '/keystone.middleware:XmlBodyMiddlewareV3.factory/d' $KEYSTONE_PASTE_INI
# Take "xml_body_v2" out of the public_api pipeline
values="$(iniget $KEYSTONE_PASTE_INI pipeline:public_api pipeline)"
public_api_values="$(get_new_values "$values" xml_body_v2)"
iniset $KEYSTONE_PASTE_INI pipeline:public_api pipeline "$public_api_values"
# Take "xml_body_v2" out of the admin_api pipeline
values="$(iniget $KEYSTONE_PASTE_INI pipeline:admin_api pipeline)"
admin_api_values="$(get_new_values "$values" xml_body_v2)"
iniset $KEYSTONE_PASTE_INI pipeline:admin_api pipeline "$admin_api_values"
# Take "xml_body_v3" out of the api_v3 pipeline
values="$(iniget $KEYSTONE_PASTE_INI pipeline:api_v3 pipeline)"
api_v3_values="$(get_new_values "$values" xml_body_v3)"
iniset $KEYSTONE_PASTE_INI pipeline:api_v3 pipeline "$api_v3_values"
# Take "xml_body" out of the public_version_api pipeline
values="$(iniget $KEYSTONE_PASTE_INI pipeline:public_version_api pipeline)"
public_api_values="$(get_new_values "$values" xml_body)"
iniset $KEYSTONE_PASTE_INI pipeline:public_version_api pipeline "$public_api_values"
# Take "xml_body" out of the admin_version_api pipeline
values="$(iniget $KEYSTONE_PASTE_INI pipeline:admin_version_api pipeline)"
admin_api_values="$(get_new_values "$values" xml_body)"
iniset $KEYSTONE_PASTE_INI pipeline:admin_version_api pipeline "$admin_api_values"
## reset to previous state
$xtrace
}

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-keystone``
function configure_keystone_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Run `keysetone-manage credential_setup` to ensure keystone has a fernet
# key repository to encrypt and decrypt credentials.
$KEYSTONE_BIN_DIR/keystone-manage --config-file $KEYSTONE_CONF credential_setup
# reset to previous state
$xtrace
}

View File

@ -1,15 +0,0 @@
# ``upgrade-keystone``
function configure_keystone_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Run `keysetone-manage fernet_setup` to ensure keystone has a fernet
# key repository to encrypt and decrypt tokens.
$KEYSTONE_BIN_DIR/keystone-manage --config-file $KEYSTONE_CONF fernet_setup
# reset to previous state
$xtrace
}

View File

@ -1,14 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-neutron``
function configure_neutron_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Apply new rootwrap dhcp.filters because of dnsmasq env variable change
sudo cp -f $TARGET_RELEASE_DIR/neutron/etc/neutron/rootwrap.d/dhcp.filters $NEUTRON_CONF_DIR/rootwrap.d/
$xtrace
}

View File

@ -1,14 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-neutron``
function configure_neutron_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Apply new rootwrap dhcp.filters because of dnsmasq dhcp_release6 change
sudo cp -f $TARGET_RELEASE_DIR/neutron/etc/neutron/rootwrap.d/dhcp.filters $NEUTRON_CONF_DIR/rootwrap.d/
$xtrace
}

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-neutron``
function configure_neutron_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Apply new rootwrap l3 and dhcp filters because now we are using haproxy for serving metadata
sudo cp -f $TARGET_RELEASE_DIR/neutron/etc/neutron/rootwrap.d/dhcp.filters $NEUTRON_CONF_DIR/rootwrap.d/
sudo cp -f $TARGET_RELEASE_DIR/neutron/etc/neutron/rootwrap.d/l3.filters $NEUTRON_CONF_DIR/rootwrap.d/
$xtrace
}

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-nova``
function configure_nova_upgrade {
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Apply new rootwrap compute.filters
sudo cp -f $TARGET_RELEASE_DIR/nova/etc/nova/rootwrap.d/compute.filters $NOVA_CONF_DIR/rootwrap.d/
# reset to previous state
$xtrace
}

View File

@ -1,17 +0,0 @@
function configure_nova_upgrade() {
source $TARGET_DEVSTACK_DIR/lib/database
# We need to create the api database before we can sync it
apidburl=$(iniget $NOVA_CONF database connection | sed "s#/nova#/${NOVA_API_DB}#")
iniset $NOVA_CONF api_database connection "$apidburl"
initialize_database_backends
recreate_database $NOVA_API_DB
# Upgrade rootwrap filters to include touch command
local xtrace
xtrace=$(set +o | grep xtrace)
set -o xtrace
# Apply new rootwrap compute.filters
grep "touch: CommandFilter, touch, root" $TARGET_RELEASE_DIR/nova/etc/nova/rootwrap.d/compute.filters | sudo tee -a $NOVA_CONF_DIR/rootwrap.d/compute.filters
# reset to previous state
$xtrace
}

View File

@ -1,9 +0,0 @@
function configure_nova_upgrade() {
# Grenade jobs to upgrade from mitaka to newton set NOVA_CONFIGURE_CELLSV2.
if [ "$NOVA_CONFIGURE_CELLSV2" == "True" ]; then
source $TARGET_DEVSTACK_DIR/lib/database
# We need to create the cell0 database before we can sync it
initialize_database_backends
recreate_database nova_cell0
fi
}

View File

@ -1,35 +0,0 @@
source $TARGET_DEVSTACK_DIR/lib/database
source $TARGET_DEVSTACK_DIR/lib/rpc_backend
source $TARGET_DEVSTACK_DIR/lib/keystone
source $TARGET_DEVSTACK_DIR/lib/placement
source $GRENADE_DIR/inc/bootstrap
function configure_nova_upgrade() {
# Perform an unconditional simple setup of the cells v2 models and mappings
# We need to create the cell0 database before we can sync it
initialize_database_backends
recreate_database nova_cell0
# NOTE: We use map_cell0 to create the cell0 mapping with the main
# database connection URL directly since simple_cell_setup was incorrectly
# using the api_database connection for this in Newton. As long as the
# cell0 mapping exists before simple_cell_setup is called it will not be
# re-created.
($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)
# Make sure we enable the Placement API before rolling out Ocata since it's
# now mandatory.
# Set for DevStack compatibility
TOP_DIR=$TARGET_DEVSTACK_DIR
source $TOP_DIR/openrc admin admin
FILES=$TARGET_DEVSTACK_DIR/files
stack_install_service placement
cleanup_placement
configure_placement
configure_placement_nova_compute
init_placement
devstack_localrc target enable_service placement
}

View File

@ -1,5 +0,0 @@
function configure_nova_upgrade() {
# Going from ocata -> pike isn't going to have the configs setup for the super conductor
# topology
export CELLSV2_SETUP="singleconductor"
}

View File

@ -1,118 +0,0 @@
#!/usr/bin/env bash
source ${TARGET_DEVSTACK_DIR}/lib/apache
source ${TARGET_DEVSTACK_DIR}/lib/database
source ${TARGET_DEVSTACK_DIR}/lib/keystone
source ${TARGET_DEVSTACK_DIR}/lib/nova
source ${TARGET_DEVSTACK_DIR}/lib/placement
source ${TARGET_DEVSTACK_DIR}/inc/ini-config
source ${TARGET_DEVSTACK_DIR}/inc/python
function configure_nova_upgrade() {
# TODO(mriedem): Until https://review.opendev.org/c/600162/ merges
# in devstack, we want to continue using placement from nova. We can
# remove this once the devstack change lands.
if [ -z "${PLACEMENT_REPO}" ]; then
echo "devstack not new enough for extracted placement."
return 0
fi
# NOTE(mriedem): We don't need to do any of this placement DB stuff
# if PLACEMENT_DB_ENABLED=True from the old side.
# Devstack on the Rocky side won't install the placement repo because
# it didn't exist until Stein, so unless the CI infra (devstack-gate)
# already cloned the repo, we have to git clone the repo here
# to get the DB script.
if [[ ! -d ${TARGET_RELEASE_DIR}/placement ]]; then
git_clone ${PLACEMENT_REPO} \
${TARGET_RELEASE_DIR}/placement ${TARGET_DEVSTACK_BRANCH}
fi
# Install placement so that placement-api script exists
setup_develop ${TARGET_RELEASE_DIR}/placement
# Get the location of the placement DB migration script and
# verify it exists.
local db_script=${TARGET_RELEASE_DIR}/placement/tools/${DATABASE_TYPE}-migrate-db.sh
if [[ ! -x ${db_script} ]]; then
die $LINENO "${db_script} does not exist or is not executable."
fi
# Get our database variables set.
initialize_database_backends
# Write out the contents of placement.conf.
# This should be done before executing the database migration script.
local placement_conf_dir=/etc/placement
sudo install -d -o ${STACK_USER} ${placement_conf_dir}
local placement_conf=${placement_conf_dir}/placement.conf
# NOTE(mriedem): iniset will create the config file if it does not exist
# NOTE(cdent): new placement uses _only_ the 'placement_database' group
# for explicitness.
iniset ${placement_conf} placement_database connection `database_connection_url placement`
# Configure logging options.
setup_logging ${placement_conf}
# Configure [keystone_authtoken] option and auth cache.
sudo install -d -o $STACK_USER /var/cache/placement
configure_auth_token_middleware ${placement_conf} placement /var/cache/placement
# Copy the remaining non-keystoneauth [placement] group options from
# nova.conf if set.
for option in randomize_allocation_candidates incomplete_consumer_project_id incomplete_consumer_user_id; do
local value=$(iniget ${NOVA_CONF} placement ${option})
if [ ${value} ]; then
iniset ${placement_conf} placement ${option} ${value}
fi
done
# Write out the migrate-db.rc file.
local rc_file=/tmp/migrate-db.rc
touch ${rc_file}
# $db_script is an absolute path so we can execute it directly.
${db_script} --mkconfig ${rc_file}
sed -i s/NOVA_API_USER.*/NOVA_API_USER=\"${DATABASE_USER}\"/g ${rc_file}
sed -i s/NOVA_API_PASS.*/NOVA_API_PASS=\"${DATABASE_PASSWORD}\"/g ${rc_file}
sed -i s/PLACEMENT_USER.*/PLACEMENT_USER=\"${DATABASE_USER}\"/g ${rc_file}
sed -i s/PLACEMENT_PASS.*/PLACEMENT_PASS=\"${DATABASE_PASSWORD}\"/g ${rc_file}
# Create the placement database.
recreate_database placement
# Copy the placement-related table data from the nova_api database into
# the placement database and "stamp" the database version to bring it
# under alembic control. Note that stamping relies on the
# `placement.conf` having `[placement_database]/connection` set first.
${db_script} --migrate ${rc_file}
# Copy any policy overrides from nova. We assume yaml here since that is
# the default in code, but it could also be a json file.
local old_policy_file=${NOVA_CONF_DIR}/placement-policy.yaml
if [[ -f ${old_policy_file} ]]; then
local new_policy_file=${placement_conf_dir}/policy.yaml
cp ${old_policy_file} ${new_policy_file}
# Update the config to point at the renamed file.
iniset ${placement_conf} placement policy_file ${new_policy_file}
fi
# Make adjustments to uwsgi and apache configuration so that we are
# pointing to the right service and configuration.
# TODO(cdent): We set our own values for this instead of values from
# lib/placement because we're in a dependency catch-22 with devstack
# changes. When both sides have merged we can replace these with globals.
# PLACEMENT_BIN_DIR is okay because it is the same whether it comes from
# old or new devstack code, as long as we are not in a virtualenv.
# PLACEMENT_UWSGI_CONF is used as a global so that when start_placement
# is called later, it has the right value.
local placement_uwsgi=${PLACEMENT_BIN_DIR}/placement-api
PLACEMENT_UWSGI_CONF=${placement_conf_dir}/placement-uwsgi.ini
disable_apache_site nova-placement-api
# This will enable_apache_site placement-api. The entry in the service
# catalog remains the same.
write_uwsgi_config "${PLACEMENT_UWSGI_CONF}" "${placement_uwsgi}" "/placement"
# Grenade itself will ensure that placement is restarted, and when it does
# that, a new systemd unit file, pointing to the right wsgi app, is created.
}

View File

@ -1,7 +0,0 @@
#!/bin/bash
# Kilo -> Lemming flavor migration
# This is run on kilo code before upgrading
function configure_nova_upgrade {
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db migrate_flavor_data || die $LINENO "Flavor migrate error"
}

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-cinder``
function configure_cinder_upgrade {
XTRACE=$(set +o | grep xtrace)
set -o xtrace
# Copy update volume.filters config file because of rootwrap filters changes
sudo cp -f $TARGET_RELEASE_DIR/cinder/etc/cinder/rootwrap.d/volume.filters $CINDER_CONF_DIR/rootwrap.d/
$XTRACE
}