box restore destroys without asking #105
Labels
No labels
blocked
blocker:ci-red
blocker:conflict
blocker:drill-pending
blocker:unrequested
bug
claimed
documentation
enhancement
epic
merge-next
needs-triage
ready
release
scope:cli
scope:drill
scope:host
scope:installer
scope:templates
scope:tiers
stale
state:addressing
state:bots-reviewing
state:building
state:needs-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: heavy-duty/box#105
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
box restoredestroys without askingChild of heavy-duty/rig#62, but it is a live bug independent of that work.
The bug
restoreis a thin passthrough row (bin/box:67):Preconditions are
box,arg2— the instance must be ours, and a snapshotname must be present. That is all. Compare
rmon the very next lines(
bin/box:73), which carriesconfirm, wired atbin/box:1896:Both verbs irreversibly destroy user state. Only one asks. The help text
does warn — "Anything in the box since that snapshot is lost"
(
bin/box:356-361) — but a warning in--helpis not a gate, and restoreis about to become a routine operation rather than a rare one if the
pristine snapshot in heavy-duty/rig#62 lands.
Fix
Add
confirmto the precondition field. Given the table-driven design thisis a one-token change, and
confirm()(bin/box:767-775) already handles--force, the TTY check, and refusing rather than assuming consent withouta terminal.
Also worth deciding: the
stoppedpreconditionrestorehas nostoppedguard either, so it hands a running instancestraight to incus. Snapshots here are stateless —
cmd_snapshot(
bin/box:1295-1299) passes no--stateful, and nothing in the treementions
migration.stateful— so restoring a running box iscrash-consistent at best: dirty page cache, live docker containers,
half-written files.
exportalready takes the stricter line viarequire_stopped(bin/box:1314, "#70 settled on require-down oversnapshot-then-export").
Requiring stopped is probably right, but it is a UX cost on the common case
and worth its own call rather than being smuggled in with the confirm.
Non-issue, stated so nobody adds it
box restoredoes not needreset_identity(bin/box:846-864). Thatexists because a clone shares
/etc/machine-idwith its source andtherefore its DHCP DUID and lease. A restore is the same instance keeping
its own identity — correct as-is, and adding a reset would cost a pointless
reboot.