Bug 1154875

Summary: Add DB cleanup functionality to nova-manage.
Product: Red Hat OpenStack Reporter: Summer Long <slong>
Component: openstack-novaAssignee: Dan Smith <dasmith>
Status: CLOSED ERRATA QA Contact: Joe H. Rahme <jhakimra>
Severity: medium Docs Contact:
Priority: high    
Version: 11.0 (Ocata)CC: berrange, ccamacho, cpaquin, dasmith, eglynn, jhakimra, jruzicka, kchamart, ltamagno, lyarwood, mschuppe, pablo.iranzo, rcernin, sbauza, sgordon, slong, srevivo, vromanso
Target Milestone: Upstream M2Keywords: FutureFeature, Triaged
Target Release: 14.0 (Rocky)   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/nova/+spec/purge-deleted-instances-cmd
Whiteboard: upstream_milestone_none upstream_definition_pending-approval upstream_status_needs-code-review
Fixed In Version: openstack-nova-18.0.0-0.20180710150340.8469fa7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 1595886 1595887 (view as bug list) Environment:
Last Closed: 2019-01-11 11:47:00 UTC Type: Bug
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:    
Bug Blocks: 1541693, 1595886, 1595887, 1732852, 1894145    

Description Summer Long 2014-10-20 21:57:46 UTC
Description of problem:
Need an update of nova-manage tool to help with Compute housekeeping. Currently, the main housekeeping job (manual, that is) for Compute is that of DB cleanup. From Russell, "Nova (and other services) use a "soft delete" of rows.  Instead of actually deleting the instance record from the database, we just mark a deleted column.  Some may want to delete all of these occasionally."

Adding this to the tool would be user friendly (the alternative is to write down instructions).

Comment 2 Stephen Gordon 2014-12-24 15:23:41 UTC
Is it possible to get a Kbase on covering manual steps for now? If this was covered as part of the more general discussion around cleanup tasks then please link it.

Comment 3 Summer Long 2015-01-04 23:31:44 UTC
Russell responded with the above to an email question about Compute housekeeping. Martin Lopes has been working on a housekeeping article to include what we do know: https://bugzilla.redhat.com/show_bug.cgi?id=1154535

Comment 6 Dan Smith 2015-08-07 14:51:15 UTC
There are a couple of ongoing upstream efforts to address this:

https://review.openstack.org/#/c/200224/

https://review.openstack.org/#/c/137669/

Comment 7 Radomir Dopieralski 2016-02-25 15:36:21 UTC
This is being worked on upstream already: https://review.openstack.org/#/c/203751/

Comment 8 Radomir Dopieralski 2016-02-29 13:45:26 UTC
We will monitor the progress of work on this, and grab this patch the moment it merges. However, it's at -2 for process reasons right now (no new features are accepted in this version anymore), so it will not be merged until OSP10/newton.

Comment 9 Stephen Gordon 2016-04-09 22:41:04 UTC
*** Bug 1283619 has been marked as a duplicate of this bug. ***

Comment 11 Stephen Gordon 2016-04-20 19:28:27 UTC
This is currently stalled and thus it is not clear this will make Newton, we will continue to monitor. Note that going forward as certain objects move to the new API database they will no longer have "soft-deletion" and as a result wont leave as many spurious database records around. This will not be the case for the instance records though.

Comment 20 Stephen Gordon 2017-03-14 16:52:32 UTC
Moved to Queens/RHOSP 13 to reflect current upstream reality, upstream work on this item has stalled and will need to be restarted.

Comment 21 Stephen Gordon 2017-07-18 18:56:31 UTC
Removing Triaged, this needs to be re-assessed.

Comment 25 Dan Smith 2018-03-09 14:50:22 UTC
*** Bug 1540637 has been marked as a duplicate of this bug. ***

Comment 26 Dan Smith 2018-03-09 14:52:05 UTC
*** Bug 1500362 has been marked as a duplicate of this bug. ***

Comment 27 Dan Smith 2018-03-09 14:57:49 UTC
This is now fully merged upstream.

To test this, it's possible to just use the existing archive command on a database with deleted records:

 nova-manage db archive_deleted_rows --all-cells --purge --verbose --until-complete

The verbose output should show many rows archived, and purged. When complete, the shadow tables (shadow_instances for example) should be empty.

Comment 31 errata-xmlrpc 2019-01-11 11:47:00 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/RHEA-2019:0045