Skip to content
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

RFE: Make instance cleanup script clean up deleted volume and image rows #154

Open
JCallicoat opened this issue May 8, 2020 · 1 comment

Comments

@JCallicoat
Copy link
Contributor

This would be fairly easy to do and would help for environments that generate and delete a large number of volumes and images. This has been tested in a production Newton environment with these additions to the current script:

DELETE FROM cinder.volume_admin_metadata where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 );
DELETE FROM cinder.volume_attachment where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 );
DELETE FROM cinder.volume_metadata where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 );
DELETE FROM cinder.volume_glance_metadata where snapshot_id IN ( SELECT id FROM cinder.snapshots where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 ));
DELETE FROM cinder.snapshot_metadata where snapshot_id IN ( SELECT id FROM cinder.snapshots where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 ));
DELETE FROM cinder.snapshots where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 );
DELETE FROM cinder.transfers where volume_id IN ( SELECT id from cinder.volumes WHERE deleted > 0 );
DELETE FROM cinder.volumes where deleted > 0;

DELETE FROM glance.image_locations where image_id IN ( SELECT id from glance.images WHERE deleted > 0 );
DELETE FROM glance.image_properties where image_id IN ( SELECT id from glance.images WHERE deleted > 0 );
DELETE FROM glance.image_tags where image_id IN ( SELECT id from glance.images WHERE deleted > 0 );
DELETE FROM glance.image_members where image_id IN ( SELECT id from glance.images WHERE deleted > 0 );
DELETE FROM glance.image_locations where image_id IN ( SELECT id from glance.images WHERE deleted > 0 );
DELETE FROM glance.images where deleted > 0;

If it's too confusing to have nova-instance-cleanup.sh do more than just clean up instances then these could be broken out in separate scripts, or the name of the script could be changed.

@BjoernT
Copy link
Collaborator

BjoernT commented May 8, 2020

Yeah we should look into using cinder-manage and other commands primarily as the data structure changes a lot in cinder. Let's think about this a little more and investigate how make these cleanup scripts part of the product via embedded archival

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants