Add 'save': the closing step for any change
save = snapshot --update + start, and falls back to a first-time snapshot when no baseline exists yet. On the qemu platform it folds the working overlays into the base images and brings the lab back up; on proxmox it re-templates. Documented as the rule it is: every deliberate change to the lab ends with save, so reset always returns to the state you meant to freeze.
This commit is contained in:
@@ -53,3 +53,28 @@ cmd_reset() {
|
||||
printf '\n'
|
||||
ok "laboratory reset — previous state discarded"
|
||||
}
|
||||
|
||||
|
||||
# The closing step of every change: freeze the current state into the
|
||||
# baseline, then bring the lab back up. Falls back to a first-time snapshot
|
||||
# when no baseline exists yet.
|
||||
cmd_save() {
|
||||
local name need_full=0
|
||||
|
||||
if declare -F backend_has_baseline >/dev/null; then
|
||||
for name in "${VM_NAMES[@]}"; do
|
||||
backend_has_baseline "$name" || need_full=1
|
||||
done
|
||||
else
|
||||
need_full=1
|
||||
fi
|
||||
|
||||
if (( need_full )); then
|
||||
cmd_snapshot
|
||||
else
|
||||
cmd_snapshot --update
|
||||
fi
|
||||
|
||||
step "start"
|
||||
_start_lab
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user