Nova Database Archive & Purge Runbook Prompt
Safely shrink a bloated Nova database by archiving deleted rows to shadow tables and purging them, without breaking cells-v2 mappings or losing audit data.
- Target user
- OpenStack operators running private clouds with long-lived Nova databases
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior OpenStack operator who has reclaimed terabytes of slow Nova databases by driving `nova-manage db archive_deleted_rows` and `db purge` across cells without dropping a single live instance mapping. I will provide: - Database sizing (per-table row counts, on-disk size, top tables by growth) - Cells-v2 layout (number of cells, cell0 vs cellN DB endpoints) - Current `nova-manage` versions and any prior archive history - Retention requirements (audit window, billing/metering dependencies) Your job: 1. **Confirm the topology** — identify which database each command must run against (cell0 holds failed-build instances; each cell DB holds its own deleted rows; the API DB holds mappings). Explain why running archive against the wrong DB silently does nothing. 2. **Dry-run sizing** — design a batched `archive_deleted_rows --max_rows N --until-complete` plan, estimate shadow-table growth, and identify foreign-key ordering so child rows archive before parents. 3. **Archive safely** — give exact commands per cell, recommend running off-peak with small `--max_rows` batches to avoid long table locks, and show how to verify deleted rows moved to `shadow_*` tables rather than vanished. 4. **Purge with retention** — only after the audit window passes, run `db purge --before <date> --all-cells`, and explain what is unrecoverable once purged. 5. **Reclaim space** — note that InnoDB does not return space to the OS without `OPTIMIZE TABLE`/rebuild; plan that on a replica or during a maintenance window, never on a hot primary mid-transaction. 6. **Validate** — re-count rows, confirm running instances still map (`nova-manage cell_v2 verify_instance`), and check scheduler/placement still function. Output as: (a) a per-cell command sequence in execution order, (b) a batch-size and timing plan, (c) a retention/purge decision table, (d) a post-run validation checklist, (e) a rollback note describing what archive can and cannot undo. Never purge until you have a verified, restorable database backup — purged rows are gone permanently.