From 43cc0dbec2ef91239f1800b8c693f121c3fb6c2d Mon Sep 17 00:00:00 2001 From: Yurii Prokulevych Date: Tue, 20 Nov 2018 09:04:36 +0100 Subject: [PATCH] Run online data migration before update/upgrade converge. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some services have an online component to their upgrade procedure – operations which don’t induce downtime and can run while the cloud operates normally. Change-Id: I9b0bef15303bb14ef734b265f28607aa4d491910 --- .../create-overcloud-update-scripts.yaml | 7 +++++++ tasks/update/main.yml | 7 +++++++ .../create-overcloud-upgrade-scripts.yaml | 7 +++++++ tasks/upgrade/main.yml | 7 +++++++ .../overcloud_online_data_migration.sh.j2 | 18 ++++++++++++++++++ 5 files changed, 46 insertions(+) create mode 100644 templates/overcloud_online_data_migration.sh.j2 diff --git a/tasks/update/create-overcloud-update-scripts.yaml b/tasks/update/create-overcloud-update-scripts.yaml index e484eccf..d218985b 100644 --- a/tasks/update/create-overcloud-update-scripts.yaml +++ b/tasks/update/create-overcloud-update-scripts.yaml @@ -54,6 +54,13 @@ with_items: - "{{ oc_roles|default('all') }}" +- name: create online data migration script + template: + src: "overcloud_online_data_migration.sh.j2" + dest: "{{ working_dir }}/overcloud_online_data_migration.sh" + mode: 0755 + force: true + - name: create overcloud update converge script template: src: "{{ overcloud_update_converge_template }}" diff --git a/tasks/update/main.yml b/tasks/update/main.yml index 00fa941c..fc99a307 100644 --- a/tasks/update/main.yml +++ b/tasks/update/main.yml @@ -99,6 +99,13 @@ include: ceph_update_run.yml when: ceph_osd_enabled|bool + - name: run online data migration + args: + chdir: "{{working_dir}}" + shell: | + set -o pipefail + bash {{ working_dir }}/overcloud_online_data_migration.sh 2>&1 {{ timestamper_cmd }} > overcloud_update_data_migration.log + - name: apply pre overcloud update converge workarounds command: "{{working_dir}}/pre_overcloud_update_converge_workarounds.sh" when: updates_workarounds diff --git a/tasks/upgrade/create-overcloud-upgrade-scripts.yaml b/tasks/upgrade/create-overcloud-upgrade-scripts.yaml index e8a698ca..d7d7bca5 100644 --- a/tasks/upgrade/create-overcloud-upgrade-scripts.yaml +++ b/tasks/upgrade/create-overcloud-upgrade-scripts.yaml @@ -70,6 +70,13 @@ with_items: - "{{ oc_roles|default('all') }}" +- name: create online data migration script + template: + src: "overcloud_online_data_migration.sh.j2" + dest: "{{ working_dir }}/overcloud_online_data_migration.sh" + mode: 0755 + force: true + - name: create overcloud converge script vars: old_img: "{{ working_dir }}/{{ container_registry_file }}" diff --git a/tasks/upgrade/main.yml b/tasks/upgrade/main.yml index fa09f185..8def4f18 100644 --- a/tasks/upgrade/main.yml +++ b/tasks/upgrade/main.yml @@ -136,6 +136,13 @@ chdir: "{{working_dir}}" when: upgrade_workarounds + - name: run online data migration + args: + chdir: "{{working_dir}}" + shell: | + set -o pipefail + bash {{ working_dir }}/overcloud_online_data_migration.sh 2>&1 {{ timestamper_cmd }} > overcloud_upgrade_data_migration.log + - include: overcloud_upgrade_converge.yml tags: overcloud_upgrade_converge diff --git a/templates/overcloud_online_data_migration.sh.j2 b/templates/overcloud_online_data_migration.sh.j2 new file mode 100644 index 00000000..a39125de --- /dev/null +++ b/templates/overcloud_online_data_migration.sh.j2 @@ -0,0 +1,18 @@ +#!/bin/env bash +# +# Run online data migration for OpenStack services +# +{% if overcloud_update|bool -%} +{% set operation_type = 'update' -%} +{% elif overcloud_upgrade|bool -%} +{% set operation_type = 'upgrade' -%} +{% endif -%} +set -euo pipefail + +source {{ undercloud_rc }} + +echo "[$(date)] Run online data migration for overcloud during {{ operation_type }}" + +openstack overcloud external-{{ operation_type }} run \ + --stack {{ overcloud_stack_name }} \ + --tags online_upgrade 2>&1