Moving services to another host
Moving services to another host
stado placement move moves a source whose units are stopped rather than
refusing it. The transaction requires each source unit's file to exist —
there is nothing to relocate otherwise — and carries a unit that is installed
and not running, saying so in the move's output; fencing a stopped unit is a
no-op and the state copy is unchanged. The source's health probes are skipped
only when nothing of the profile is running there, because a probe against a
dead service answers nothing about the move. Before it asks either host
anything, a move refuses a profile that does not carry every store the
catalog declares for its products (placement profile <p> does not carry <path> (<product>), …, which the catalog declares its products keep; a move would leave them behind on the source: add them with stado placement profile sync <p>), so a profile written before the catalog named a store, or
by hand, does not move a service away from what it keeps. A store not
required may be absent on the source; it must still be listed, so that
one that exists moves.
A destination unit that already runs is a second active copy, and the move
refuses it — <host>: destination unit(s) <units> already run and hold <state>; refusing two active copies — unless the destination holds none of
the profile's required state: such a copy (a standby someone loaded, a unit
an install started) has accepted nothing the move would overwrite, so the
preflight says unit(s) <units> run with none of the profile's required state; the move stops them before it writes the state, and the move stops
them first, while the source still serves (step stop empty copies). A
profile that declares no required state cannot tell an empty copy and is
refused as before.
stado placement move SERVICES --to-host HOST --check [--json] runs only
those checks — both hosts' unit files and whether each runs, the source's
health probes, its required states, room on the destination and in the local
staging directory, the routing units — against the real hosts, under the
wait czekam: placement move check of <profile>: preflight. It claims
nothing, fences nothing and writes nothing to the registry, so several
profiles leaving one host can each be checked before the first moves. It
prints <profile> passes every check a move from <source> to <host> makes before it fences the source; nothing was claimed or changed ({"status": "would_move", "profile", "from_host", "to_host", "checks": ["destination-facts"]} under --json; already_placed when the profile is
placed on <host>), or fails with the refusal the move would meet. It cannot
be combined with --authority. Stado Desktop runs it as "Check whether a
placement move would pass its preflight".
Before anything else, also for a profile already placed there, the move and
its check compare the facts the profile records about the destination with
what the service directory serves there (destination-facts): a probe that
asks another port than the directory's endpoint for its service on that host
is refused with destination-facts: placement profile <profile> records facts about <host> the service directory contradicts, naming the field
(probes[<i>].url), both values and the correction, stado registry set --path placement_profiles.<profile>.hosts.<host>.probes.<i>.url --value <url>.
Nothing is claimed. stado service deploy --host and stado service adopt
put a placed service only on the host the directory names active for it
(tests/placement/destination_facts.rs, tests/placement/active_host.rs).
Source: this website