Pre-cleanup migration resources and fix validation

This patch avoids the duplication/conflict of resources
(pre-migration and post-migration) if the migration was stopped
by an error and it's retried.

Also makes sure that a non-working validation will fail.

Change-Id: I5ce17e23ee52e936aeee78f64fb0df127816b1bd
Closes-Bug: #1804477
changes/75/619275/3
Miguel Angel Ajo 4 years ago
parent 4ea6513398
commit c2a98b3d90
  1. 14
      migration/tripleo_environment/playbooks/roles/post-migration/tasks/main.yml
  2. 12
      migration/tripleo_environment/playbooks/roles/pre-migration/tasks/main.yml
  3. 2
      migration/tripleo_environment/playbooks/roles/resources/cleanup/defaults/main.yml
  4. 14
      migration/tripleo_environment/playbooks/roles/resources/cleanup/tasks/main.yml
  5. 1
      migration/tripleo_environment/playbooks/roles/resources/create/defaults/main.yml
  6. 2
      migration/tripleo_environment/playbooks/roles/resources/create/tasks/main.yml
  7. 3
      migration/tripleo_environment/playbooks/roles/resources/validate/defaults/main.yml
  8. 2
      migration/tripleo_environment/playbooks/roles/resources/validate/tasks/main.yml
  9. 2
      migration/tripleo_environment/playbooks/roles/resources/validate/templates/validate-resources.sh.j2

@ -8,7 +8,6 @@
include_role:
name: resources/validate
vars:
ovn_migration_temp_dir: "{{ working_dir }}/pre_migration_resources"
restart_server: true
when: validate_migration|bool
@ -17,14 +16,21 @@
name: resources/cleanup
tags:
- post-migration
vars:
ovn_migration_temp_dir: "{{ working_dir }}/pre_migration_resources"
when: validate_migration|bool
#
# Create post-migration resources, validate, and then clean up
#
# Delete any existing resources to make sure we don't conflict on a second run
- name: Delete any post migration resources (preventive)
include_role:
name: resources/cleanup
vars:
resource_suffix: "post"
silent_cleanup: true
when: validate_migration|bool
- name: Create post-migration resources
include_role:
name: resources/create
@ -35,6 +41,8 @@
- name: Validate post migration resources
include_role:
name: resources/validate
vars:
resource_suffix: "post"
when: validate_migration|bool
- name: Delete the post migration resources

@ -1,13 +1,17 @@
# Delete any existing resources to make sure we don't conflict on a second run
- name: Delete any existing pre migration resources (preventive)
include_role:
name: resources/cleanup
vars:
silent_cleanup: true
when: validate_migration|bool
- name: Create the pre migration resource stack
include_role:
name: resources/create
vars:
ovn_migration_temp_dir: "{{ working_dir }}/pre_migration_resources"
when: validate_migration|bool
- name: Validate the pre migration resources
include_role:
name: resources/validate
vars:
ovn_migration_temp_dir: "{{ working_dir }}/pre_migration_resources"
when: validate_migration|bool

@ -2,3 +2,5 @@
cleanup_resource_script: cleanup-resources.sh.j2
resource_suffix: "pre"
ovn_migration_temp_dir: "{{ working_dir }}/{{ resource_suffix }}_migration_resources"
silent_cleanup: false

@ -11,8 +11,16 @@
dest: "{{ ovn_migration_temp_dir }}/cleanup-resources.sh"
mode: 0744
- name: Cleaning up the pre migration resources
- name: Cleaning up the migration resources (verbose)
shell: >
set -o pipefail &&
{{ ovn_migration_temp_dir }}/cleanup-resources.sh 2>&1 >
cleanup-resources.sh.log
{{ ovn_migration_temp_dir }}/cleanup-resources.sh 2>&1 | tee
{{ ovn_migration_temp_dir }}/cleanup-resources.sh.log
when: not silent_cleanup
- name: Cleaning up the migration resources (silent)
shell: >
{{ ovn_migration_temp_dir }}/cleanup-resources.sh >/dev/null 2>&1
when: silent_cleanup

@ -2,3 +2,4 @@
create_migration_resource_script: create-resources.sh.j2
resource_suffix: "pre"
ovn_migration_temp_dir: "{{ working_dir }}/{{ resource_suffix }}_migration_resources"

@ -18,5 +18,5 @@
- name: Creating migration resources
shell: >
set -o pipefail &&
{{ ovn_migration_temp_dir }}/create-migration-resources.sh 2>&1 >
{{ ovn_migration_temp_dir }}/create-migration-resources.sh 2>&1 | tee
{{ ovn_migration_temp_dir }}/create-migration-resources.sh.log

@ -1,4 +1,5 @@
validate_resources_script: validate-resources.sh.j2
server_user_name: "cirros"
restart_server: false
resource_suffix: "pre"
resource_suffix: "pre"
ovn_migration_temp_dir: "{{ working_dir }}/{{ resource_suffix }}_migration_resources"

@ -7,6 +7,6 @@
- name: Run the validation script
shell: >
set -o pipefail &&
{{ ovn_migration_temp_dir }}/validate-resources.sh 2>&1 >
{{ ovn_migration_temp_dir }}/validate-resources.sh 2>&1 | tee
{{ ovn_migration_temp_dir }}/validate-resources.sh.log

@ -1,6 +1,8 @@
#!/bin/bash
set -x
set -e
source {{ overcloudrc }}
# This script validates the resources create by the resources/create role.

Loading…
Cancel
Save