-
Notifications
You must be signed in to change notification settings - Fork 153
Add tests for cinderBackups in dz-storage scenario #3927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
gais-ameer-rh
wants to merge
1
commit into
openstack-k8s-operators:main
Choose a base branch
from
gais-ameer-rh:cinderBackups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| --- | ||
| # Test Cinder backup and restore capabilities across availability zones in dz-storage DT | ||
| # Tests three scenarios: | ||
| # 1. AZ1 backs up to AZ1 and restores to AZ1 | ||
| # 2. AZ1 backs up to AZ2 and restores to AZ1 | ||
| # 3. AZ1 backs up to AZ2 and restores to AZ2 | ||
|
|
||
| - name: Test Cinder backup and restore across availability zones | ||
| hosts: "{{ cifmw_target_host | default('localhost') }}" | ||
| environment: | ||
| KUBECONFIG: "{{ cifmw_openshift_kubeconfig | default('/home/' + ansible_user | default('zuul') + '/.kube/config') }}" | ||
| PATH: "{{ cifmw_path | default(ansible_env.PATH) }}" | ||
| tasks: | ||
| # ================================================================================== | ||
| # Scenario 1: AZ1 backs up to AZ1 and restores to AZ1 | ||
| # ================================================================================== | ||
| - name: "Scenario 1: Create volume in AZ1" | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume create --size 1 vol-az1 --availability-zone az1 -f value -c id | ||
| register: vol_az1_id | ||
|
|
||
| - name: Wait for volume vol-az1 to become available | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1 -f value -c status | ||
| register: vol_az1_status | ||
| until: "'available' in vol_az1_status.stdout" | ||
| retries: 60 | ||
| delay: 5 | ||
|
|
||
| - name: "Scenario 1: Create backup for volume in AZ1" | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack --os-volume-api-version 3.51 volume backup create | ||
| --availability-zone az1 | ||
| --name vol-az1-backup-az1 | ||
| vol-az1 | ||
| -f value -c id | ||
| register: vol_az1_backup_az1_id | ||
|
|
||
| - name: Wait for backup vol-az1-backup-az1 to become available | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume backup show vol-az1-backup-az1 -f value -c status | ||
| register: vol_az1_backup_az1_status | ||
| until: "'available' in vol_az1_backup_az1_status.stdout" | ||
| retries: 120 | ||
| delay: 10 | ||
|
|
||
| - name: Verify backup vol-az1-backup-az1 is in AZ1 | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume backup show vol-az1-backup-az1 -f value -c availability_zone | ||
| register: vol_az1_backup_az1_zone | ||
| failed_when: "'az1' not in vol_az1_backup_az1_zone.stdout" | ||
|
|
||
| - name: "Scenario 1: Restore volume backup to AZ1" | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack --os-volume-api-version 3.47 volume create | ||
| --backup vol-az1-backup-az1 | ||
| --availability-zone az1 | ||
| vol-az1-restore-az1 | ||
| -f value -c id | ||
| register: vol_az1_restore_az1_id | ||
|
|
||
| - name: Wait for restored volume vol-az1-restore-az1 to become available | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1-restore-az1 -f value -c status | ||
| register: vol_az1_restore_az1_status | ||
| until: "'available' in vol_az1_restore_az1_status.stdout" | ||
| retries: 120 | ||
| delay: 10 | ||
|
|
||
| - name: Verify restored volume vol-az1-restore-az1 is in AZ1 | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1-restore-az1 -f value -c availability_zone | ||
| register: vol_az1_restore_az1_zone | ||
| failed_when: "'az1' not in vol_az1_restore_az1_zone.stdout" | ||
|
|
||
| # ================================================================================== | ||
| # Scenario 2: AZ1 backs up to AZ2 and restores to AZ1 | ||
| # ================================================================================== | ||
| - name: "Scenario 2: Create backup for volume in AZ2" | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack --os-volume-api-version 3.51 volume backup create | ||
| --availability-zone az2 | ||
| --name vol-az1-backup-az2 | ||
| vol-az1 | ||
| -f value -c id | ||
| register: vol_az1_backup_az2_id | ||
|
|
||
| - name: Wait for backup vol-az1-backup-az2 to become available | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume backup show vol-az1-backup-az2 -f value -c status | ||
| register: vol_az1_backup_az2_status | ||
| until: "'available' in vol_az1_backup_az2_status.stdout" | ||
| retries: 120 | ||
| delay: 10 | ||
|
|
||
| - name: Verify backup vol-az1-backup-az2 is in AZ2 | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume backup show vol-az1-backup-az2 -f value -c availability_zone | ||
| register: vol_az1_backup_az2_zone | ||
| failed_when: "'az2' not in vol_az1_backup_az2_zone.stdout" | ||
|
|
||
| - name: "Scenario 2: Restore backup from AZ2 back to AZ1" | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack --os-volume-api-version 3.47 volume create | ||
| --backup vol-az1-backup-az2 | ||
| --availability-zone az1 | ||
| vol-az1-backup-az2-restore-az1 | ||
| -f value -c id | ||
| register: vol_az1_backup_az2_restore_az1_id | ||
|
|
||
| - name: Wait for restored volume vol-az1-backup-az2-restore-az1 to become available | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1-backup-az2-restore-az1 -f value -c status | ||
| register: vol_az1_backup_az2_restore_az1_status | ||
| until: "'available' in vol_az1_backup_az2_restore_az1_status.stdout" | ||
| retries: 120 | ||
| delay: 10 | ||
|
|
||
| - name: Verify restored volume vol-az1-backup-az2-restore-az1 is in AZ1 | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1-backup-az2-restore-az1 -f value -c availability_zone | ||
| register: vol_az1_backup_az2_restore_az1_zone | ||
| failed_when: "'az1' not in vol_az1_backup_az2_restore_az1_zone.stdout" | ||
|
|
||
| # ================================================================================== | ||
| # Scenario 3: AZ1 backs up to AZ2 and restores to AZ2 | ||
| # ================================================================================== | ||
| # Reusing the volume backup vol-az1-backup-az2 created in previous scenario | ||
| - name: "Scenario 3: Restore backup from AZ2 to AZ2" | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack --os-volume-api-version 3.47 volume create | ||
| --backup vol-az1-backup-az2 | ||
| --availability-zone az2 | ||
| vol-az1-restore-az2 | ||
| -f value -c id | ||
| register: vol_az1_restore_az2_id | ||
|
|
||
| - name: Wait for restored volume vol-az1-restore-az2 to become available | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1-restore-az2 -f value -c status | ||
| register: vol_az1_restore_az2_status | ||
| until: "'available' in vol_az1_restore_az2_status.stdout" | ||
| retries: 120 | ||
| delay: 10 | ||
|
|
||
| - name: Verify restored volume vol-az1-restore-az2 is in AZ2 | ||
| ansible.builtin.command: >- | ||
| oc rsh | ||
| -n {{ cifmw_openstack_namespace }} | ||
| openstackclient | ||
| openstack volume show vol-az1-restore-az2 -f value -c availability_zone | ||
| register: vol_az1_restore_az2_zone | ||
| failed_when: "'az2' not in vol_az1_restore_az2_zone.stdout" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.