Enable tempest cleanup with record_resources in jobs
This enables tempest cleanup with record_resources in the tempest-all job
to create a list of all the resources created during the tempest run.
Then the list will be used to run 'tempest cleanup' to clean only
the resources in the list.
Also, enable the dry cleanup with record_resources in tempest-extra-tests
job.
Change-Id: Ia64a1c09d4b5e9815ff5926161d550b56433ec64
diff --git a/roles/tempest-cleanup/tasks/dry_run.yaml b/roles/tempest-cleanup/tasks/dry_run.yaml
index 07e1b63..8ae5183 100644
--- a/roles/tempest-cleanup/tasks/dry_run.yaml
+++ b/roles/tempest-cleanup/tasks/dry_run.yaml
@@ -5,7 +5,9 @@
command: tox -evenv-tempest -- tempest cleanup --dry-run --debug
args:
chdir: "{{ devstack_base_dir }}/tempest"
- when: not run_tempest_cleanup_prefix
+ when:
+ - not run_tempest_cleanup_prefix
+ - run_tempest_cleanup_resource_list is not defined or not run_tempest_cleanup_resource_list
- name: Run tempest cleanup dry-run with tempest prefix
become: yes
@@ -13,4 +15,12 @@
command: tox -evenv-tempest -- tempest cleanup --dry-run --debug --prefix tempest
args:
chdir: "{{ devstack_base_dir }}/tempest"
- when: run_tempest_cleanup_prefix
\ No newline at end of file
+ when: run_tempest_cleanup_prefix
+
+- name: Run tempest cleanup with tempest resource list
+ become: yes
+ become_user: tempest
+ command: tox -evenv-tempest -- tempest cleanup --dry-run --debug --resource-list
+ args:
+ chdir: "{{ devstack_base_dir }}/tempest"
+ when: run_tempest_cleanup_resource_list
diff --git a/roles/tempest-cleanup/tasks/main.yaml b/roles/tempest-cleanup/tasks/main.yaml
index 7ef4928..1e1c1a7 100644
--- a/roles/tempest-cleanup/tasks/main.yaml
+++ b/roles/tempest-cleanup/tasks/main.yaml
@@ -27,7 +27,9 @@
command: tox -evenv-tempest -- tempest cleanup --debug
args:
chdir: "{{ devstack_base_dir }}/tempest"
- when: not run_tempest_cleanup_prefix
+ when:
+ - not run_tempest_cleanup_prefix
+ - run_tempest_cleanup_resource_list is not defined or not run_tempest_cleanup_resource_list
- name: Run tempest cleanup with tempest prefix
become: yes
@@ -37,6 +39,18 @@
chdir: "{{ devstack_base_dir }}/tempest"
when: run_tempest_cleanup_prefix
+ - name: Cat resource_list.json
+ command: cat "{{ devstack_base_dir }}/tempest/resource_list.json"
+ when: run_tempest_cleanup_resource_list
+
+ - name: Run tempest cleanup with tempest resource list
+ become: yes
+ become_user: tempest
+ command: tox -evenv-tempest -- tempest cleanup --debug --resource-list
+ args:
+ chdir: "{{ devstack_base_dir }}/tempest"
+ when: run_tempest_cleanup_resource_list
+
- when:
- run_tempest_fail_if_leaked_resources
- not init_saved_state