Newer
Older
openstack-caracal-ipv4 / runbooks / 01-destroy-model.md

Runbook 01 — Teardown of existing testcloud

Reference: D-018 (skip graceful, MAAS-release-direct). Supersedes the graceful-teardown approach formerly in D-013.

Pre-conditions:

  • KVM snapshots of openstack0–3 exist as the safety net (pre-Magnum baseline). With L3 full rebuild (D-017) we should not need them, but they remain valid disaster recovery.
  • Run from jumphost vopenstack-jesse as user jessea123.
  • Authenticated Juju session active (juju whoami returns identity).
  • MAAS CLI profile configured OR access to MAAS UI for releasing machines.
  • This procedure destroys the entire openstack Juju model and wipes all 5 MAAS-managed VMs. There is no undo short of restoring from snapshot.

Phase A — Pre-destroy capture (~30 sec)

BACKUP_DIR=~/backups/pre-caracal-destroy-$(date -u +%Y%m%dT%H%M%SZ)
mkdir -p "$BACKUP_DIR"
juju export-bundle > "$BACKUP_DIR/bundle-pre-destroy.yaml"
juju status --format=yaml > "$BACKUP_DIR/juju-status-pre-destroy.yaml"
juju models --format=yaml > "$BACKUP_DIR/juju-models-pre-destroy.yaml"
ls -la "$BACKUP_DIR"

This is reference material for diff-checking against the new Caracal bundle later. Not used for restore.

Phase B — Force-destroy the Juju model (~1-2 min to return; ~5-10 min to fully reap in background)

juju destroy-model openstack --force --no-wait --destroy-storage --no-prompt

Flags:

  • --force — ignore charm hooks; don't wait for graceful shutdown
  • --no-wait — return immediately; reaping continues in the background
  • --destroy-storage — mark Juju-tracked persistent storage for cleanup
  • --no-prompt — non-interactive

The Juju controller on juju.maas is untouched. Only the openstack model is destroyed.

Phase C — Release MAAS machines (parallel with Phase B; ~5 min)

Either path is acceptable. UI is faster for visual confirmation; CLI is script-documented for Roosevelt.

Path 1 — MAAS UI: Machines → select openstack0, openstack1, openstack2, openstack3, capi-mgmt → Take action → Release.

Path 2 — MAAS CLI:

# Replace $PROFILE with your MAAS CLI profile name (e.g. "admin")
PROFILE=admin

# Look up system IDs
maas $PROFILE machines read 2>/dev/null \
  | jq -r '.[] | select(.hostname | test("^(openstack[0-3]|capi-mgmt)$")) | "\(.hostname) \(.system_id) \(.status_name)"'

# Release each by system_id
for SID in <id1> <id2> <id3> <id4> <id5>; do
  maas $PROFILE machine release "$SID" comment="Caracal rebuild teardown"
done

LXD VMs managed by MAAS are destroyed on release; the VMs go away and the machine entries return to Ready state.

Phase D — Verification (~1 min)

# Juju side
juju models
# Expect: openstack model not listed

# MAAS side — all 5 hostnames must report Ready
maas $PROFILE machines read 2>/dev/null \
  | jq -r '.[] | select(.hostname | test("^(openstack[0-3]|capi-mgmt)$")) | "\(.hostname) \(.status_name)"'
# Expect five lines, each ending in "Ready"

If the Juju model is still listed as "destroying" after 10 minutes:

# Force-clean any orphan machine entries
juju machines -m openstack --format=yaml 2>/dev/null
# For each lingering machine:
juju remove-machine -m openstack --force <id>
# Then attempt model removal again
juju destroy-model openstack --force --no-wait --no-prompt

Exit criteria: juju models does not show openstack. All 5 VMs show Ready in MAAS. Proceed to 02-deploy.md.