Bug 1787368

Summary: tempest cleanup command is not cleaning up regions
Product: Red Hat OpenStack Reporter: Martin Kopec <mkopec>
Component: openstack-tempestAssignee: Lukas Piwowarski <lpiwowar>
Status: CLOSED ERRATA QA Contact: Martin Kopec <mkopec>
Severity: medium Docs Contact:
Priority: medium    
Version: 15.0 (Stein)CC: apevec, chkumar, lhh, lpiwowar, mvalsecc, slinaber, udesale
Target Milestone: z2Keywords: Triaged, ZStream
Target Release: 15.0 (Stein)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tempest-21.0.0-0.20191209200453.702b21c.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 1763050 Environment:
Last Closed: 2020-03-05 12:03:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1763050    
Bug Blocks:    
Attachments:
Description Flags
verif_output none

Description Martin Kopec 2020-01-02 15:17:07 UTC
+++ This bug was initially created as a clone of Bug #1763050 +++

Description of problem:
`tempest cleanup` command is not cleaning up the region(s) tempest has creates during its execution.

Running  `tempest run --smoke` (even followed by `tempest cleanup`) a few times, will results in many unused regions being created and left behind.

Version-Release number of selected component (if applicable):
13.0.7
13.0.8
(Haven't tested version lower than 13.0.7)

How reproducible:

$ openstack region list
+-----------+---------------+-------------+
| Region    | Parent Region | Description |
+-----------+---------------+-------------+
| regionOne | None          |             |
+-----------+---------------+-------------+
$ tempest cleanup --init-saved-state
$ ll saved_state.json 
-rw-rw-r--. 1 stack stack 107598 Oct 18 02:32 saved_state.json <=== state is saved 
$ tempest run --smoke
$ tempest cleanup --dry-run
Begin cleanup
Process 0 projects
$ cat dry_run.json 
{
  "_projects_to_clean": {},
  "domains": [],
  "flavors": [],
  "images": [],
  "projects": [],
  "roles": [],
  "users": []
}
$ openstack region list
+---------------------------+---------------+-------------+
| Region                    | Parent Region | Description |
+---------------------------+---------------+-------------+
| regionOne                 | None          |             |
| tempest-region-1060190437 | None          |             | <=====
| tempest-region-259179736  | None          |             | <===== regions are left behind, after cleaning up (--dry-run): this is expected
| tempest-region-303446827  | None          |             | <=====
| tempest-region-945563805  | None          |             | <=====
+---------------------------+---------------+-------------+
$ tempest cleanup
Begin cleanup
Process 0 projects
$ openstack region list
+---------------------------+---------------+-------------+
| Region                    | Parent Region | Description |
+---------------------------+---------------+-------------+
| regionOne                 | None          |             |
| tempest-region-1060190437 | None          |             | <=====
| tempest-region-259179736  | None          |             | <=====  regions are left behind, after cleaning up: this is not expected
| tempest-region-303446827  | None          |             | <=====
| tempest-region-945563805  | None          |             | <=====
+---------------------------+---------------+-------------+

Actual results:

`tempest cleanup` should restore the environment to the same state where it was before running `tempest run`.

Expected results:
`tempest cleanup` leaves behind regions it created during its execution

Comment 4 Martin Kopec 2020-02-27 15:31:51 UTC
Created attachment 1666240 [details]
verif_output

Fixed in version package contains fix for the BZ, the regions are now properly discovered and cleaned by tempest cleanup.

Comment 6 errata-xmlrpc 2020-03-05 12:03:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0710