Placement transactions

Placement transactions

stado placement transactions [--json] lists the placement moves the registry holds open: each one's id, profile, source and destination host, started_at, and open_seconds, how long it has been open by the reading host's clock. While a move is open every service of its profile is refused to every consumer as unavailable, so this is the read that names which move holds a refused service. A move runs for as long as its fence, copy and probes take; one whose process ended without committing or rolling back stays listed and keeps its profile held. A move the reading host runs or ran also carries this_host_progress from the progress it keeps there: last_step (the last step it began), state_written, kept_at, pid and process_running, and the text adds on this host it last began: <step> (kept <time>); its process <pid> still runs, so the move is at work or … has ended without committing or rolling back, so stado placement release ends the move. Another host's move reads {"recorded_here": false}, and a record that cannot be read {"unreadable": <cause>}, said in the text too. The listing also removes what this host keeps of moves the registry no longer holds open: each progress record and each state copy staged for a move under ~/.stado/placement/<id>, saying stado: removed the progress record of <id>, an ended placement move or stado: removed the state copies staged for <id>, an ended placement move on stderr; what belongs to a move whose process still runs is kept, since the registry read may be older than that move's claim, and one that cannot be removed or read is named on stderr. With none open it prints no placement transaction is open; every placement profile resolves and may move ([] with --json). A recorded started_at that is not an RFC 3339 time is refused as config, naming the transaction. Stado Desktop runs it under Hosts → Routes → Available operations….

stado placement release ID [--json] ends such a move. It does what the move's own failure would have done: it retires the profile's units on the destination, puts back the destination's state from the move's backups (every state at once, each failure kept) and the profile's routes to the source, starts the units on the source, and then releases the claim, so the profile resolves again on the source, where the directory still places it (only a move's commit retargets the directory). A move keeps how far it got in ~/.stado/placement/<transaction>.json on the host running it, written before each step and removed when the move commits or its rollback releases the claim; a release on that host undoes exactly the steps recorded there. A release on another host, or one that finds no record, counts every step as taken; a record that cannot be read is named on stderr and every step is undone too. The step count is said on stderr (undoing …) and in --json as undid. A state with no backup is left untouched, and a unit is retired or started again. A release on the host whose record names a process that still runs the move is refused with placement transaction <id> is still run by process <pid> on this host, which commits or rolls it back itself; release it only once that process has ended (stado placement transactions shows whether it still runs), since two rollbacks of one move would run against the same hosts at once; a record whose process cannot be read is named on stderr and the release goes on. A move still running on another host when its claim is released finds the registry changed at its own commit and rolls back too. An id that is not open is refused as not_found, naming stado placement transactions; a profile the registry no longer declares as config. The claim is released even when a rollback step fails; each failed step is named on stderr (rollback_failures in --json) and the command exits non-zero as infra_down. Stado Desktop runs it as Release a placement move… under Hosts → Routes → Available operations….

Source: this website