Tidy up upgrade scripts

There are currently references to Newton which should
be Ocata. I've tried to reduce the occurances of this
as much as possible to make it a little more
maintainable. Some of these things need a proper
rewrite to reduce this maintenance burden.

Change-Id: I47ea6258c10da4dbe4be99b6a8b9322c9530ed79
(cherry picked from commit 9220d5239f)
This commit is contained in:
Jesse Pretorius 2017-03-09 13:53:29 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 00f4e75afa
commit 34e1334510
3 changed files with 31 additions and 15 deletions

View File

@ -19,13 +19,29 @@
## Shell Opts ----------------------------------------------------------------
set -e -u -v
## Vars ----------------------------------------------------------------------
# The path from which this script is being run
export SCRIPTS_PATH="$(dirname "$(readlink -f "${0}")")"
# The git checkout root path
export MAIN_PATH="$(dirname "${SCRIPTS_PATH}")"
# The path to find all the upgrade playbooks
export UPGRADE_PLAYBOOKS="${SCRIPTS_PATH}/upgrade-utilities/playbooks"
# The toggle which guards against using this script prematurely
export I_REALLY_KNOW_WHAT_I_AM_DOING=${I_REALLY_KNOW_WHAT_I_AM_DOING:-"false"}
# The expected source series name
export SOURCE_SERIES="newton"
# The expected target series name
export TARGET_SERIES="ocata"
## Functions -----------------------------------------------------------------
function run_lock {
@ -44,12 +60,12 @@ function run_lock {
fi
done
if [ ! -d "/etc/openstack_deploy/upgrade-newton" ]; then
mkdir -p "/etc/openstack_deploy/upgrade-newton"
if [ ! -d "/etc/openstack_deploy/upgrade-${TARGET_SERIES}" ]; then
mkdir -p "/etc/openstack_deploy/upgrade-${TARGET_SERIES}"
fi
upgrade_marker_file=$(basename ${file_part} .yml)
upgrade_marker="/etc/openstack_deploy/upgrade-newton/$upgrade_marker_file.complete"
upgrade_marker="/etc/openstack_deploy/upgrade-${TARGET_SERIES}/$upgrade_marker_file.complete"
if [ ! -f "$upgrade_marker" ];then
# note(sigmavirus24): use eval so that we properly turn strings like
@ -110,13 +126,12 @@ function pre_flight {
# Notify the user.
echo -e "
This script will perform a v13.x to v14.x upgrade.
This script will perform a ${SOURCE_SERIES^} to ${TARGET_SERIES^} upgrade.
Once you start the upgrade there's no going back.
Note, this is an online upgrade and while the
in progress running VMs will not be impacted.
However, you can expect some hiccups with OpenStack
API services while the upgrade is running.
Note that the upgrade targets impacting the data
plane as little as possible, but assumes that the
control plane can experience some down time.
Are you ready to perform this upgrade now?
"
@ -124,7 +139,7 @@ function pre_flight {
# Confirm the user is ready to upgrade.
read -p 'Enter "YES" to continue or anything else to quit: ' UPGRADE
if [ "${UPGRADE}" == "YES" ]; then
echo "Running Upgrade from v13.x to v14.x"
echo "Running Upgrade from ${SOURCE_SERIES^} to ${TARGET_SERIES^}"
else
exit 99
fi

View File

@ -18,11 +18,15 @@
connection: local
gather_facts: false
user: root
vars:
upgrade_scripts: "{{ playbook_dir }}/../scripts"
repo_root_dir: "{{ playbook_dir }}/../../../"
source_series: "newton"
tasks:
- name: Create an old copy of openstack_deploy
copy:
src: "/etc/openstack_deploy/"
dest: "/etc/openstack_deploy.OCATA/"
dest: "/etc/openstack_deploy.{{ source_series | upper }}/"
force: no
- name: Check if there is a user-space env.d directory
@ -55,7 +59,7 @@
- name: Update OpenStack variable names
command: "{{ upgrade_scripts }}/migrate_openstack_vars.py {{ item }} {{ (item | basename)[:-4] }}"
args:
creates: "/etc/openstack_deploy.NEWTON/VARS_MIGRATED_{{ (item | basename)[:-4] }}"
creates: "/etc/openstack_deploy.{{ source_series | upper }}/VARS_MIGRATED_{{ (item | basename)[:-4] }}"
with_fileglob:
- "/etc/openstack_deploy/user_*.yml"
@ -68,6 +72,3 @@
with_items:
- key: "default_bind_mount_logs"
value: false
vars:
upgrade_scripts: "{{ playbook_dir }}/../scripts"
repo_root_dir: "{{ playbook_dir }}/../../../"

View File

@ -67,4 +67,4 @@ if __name__ == '__main__':
flag_file = '/etc/openstack_deploy.NEWTON/VARS_MIGRATED_%s' % flag_ref
with open(flag_file, 'w') as f:
f.write('OpenStack Newton variables migrated.')
f.write('OpenStack-Ansible variables migrated.')