Recover a restore whose start hits a stockout
What
A stockout can hit a rig twice: on up, and again on the start that ends a restore. up already tries the other zones of its region. restore had no path back once the start failed, and a zone the caller set could not move at all.
Measured 2026-11-17: c2d-standard-8 was out in us-central1-a, b and c. up failed until GCP_ZONE was unset. A start after a stop retried for about 27 minutes. One just lab restore ended at "has the restored disk but did not start", and nothing recovered from that.
flowchart TD
U[up] --> C{capacity error?}
C -- no --> F[fail at once]
C -- yes --> P{zone pinned?}
P -- yes --> G[fail, name SIM_PIN_ZONE=false]
P -- no --> N[next zone, state records the one that landed]
R[restore] --> S[disk swapped in, restore_phase=start]
S --> T{start}
T -- ok --> D[phase cleared, address released]
T -- stockout, 3 tries --> K[snapshot, address and phase kept]
K --> R2[run restore again: only the start]
R2 --> TChanges
- Capacity errors match by code (
RESOURCE_POOL_EXHAUSTED,STOCKOUT) as well as the prose, so a response with the code alone still moves the zone. SIM_PIN_ZONE=falseletsupmove a GCP_ZONE the caller set. A caller's zone stays a hard pin without it, and the pinned failure names the variable.restorerecordsrestore_phase: startonce the restored disk is attached. A failed start leaves the rig as it is, with the snapshot and the reserved address.- A start that hits a stockout retries
SIM_RESTORE_START_TRIEStimes (default 3),SIM_RESTORE_START_WAITseconds apart (default 30), then says to wait and runjust lab restore --instance Nagain. The re-run retries only the start. Any other start error fails on the first try.
Testing
The fake-engine selftest gains cases for: a caller's zone moving under SIM_PIN_ZONE=false; a code-only capacity error moving the zone with state recording the landing zone; a restore start failing and the re-run resuming with no disk, instance or snapshot calls while the snapshot and address survive; the bounded tries on stockout; and the final recovery. The pinned and non-capacity failures were already covered and still pass.
just word-budget, sims-check, commit-trailers and the engine, openshift and vendor checks pass locally.