Ospurge or "project purge" - What's the right approach to cleanup projects prior to deletion

Artem Goncharov artem.goncharov at gmail.com
Mon Jan 18 19:14:37 UTC 2021


Ha, thats exactly the case, the whole logic sits in sdk and is spread across the supported services:
- https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/compute/v2/_proxy.py#L1798 <https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/compute/v2/_proxy.py#L1798> - for compute. KeyPairs not dropped, since they belong to user, and not to the “project”;
- https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/block_storage/v3/_proxy.py#L547 <https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/block_storage/v3/_proxy.py#L547> - block storage;
- https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/orchestration/v1/_proxy.py#L490 <https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/orchestration/v1/_proxy.py#L490>
- https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/network/v2/_proxy.py#L4130 <https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/network/v2/_proxy.py#L4130> - the most complex one in order to give possibility to clean “old” resource without destroying everything else

Adding image is few lines of code (never had enough time to add it), identity is a bit tricky, since also here mostly resources does not belong to Project. DNS would be also easy to do. OSC here is only providing I/F, while the logic sits in SDK and can be very easy extended for other services.

P.S. I use it this on an hourly basis since more than a year already (not a complete cleanup, but with update_after filter in project where the cloud is monitored).

Regards,
Artem

> On 18. Jan 2021, at 19:52, Thomas Goirand <zigo at debian.org> wrote:
> 
> On 1/18/21 6:56 PM, Artem Goncharov wrote:
>> What do you mean it doesn’t implement anything at all? It does clean up compute, network, block_storage, orchestrate resources. Moreover it gives you possibility to clean “old” resources (created before or last updated before).
> 
> Oh really? With that few lines of code? I'll re-read the patch then,
> sorry for my bad assumptions.
> 
> Can you point at the part that's actually deleting the resources?
> 
> Thomas Goirand (zigo)
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20210118/33c148cf/attachment-0001.html>


More information about the openstack-discuss mailing list