From 34e13345104cf317807bf8b1792db76478d2f820 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 9 Mar 2017 13:53:29 +0000 Subject: [PATCH] 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 9220d5239f62f8f29017ab8d7ef6c558d7207d6c) --- scripts/run-upgrade.sh | 33 ++++++++++++++----- .../playbooks/deploy-config-changes.yml | 11 ++++--- .../scripts/migrate_openstack_vars.py | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/scripts/run-upgrade.sh b/scripts/run-upgrade.sh index cdb8354e9e..9952ebeace 100755 --- a/scripts/run-upgrade.sh +++ b/scripts/run-upgrade.sh @@ -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 diff --git a/scripts/upgrade-utilities/playbooks/deploy-config-changes.yml b/scripts/upgrade-utilities/playbooks/deploy-config-changes.yml index 9774229bd3..78f3db096e 100644 --- a/scripts/upgrade-utilities/playbooks/deploy-config-changes.yml +++ b/scripts/upgrade-utilities/playbooks/deploy-config-changes.yml @@ -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 }}/../../../" diff --git a/scripts/upgrade-utilities/scripts/migrate_openstack_vars.py b/scripts/upgrade-utilities/scripts/migrate_openstack_vars.py index 739baa86c4..30a2b0387e 100755 --- a/scripts/upgrade-utilities/scripts/migrate_openstack_vars.py +++ b/scripts/upgrade-utilities/scripts/migrate_openstack_vars.py @@ -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.')