Tenant ports were deleted while cleaning resources

Bug #1945082 reported by Min Li
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Low
Unassigned

Bug Description

After tempest started running, I created a new instance. After tempest finished running, I found that the port of the instance was deleted.
All tenant ports are listed, and all are deleted when resources are cleaned up.

please check: https://opendev.org/openstack/tempest/src/branch/master/tempest/cmd/cleanup_service.py#L627
self.tenant_filter is {}
This will affect the normal use of tenants during running tempest.

Revision history for this message
Min Li (limin0801) wrote :

The same problem also occurs when cleaning up network resources.

Revision history for this message
Martin Kopec (mkopec) wrote :

'tempest cleanup' deletes everything it founds and is not in the saved_state.json state at the same time - see its documentation:

https://docs.openstack.org/tempest/latest/cleanup.html

The 'tempest cleanup' is not very smart, the only way how to control what's gonna be deleted is the saved_state.json file. If you wanna test what resources would be deleted, try --dry-run arg - see the doc I linked above.

As I'm thinking about it, maybe we could improve the cleanup utility so that it deletes only resources which are prefixed by "tempest" - as ~all resources created by tempest tests should be named like "tempest-<some name>-<hash>" or very similar to it.

Martin Kopec (mkopec)
tags: added: low-hanging-fruit
Revision history for this message
Martin Kopec (mkopec) wrote :
Changed in tempest:
importance: Undecided → Low
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/tempest/+/879923

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tempest (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/tempest/+/897231

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tempest (master)

Reviewed: https://review.opendev.org/c/openstack/tempest/+/897231
Committed: https://opendev.org/openstack/tempest/commit/17053d69e57d0131e795ba6f35c6ed7d77ba8bcf
Submitter: "Zuul (22348)"
Branch: master

commit 17053d69e57d0131e795ba6f35c6ed7d77ba8bcf
Author: Luigi Dino Tamagnone <email address hidden>
Date: Tue Oct 3 14:05:25 2023 +0000

    Adding tempest prefix option in tempest.conf

    Adding a new config option in tempest.conf as the prefix for the random
    name resources with this new option all the resources created by
    tempest will have the prefix defined by resource_name_prefix option
    in tempest.conf. If not defined the default is tempest.

    Tempest cleanup CLI will then use this config option to cleanup only the
    resources that match the prefix. Make sure this prefix does not match with
    the resource name you do not want Tempest cleanup CLI to delete.

    This is a patch created after the conversation on
    https://review.opendev.org/c/openstack/tempest/+/879923?tab=comments

    Related-Bug: #1945082
    Change-Id: I663a6307a5aa63299d20a304188efe6d29aea9d3

Revision history for this message
Samuel Allan (samuelallan) wrote :

Note that the help info for the resource_name_prefix config option is currently misleading, as the option exists but it's not implemented yet - the prefix does not affect how tempest cleanup runs ( https://review.opendev.org/c/openstack/tempest/+/897231 ). Could I suggest a quick follow up to note that it's not implemented yet in the help text?

Revision history for this message
Martin Kopec (mkopec) wrote :

you're right, it's still being developed: https://review.opendev.org/c/openstack/tempest/+/879923

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.opendev.org/c/openstack/tempest/+/879923
Committed: https://opendev.org/openstack/tempest/commit/9052dfcc851097c9c75782bf7b70310d5a559e49
Submitter: "Zuul (22348)"
Branch: master

commit 9052dfcc851097c9c75782bf7b70310d5a559e49
Author: Luigi Dino Tamagnone <email address hidden>
Date: Sun Apr 9 15:24:45 2023 +0000

    Allow tempest cleanup delete resources based on prefix

    A warning in command description of run cleanup first with dry-run
    is added. The cleanup behavior is extended to allow users to delete
    only resources if their name starts with a certain prefix.

    Closes-Bug: #1945082
    Change-Id: I65dfe051c891b3679538acec713e8616746c47f6

Changed in tempest:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.