Skip to content

Cold move

A cold move takes one machine from its node to another node (step 4 of a drain). The source node stops the machine. Then the target node pulls the disk of the machine from the source node over the mesh. If the target of the machine is running, the target node boots it. The machine loses its memory, and keeps its disk, its name, its URL, its SSH port, and its address. The disk travels in one copy format for every moving state: a stream of the blocks that hold data, with a digest of the whole disk.

An instance admin starts a move with MoveMachine of the admin API (the admin API) or hopboxd admin machine move (hopboxd). CancelMove or hopboxd admin machine move --cancel ends a move that runs. With --give-back, it also asks the target node to give back a machine that a failed move left there (Give-back). The drain of a node moves each machine of the node the same way (Drain of a node).

The control side is in internal/service/moves.go and the leader job of internal/control. The node side is in internal/node/transfer (the disk listener and the pull), internal/node/executor (move.go), and internal/node/machines.

Item Value
Disk listener Port 7444 (transfer.Port) of the mesh address of the node, with TLS 1.3 (the mesh)
Block 4096 bytes (transfer.BlockSize). A block of zeros is a hole.
Frame At most 1 MiB of data
Idle timeout of a pull 30 s without a byte (transfer.DefaultIdleTimeout), counted only while the target waits for the source. The timer counts each wait for the next bytes, so one frame can take longer than 30 s. A save of the progress and the wait of a rate limit do not count. A source that keeps sending bytes holds a pull until the action timeout. If no frame completes, the pull reports no pull_received, so the pull deadline ends the move. A source that sends one small frame before each idle timeout keeps each pull going, so the time limit of the move ends it.
Write timeout of the listener 30 s for each frame (transfer.DefaultWriteTimeout)
Save of the progress of a pull Every 64 MiB, and at each stop of the pull
Length of one pull At most 5 min, the timeout of an action of the executor (executor.DefaultActionTimeout). A larger disk arrives over several pulls.
Wait between two pulls 1 s after a pull that got bytes. After a refusal of the source (403 or 409), 1 s, for the first 10 s of the run of refusals. After any other pull without a byte, and after those 10 s, 2 s, then twice the wait each time, up to 30 s.
Pulls that fail for good 3 in a row (maxPullFailures)
Stop timeout 10 min (domain.MoveStopTimeout)
Pull deadline 30 min without progress (domain.MovePullTimeout): from the hand-off, or from the last pull that wrote bytes
Time limit of a move The size of the disk at 1 MiB/s, plus 10 min (domain.MoveLimit), from the hand-off, when the first pull starts. The first restart of the pull from zero after a digest error starts it again, once.
Step of the leader job Every 2 s (control.MoveEvery)
State of the move What happens Current state of the machine
stopping MoveMachine checks the machine, picks the target, and records the move. The spec of the machine on its node then has the target stopped, so the executor stops it. The machine row keeps its own target. running, then stopped
pulling Once the machine is stopped, the leader hands it to the target node in one transaction. The source loses its lease. The target gets a new grant and a new row of placements. The machine and its address go to the target node with the current state moving. The target node pulls the disk from the source node. moving
done The disk on the target is whole, and its digest matches. The executor of the target reports stopped with the proof of the pull, the ID of the move. If the target of the machine is running, the executor boots it after the control role accepts that report. The source node then removes its old copy. stopped, then starting and running
failed The pull failed, the pull deadline passed, or an instance admin canceled the move. The machine stays on the source node, or goes back there, with its disk. A machine that is no longer in moving on the target stays there (A step that an older control process accepted). stopped

The control role writes the current state moving itself, and also stopped after a failed pull. In both cases, no executor holds the lease of the machine at the time of the write (the executor protocol).

MoveMachine locks the machine as a lifecycle call does, and refuses these cases with failed_precondition:

Case Message
The machine never booted, has the current state hibernated, standby, moving, or deleted, or a target other than running and stopped a cold move needs a machine that booted, with the target running or stopped. This one is <state>, with the target <target>
The node of the machine keeps its memory file, as after a failed wake (Control store tables) the node of the machine keeps its memory file, and a cold move drops it. Its creator wakes the machine, or drops the file with DiscardMemory, first
DiscardMemory ran, and the node has not yet reported its end with the discard generation (the node executor). Until then, the disk can still be the one that a failed wake changed, because the node puts the disk copy of the save back first the node of the machine has not yet reported the end of DiscardMemory, so its disk can still be the one that a failed wake changed. Retry in a few seconds
The machine moves already, or a node still holds an old copy of its files the machine moves already, or a node still removes the files of its last move. Retry later
A failed move left the machine on its target, and its source keeps a copy of its disk (A step that an older control process accepted) a failed move left the machine on its node, and the node <id> keeps a copy of its disk. The node of the machine can lack a whole disk of it, so it does not move again. Give it back with hopboxd admin machine move --cancel --give-back, or delete the machine (reference/cold-move.md)
The node of the machine serves no disk the node <id> of the machine serves no disk for a cold move. It needs a hopboxd that knows cold moves, and an address in the mesh
The named target fails a filter of placement the node <id> cannot take the machine: it <reason>
A live control process runs a release of the schema version 44 to 49 (Two releases) the control process <id> on <host> (hopboxd <release>) knows the migrations up to <version>, and only a hopboxd that knows migration 50 moves machines. Upgrade it first

A machine with the target standby does not start a move. Its memory lives in the RAM of its node, and a cold move drops memory. A pause also waits for the end of a move in stopping or pulling (the machine API), because a move hands the target of the machine to its target node. Milestone T23 of phase 3 moves a machine in standby with its memory.

A failed wake leaves a machine failed or stopped with its memory file (Domain rules). Such a machine passes the check of the states, but a cold move removes the files of the source, the memory file with them. So the move refuses it, and the file stays. The user wakes the machine, or drops the file with DiscardMemory (the machine API). Milestone T23 also moves such a machine with its memory.

A named target that is the node of the machine fails with invalid_argument. An unknown named target fails with not_found. Without a named target, placement picks one (Placement). It takes the size, the pool, and the labels of the size of the machine, and leaves out the node of the machine. A move needs no compatibility class, because it carries no memory. When no node takes the machine, the call fails with unavailable and the message of Placement.

The start of a move writes the audit entry machine.move with move, source, target, and old_target.

The leader job runs every 2 s. For each move in stopping, it locks the machine row, then the move row, and does one of these things:

Machine What the job does
stopped, and its node is ready, cordoned, draining, or shutting_down It hands the machine to the target node. It locks the row of the target node as a placement does (Placement). A target that has no room any more gives way to another node that placement picks, unless the instance admin named it.
stopped, and its node is unresponsive It waits, because the source node must serve the disk.
stopped, and a live control process runs a release of the schema version 44 to 49 It waits. 10 min after the start of the move, the move fails with a control process runs a hopboxd that does not know the moves.
deleted, or its target is deleted The move fails with the machine was deleted during the move. A delete wins over the stop of a move.
not stopped after 10 min, or its node is unresponsive after 10 min The move fails. The spec gives the machine its own target again.

The spec of a moving machine names the move, the source node, and the disk listener of the source (the executor protocol). The executor of the target never boots such a machine before its disk is whole. A boot without the disk makes a new disk from the image. It pulls the disk first, whatever the target. A target deleted only removes what arrived.

The executor writes the move in its node-local state, as pending_move, before the first pull (the node executor). The machine never boots on the node until the control role accepted the proof of the pull of that move. The executor keeps that move as acked_move. This rule holds after a restart of hopboxd. It also holds for a spec that names another state or no move. A control role of the schema version 44 to 49 sends such a spec, because it does not know the moves.

The source node serves the disk once its next recorded heartbeat brings the DiskTransfers of the control role (the control channel). Until then, the source answers 403. While its executor still holds the lease or the microVM runs, it answers 409. The executor of the source lets go of the lease at that same heartbeat, whose answer no longer renews it. The target tries again in both cases, every 1 s for the first 10 s of a run of refusals (plan question Q107). So the pull starts within about 1 s of the source being ready. In the tests at the heartbeat gap of a real node, the pull starts 3.1 s after the hand-off, against 6.0 s with a wait of 2 s and then 4 s.

A pull runs in slices. One pull lasts at most 5 min, the timeout of an action of the executor. A pull that gets no byte for 30 s ends, and so does a cut link. The bytes that arrived stay in the partial copy, with the state of their digest, and the next pull resumes from the last whole frame. A restart of hopboxd on the target resumes too, from the last saved progress. So a large disk arrives over several pulls, and no step reads the whole copy again. After a pull that wrote bytes and did not end, the executor reports its state again with pull_received, the bytes of that pull. That report holds off the pull deadline. These causes count toward the 3 failures in a row that end the move:

  • The source has no disk of the machine (404).
  • The copy has another digest than the disk of the source.
  • The target cannot write the copy, such as a full disk.

Any other failure, such as a cut link, a refusal, or a timeout, makes the executor try again until the pull ends. After the third failure, the executor reports failed from moving, with the error pull the disk from node <id>: ..., and stops acting with its lease.

If the target pulls no part of the disk for 30 min (domain.MovePullTimeout), a move in pulling fails with the error the target node pulled no part of the disk for 30m0s. The 30 min count from the hand-off, and again from each report with pull_received. So a large disk on a busy link keeps its move while it makes progress. A move also has a time limit (plan question Q108): the size of the disk of the machine at 1 MiB/s, plus 10 min of slack, such as for a wait for the digest of the source. For example, a disk of 10 GiB gives 2 h 50 min 40 s. The limit counts from the hand-off, when the first pull starts, so the stop of the machine keeps its own timeout. After a copy with another digest than the disk of the source, the target drops the copy and pulls again from zero. It reports that with pull_restarted (the executor protocol), and the first such report starts the limit again, from the time of the report. A later restart gets no new limit. The control role takes the report on trust, at any time of the pull. So in the worst case, a target that reports a restart just before the limit ends gets about twice the limit from the hand-off, plus one step of the leader job. The move stays bounded. A move in pulling that runs longer fails with the error the move ran longer than <limit>, the time of its disk at 1 MiB/s plus 10m0s, also while each pull makes progress. So a slow or broken source that sends one small frame before each idle timeout cannot hold a move without an end. A move that a control process of schema version 57 to 59 handed off has no time of the first pull, so its limit counts from the start of the move. A target of such a release never reports a restart, so its move gets no new limit. The leader job checks the deadline and the time limit at each step. A resumed pull can wait for the digest job of the source, and that wait writes no bytes. So the digest of a disk must take less than 30 min. An instance admin can also end a move that runs, with CancelMove (the admin API) or hopboxd admin machine move --cancel (hopboxd). The move then fails with the error an instance admin canceled the move, and the service logs an instance admin canceled the move of a machine.

State of the move Result
stopping Only a cancel ends it. The spec gives the machine its own target again on its node.
pulling The result of a failed pull (End of a move). The machine goes back to the source node with its disk, stopped. A machine with the target deleted goes back with that target. A machine that is no longer in moving on the target stays there.

The next heartbeat of the source node withdraws the disk from its listener, and the listener ends the streams of that disk at once. The target node then removes what it pulled.

ReportMachine reads the move of the machine in the transaction of each report of the target node while the move is pulling. Only a report that names the move in pulled_move_id proves that the target has the whole disk (the executor protocol). Once the disk is here, the executor names the move in each report:

Report Result
Any state but failed, with the ID of the move in pulled_move_id The move is done. The source node must remove its old copy. The service logs a machine moved to another node. A report of the same state ends the move too.
The same state, without the proof Nothing ends. A report with pull_received above 0 holds off the pull deadline.
failed The move is failed, with the error of the report. The control role ends the lease of the target. It gives the machine and its address back to the source node, with the current state and the target stopped. The target node must remove what it pulled. The service logs the target node could not pull the disk, so the machine stays stopped on its source node.
Any other step The same result as failed, with the error the target node left the state <state> with <new state>, without the whole disk of the move. An executor of an older release gives such a report, because it boots a new disk from the image.

The executor of the target boots the machine only after the control role accepted the report with the proof. If the move ended before, such as through a cancel, the control role refuses that report, because the lease of the target ended. So the machine never boots on the target.

An executor of an older release on the target can boot a new disk from the image before its report. The move fails, and the machine goes back to the source. That executor loses its lease, but its microVM of the new disk keeps running on the node until the node upgrades. After the upgrade, the node gets the removal of the files of the machine. The files stay while that microVM runs, and the node logs the control plane asks this node to remove the files of a machine that it still acts on, so they stay for now. An operator stops the systemd unit of that machine on the node.

The next heartbeat of the source node grants it the machine again. The machine stays stopped there with its disk. A start boots it from that disk.

The end of a move writes the audit entry machine.move with the actor system and move, result, and for a failure error. A failure that leaves the machine on its target adds stayed, the state of the machine.

A step that an older control process accepted

Section titled “A step that an older control process accepted”

A control process of the schema version 44 to 49 can take the channel of the target node during a pull. It accepts a step of the target out of moving, such as failed, and does not end the move. The move then stays pulling, and the machine is on the target in another state. The executor still waits for the proof, and pulls the disk again once a spec names the move.

A cancel, the pull deadline, or a step of the target without the proof then fail the move, and leave the machine where it is. The target can already run the machine with the pulled disk. So the control role never takes the machine back by itself, and no two microVMs run it. The move gets no cleanup_server_id, and the source keeps its copy of the disk. The service logs a cold move failed while its machine was not in the state moving on the target node, so the machine stays there. The source node keeps its copy of the disk at level warn, with state and err. An operator decides about that copy with a give-back (Give-back) or a delete. If the target has no whole disk, the machine never boots there, and a delete removes it. The machine does not move again while the source keeps the copy, because a move from the target could make a partial or a blank disk the machine. MoveMachine and a drain refuse it. The source never counts as empty for a drain, and DecommissionServer refuses it, also after a later move of the machine from another node. Only a give-back or a delete of the machine ends the copy.

The owner approved the give-back on 2026-10-29 (plan question Q102). CancelMove with give_back (the admin API) or hopboxd admin machine move --cancel --give-back (hopboxd) asks the target node of a move to give the machine back to the source node. It applies to a machine that the move left on its target while the source keeps a copy of its disk (A step that an older control process accepted). The call takes these cases:

Case What the call does
The move is pulling, and the machine is no longer in moving on the target It fails the move as a cancel does, and asks for the give-back, in one transaction.
No move runs, and the newest failed move left the machine on its target while the source keeps a copy It asks for the give-back. A second call asks again.
The move is stopping, or the machine is in moving on the target It cancels the move as CancelMove does. The machine stays on its source, or goes back there, so it needs no give-back.
Any other case It fails with failed precondition: the machine has no move that runs, and no failed move left it on its node while another node keeps a copy of its disk.

A refusal of the give-back changes nothing, also the cancel of a move that the same call asks for. Cancel without the give-back to end such a move alone.

Only the target node knows whether a control process of an older release accepted the proof of the pull, so the target node decides. The request sets give_back of the move to requested (Control store tables), and gives the machine a new version of its spec. The spec of the machine on the target then names the move in give_back_move_id (the executor protocol). For each new version of the spec, the executor of the target answers once, in a report of the state that the control role holds:

Node Answer Result
It never proved the pull of the move, holds no disk file of the machine, and runs no microVM of it. A partial copy of a pull is no disk file. released_move_id give_back turns done. The control role ends the lease of the target, and gives the machine and its address back to the source, with the current state and the target stopped. A machine with the target deleted goes back with that target. The target removes what it pulled (cleanup_server_id is the target). The machine never boots on the target, because its executor boots it only after a control role accepted the proof of the pull, and the lease of the target ended.
It proved the pull, or holds the whole disk of the move kept_move_id give_back turns kept. The machine stays on the target, whose disk is the current one. The source removes its copy (cleanup_server_id is the source). The machine can move again once the source removed it, because a kept give-back ends the copy: MoveMachine, a drain, and DecommissionServer no longer count it.
A microVM of the machine runs on it none The node logs the control plane asks for the give-back of a machine whose microVM runs on this node, so the node keeps it at level warn. Stop the machine, then ask again. After the stop, the other rows decide: with the proof and the disk file, the node keeps the machine. Without the proof, the node withholds its answer, because the machine booted a disk file of the node.
It holds a disk file of the machine without the proof of the pull of the move, such as after a loss of its node-local state withheld_move_id, with the reason disk without proof The disk file can hold the newest writes, and a release would remove it. The give-back stays requested. The node logs the control plane asks for the give-back of a machine whose disk is on this node without the proof of the pull of the move, so the node does not answer, and an operator decides at level error.
It proved the pull, but its disk file is gone withheld_move_id, with the reason proof without disk A keep would remove the only whole copy on the source. The give-back stays requested. The node logs the control plane asks for the give-back of a machine whose pull this node proved, but its disk is not here, so the node does not answer at level error.
It cannot read the disk file of the machine withheld_move_id, with the reason disk unreadable The disk file can hold the newest writes. The give-back stays requested.

A withheld answer writes the note of its reason to give_back_note of the move, and the control role logs the target node withholds its answer to the give-back of a machine at level warn, once for each new note. hopboxd admin machine moves shows the note (hopboxd):

Reason Note
disk without proof the target node holds a disk file of the machine without the proof of the pull of the move, so a release could drop the newest disk, and it does not answer
proof without disk the target node proved the pull of the move, but its disk file is gone, so a keep would remove the only whole copy on the source, and it does not answer
disk unreadable the target node cannot read the disk file of the machine, so it does not answer

A give-back that the node withholds has these exits today:

  • Withdraw it with CancelMove with withdraw_give_back, or hopboxd admin machine move --withdraw-give-back. The move gets back its state from before the request: no give_back, no note. The spec of the target no longer names the move, and an answer that comes later changes nothing. The audit entry is machine.cancel_move with give_back withdrawn. The machine stays on the target, and the source keeps its copy.
  • Wait. Each new version of the spec, such as a second request, gets a new answer. If the reason ends, such as a disk file that the node can read again, the node answers then.
  • Delete the machine. A delete removes the disk file on the target and the copy on the source, so it loses both copies. Read both copies first, and keep the one that you need outside of hopbox. Each copy is <data_dir>/machines/<machine id>/disk.raw on its node, /var/lib/hopbox/machines/<machine id>/disk.raw with the default data_dir (the Firecracker driver). While the machine is stopped, copy each file with cp --sparse=always, so the holes of the disk stay holes.

No call takes the copy on the source while the target holds a disk file without the proof, and no call keeps the copy on the target in that case. The owner decides whether hopbox adds such a call.

The answer writes the audit entry machine.move with the actor system, move, and give_back (done or kept). It also drops the strands of the machine in each drain, because their reason named the copy. So the next step of a drain of the source or the target looks at the machine again, and moves it once no old copy waits for its cleanup. A step of a drain that wrote such a strand while the answer ran drops it at its next step, because the copy no longer exists. The removal of the node role keeps its strands until its cancel. The request writes the entry machine.cancel_move with give_back requested.

The call refuses with failed_precondition in two more cases. The heartbeats of the target node name no feature give-back (the control channel): the node <id> runs hopboxd <version>, whose heartbeats name no feature give-back. Upgrade it first, or cancel without the give-back. Or a live control process runs a release of the schema version below 59: the control process <process> knows the migrations up to <n>, and only a hopboxd that knows migration 59 gives machines back. Upgrade it first. Such a control role sends no give-back to a node, and accepts an answer without the give-back. If one starts after the request and takes the channel of the target, the answer can get lost. Ask again: the new version of the spec gets a new answer.

cleanup_server_id of a move names the node that still holds an old copy of the files of the machine: the source after done, the target after failed. The DiskTransfers of that node lists the machine in remove, once the machine is on another node or its row is gone. The executor of the node removes the files once it holds no valid lease of the machine and the microVM does not run: the disk, the partial copy, the node-local state, and the log. Then the next heartbeats name the machine in removed_machines, and the control role clears cleanup_server_id. A new move of the machine waits until then.

A move carries the extra disks that are attached to the machine (Extra disks). The spec of the moving machine names them in disks of MachineMove (the executor protocol). The target pulls the disk of the machine first, then each attached disk, through the same disk listener and the same steps. The proof of the pull, pulled_move_id, comes only once every disk of the move is whole. A failure of the pull of any of them counts toward the 3 failures that end the move. The listener of the source serves each attached disk with the export of the machine. So it refuses the disk while the executor holds the lease or the microVM runs.

A machine with an attached disk moves only to a node whose heartbeats name the feature disks. The target must also hold no old copy of one of the disks that it still removes. A placement that finds no such node fails with no capacity.

End of the move The attached disks
done They live on the target. The source removes its copies, as remove of NodeDisks names them (the control channel).
failed, the machine back on the source They stay on the source. The target removes what it pulled.
A give-back that the target keeps They live on the target, and the source removes its copies. The target keeps the machine only with the proof, so it holds every disk.
A give-back that the target releases They stay on the source, and the target removes what it pulled.

Take a move that failed while the machine was not in moving on its target. It leaves the disks on the source, beside the copy of the disk of the machine.

A drain takes every machine off a node, so that the node can leave the install. DrainServer of the admin API (the admin API) or hopboxd admin server drain (hopboxd) starts it. The guide Drain a node shows it step by step. The drain cordons the node and sets its state to draining (the control channel). Then a leader job moves each machine of the node cold to another node. A drain never deletes a machine. Every machine keeps its disk.

The code is in internal/service/drains.go. The leader job calls service.AdvanceDrains every 5 s (control.DrainEvery).

Item Value
Moves from the node at once At most 2 (service.DrainMoves). The count includes the moves that an admin started.
Empty checks in a row 3 (service.DrainEmptyChecks)
Time between two empty checks 1 min (service.DrainCheckEvery)
Step of the leader job Every 5 s (control.DrainEvery)

DrainServer locks the server, and does these things in one transaction:

  1. It writes a row of server_drains for the node (Control store tables), with cordoned_before, the cordon flag of the node before the drain. A second call finds the row. It clears the stranded machines, restarts started_at, and counts the empty checks from zero. It keeps cordoned_before. This is a retry.
  2. It sets the cordon flag. A node in ready or cordoned turns draining.
  3. It writes the audit entry server.drain with the target kind server and the details old_state, state, and retry (true or false).

A node in unresponsive stays unresponsive with the cordon flag set. It turns draining at its next heartbeat, because a node with a row in server_drains comes back as draining, before the cordon rule. UncordonServer refuses a node that drains, with failed precondition: the server <id> drains, and stays cordoned until the drain decommissions it. To keep the server, cancel the drain with hopboxd admin server cancel-drain <id>. CordonServer during the drain sets cordoned_before, so a cancel keeps that cordon (Cancel of a drain). Placement takes only ready nodes, so a draining node takes no new machine.

DrainServer refuses these cases:

Case Error
The ID is not valid invalid_argument
No server has the ID not_found
The server left the install failed precondition: the server <id> is decommissioned
The server has no role node failed precondition: the server <id> has no role node, so it holds no machine to move. Decommission it instead
An admin session drains a server that shares its host with a live control process, or with the control process that takes the call permission denied: the server <id> hosts a control process, so only root on a control server or an admin API key drains it. A drain ends in a decommission, and a control server goes only by root or by the Terraform provider.
A live control process runs a release of the schema version below 51 (Two releases) failed precondition: the control process <process> knows the migrations up to <n>, and only a hopboxd that knows migration 51 drains servers. Upgrade it first

Each run, the job reads the machines of the node in the order of their IDs. A machine that its executor has deleted does not count. For each machine, it does the first case that fits:

Machine What the job does
A move of the machine runs It waits.
The target is deleted It waits, with the reason the machine <name> waits for its delete. The delete goes by itself.
The current state is pending, and the target is running It waits until the machine boots, with the reason the machine <name> has not booted yet, and moves once it runs. Then it can move.
The machine cannot move cold: it never booted with the target stopped, is hibernated or standby, or has another target The machine is stranded, with the reason a cold move needs a machine that booted, with the target running or stopped. This one is <state>, with the target <target>.
The newest move of the machine from the node since the start of the drain failed The machine is stranded, with the reason its move failed: <error of the move>. It stays stopped with its disk on the node.
Otherwise A move starts, if fewer than 2 moves run from the node.

A move starts as MoveMachine starts it (Start of a move), with a target that placement picks. The audit entry is machine.move with the actor system, the same details, and the detail drain, the ID of the server. A machine whose last move still waits for the cleanup of an old copy waits too, with the reason the machine <name> waits until the node <id> (<state>) removes the old copy of its last move. The state shows a node that cannot do the cleanup now, such as an unresponsive one. A start that fails with failed_precondition or with no capacity strands the machine. Its reason is the message of that error, such as no capacity: no node has room for a machine of size .... A machine whose node keeps its memory file strands so, with the reason of the memory file (Start of a move).

A machine that cannot move stays on the node with its disk: a running machine with no room keeps running, a machine whose move failed stays stopped. The stop is part of the cold move, and an early stop of a machine with no room elsewhere only adds downtime.

An attached disk moves with its machine (Attached disks). After the machines, each step of the drain takes the detached disks of the node, in the order of their IDs. It moves each one by a move of its own. The table disk_moves holds these moves (Control store tables). Such a move counts toward the 2 moves at once from the node, with the moves of machines. For each detached disk, the job does the first case that fits:

Disk What the job does
A move of the disk runs It waits.
Its node has not made its file yet It waits, with the reason the disk <name> waits for the node to make its file.
The newest move of the disk from the node since the start of the drain failed The disk is stranded, with the reason its move failed: <error of the move>.
A node still removes an old copy of the disk It waits, with the reason the disk <name> waits until the node <id> removes the old copy of its last move.
Otherwise If fewer than 2 moves run from the node, a move starts.

A disk move needs a source that serves disks, and a target that is ready, in the mesh, and names the feature disks. The target holds no old copy of the disk, and has free disk for the blocks that the guest wrote (used_bytes). Among such nodes, the move takes the one with the most free disk. The job locks the row of the target and checks again that it is ready. So a drain or a decommission of the target waits for the move. With no such node, the disk strands with the reason no capacity: no other node takes the disk <name>: .... A drain tries it again once a minute, as a machine without room. A removal of the node role does not try it again. An attached disk whose machine lives on another node strands with the reason the disk is attached to the machine <name> on another node. Move the machine back, or detach the disk. A move of an older release leaves such a disk. That strand ends at the next step once the machine is back, or the disk is detached. A machine that moves from the node is on its target before the proof of the pull. Its move carries its disks, so they never strand this way.

The target pulls the disk from the disk listener of the source, as the executor pulls the disk of a machine (The pull). Its disk keeper runs the pull (Extra disks). Once the disk is whole, the next heartbeat of the target names the move in pulled_disk_moves. After 3 failures in a row, it names the move in failed_disk_moves (the control channel). The control role then ends the move:

End Result
done The disk lives on the target. The source removes its copy.
failed The disk stays on the source with its data. The target removes what it pulled.

A disk move has the time limit of a cold move: the size of the disk at 1 MiB/s, plus 10 min, from its start. The leader job of the moves fails a move that runs longer, with the error the move ran longer than <limit>, the time of its disk at 1 MiB/s plus 10m0s. A cancel of the drain lets the moves of disks run to their end, as it does for the moves that pull. A delete of the disk during its move ends the move, and both nodes remove their files.

The start of a disk move writes the audit entry disk.move with the actor system. Its details are move, source, target, and drain or removal, the ID of the server. The end writes disk.move with move, source, target, result, and for a failure error.

A machine that no node had room for gets the time of a next try, 1 min later (service.DrainRetryEvery, plan question Q102). So does a machine whose node has not yet reported the end of DiscardMemory. At that time, the drain takes the machine as a machine that is not stranded. If a move of it starts, the machine leaves the stranded list. If no node has room again, the reason and the time of the next try change, and the drain logs the drain tried a stranded machine again, and it still cannot move at level debug. Any other reason ends the tries. The tries count toward the 2 moves at once, so a node that gets room takes the machines one step at a time. A machine stranded for another reason is not tried again until DrainServer runs again, because its reason needs a change by an operator. The removal of the node role does not try its stranded machines again. The drain also strands a machine whose disk copy a failed move left on this node (A step that an older control process accepted). The machine is on another node. Its reason is a failed move left the machine <state> on the node <id>, and this server keeps a copy of its disk. Give the machine back with hopboxd admin machine move --cancel --give-back, or delete it (reference/cold-move.md). A delete of that machine ends the reason.

The drain is stuck when no move runs, every machine left on the server is stranded, and a machine is stranded or the decommission was refused. A stuck drain waits for an operator. The operator fixes the reason, then runs DrainServer again. For a machine without room, room is enough: the next try moves it.

The error of the drain says why the drain waits now: an older control process, a node without heartbeats, the first wait of the table above, an old copy on the node, or a refused decommission. So a drain that starts no move always shows its reason. The control store keeps the time of the empty checks, so a new leader with another clock keeps the gap of 1 min.

After the moves, the job checks the node. The node counts as empty when all these things hold:

  • The state is draining or shutting_down, so the node answers its heartbeats.
  • No machine is on the node in the control store, except machines that their executor has deleted.
  • The last heartbeat of the node lists no allocation.
  • No move runs from or to the node.
  • No old copy waits for the node to remove it (cleanup_server_id). While one waits, the reason is the server still removes the old copy of the machine <name>.
  • The node keeps no copy of a disk after a failed move.
  • No extra disk is on the node, and no move of a disk runs from or to it. The node removed each file of a disk that left it (Extra disks).
  • No live control process runs a release of the schema version below 51.

The first empty check turns the state to shutting_down. It writes the audit entry server.mark_shutting_down with the actor system and the details old_state draining, state shutting_down, and checks 1. The later checks change no state and write no such entry. The checks are 1 min apart, and the third one decommissions the node with all the checks of DecommissionServer (the admin API). The audit entry is server.decommission with the actor system and the details old_state shutting_down, state decommissioned, and drain true. The row of server_drains goes with the decommission.

Event Result
A check finds the node not empty The state goes back to draining, and the empty checks restart from zero. The audit entry is server.mark_draining with the actor system and the details old_state shutting_down, state draining, and reason: the node is not empty, or why the drain waits.
DrainServer runs again The state goes back to draining, and the empty checks restart from zero.
The node sends no heartbeat for 20 s The state turns unresponsive, and the audit entry is server.mark_unresponsive. The leader job marks draining and shutting_down nodes too. The error of the drain is the server sends no heartbeat, so the drain waits for it. The drain goes on at the next heartbeat.
The third check meets a refusal of the decommission, such as ... shares its host with the last live control process ... The error of the drain holds the message. The empty checks stay at 3, and the next check one minute later tries again.
A live control process runs a release of the schema version below 51 The error holds the refusal message of DrainServer. The drain starts no move and runs no check.

DecommissionServer still works on a draining or shutting_down node that is empty. Its refusals now name the cause: the machines, the move, or the kept copy (the admin API). A decommission also drops the old copies that the server still had to remove. It clears cleanup_server_id of those moves, so that a new move of those machines does not wait.

CancelDrain of the admin API (the admin API) or hopboxd admin server cancel-drain (hopboxd) ends a drain. The owner approved it on 2026-10-29 (plan question Q102). The call does these things in one transaction:

  1. It ends each move from the node that started since the first start of the drain and is still stopping, as CancelMove ends it, with the error an instance admin canceled the drain of the server. A move that an admin started during the drain counts too, and a move that started before the drain does not. The machine keeps its own target on the node, so a running machine boots there again.
  2. It leaves each move in pulling. That machine stopped already, and a cancel of the pull leaves it stopped on the source (Pull deadline and cancel). The move ends done on the target, or fails by the rules of End of a move.
  3. It deletes the row of server_drains, with its stranded machines.
  4. It gives the node the cordon flag of cordoned_before. A draining or shutting_down node turns cordoned or ready. An unresponsive node keeps its state, and its next heartbeat gives it the state of its cordon. A row of a release of the schema version 57 or 58 has no cordoned_before, so the node stays cordoned.
  5. It writes the audit entry server.drain_cancel with old_state, state, cordoned, moved, canceled_moves, and pulling.

Each move of a drain starts only under a key share lock of the server row and a shared lock of the row of the drain. The cancel locks the server row and then the row of the drain. DrainServer and CordonServer take the two rows in the same order. So no move of the drain starts after the cancel, and none of these calls ends in a deadlock with a move. The empty check takes the lock of the server registry before the server row, because its last check can decommission the node. If a move starts between the first read of the cancel and its lock, the cancel tries again, at most 3 times. Then it fails with conflict: moves from the server <id> kept starting during the cancel. Retry.

A heartbeat that brings a node back from unresponsive during a cancel can still read the old row of the drain, and set draining. So each step of the drain job first gives each draining or shutting_down node without a drain the state of its cordon. It locks the server row, and reads the drain again under the lock, so a DrainServer that committed meanwhile keeps its state. It writes the audit entry server.mark_undrained with the actor system and the details old_state, state, and reason the server has no drain.

The cancel refuses while a live control process runs a release of the schema version below 59. Such a leader does not know the cancel. Its step of the drain can set the cordon and the state draining again on a node whose drain the cancel ended.

The control role logs with component=service:

Message Level Fields
the drain of a server starts info server, retry
the drain of a server moves a machine info server, machine, move, target
the drain of a server cannot move a machine, so the machine stays with its disk warn server, machine, reason
the drain tried a stranded machine again, and it still cannot move debug server, machine, reason
a step of the drain of a server failed. The next run tries again warn server, err
the drain found a server empty info server, checks
the drain decommissioned a server info server
the drain of a server moves a disk info server, disk, move, target
the drain of a server cannot move a disk, so the disk stays with its data warn server, disk, reason
the drain cannot decommission a server that it found empty warn server, err
an instance admin canceled the drain of a server info server, state, moved, canceled_moves, pulling
a server without a drain was in a state of a drain, so it gets the state of its cordon warn server, state

The leader logs taking the drains on failed at level warn with err, with component=leader.

The leader sweep frees the subnet of a decommissioned node, with the other sweeps (Control store tables). A subnet is free once no machine address of it is held. An address is held when held_until is null or in the future. A moved machine keeps the address of its first node, so the subnet stays taken while such a machine lives. The next node that gets its first machine takes the first free subnet, which can be the freed one (the node network). The sweep log freed reserved machine names and ports has the field subnets for the count.

The removal of the role node from a running server moves its machines off as a drain does. But the server stays in the install with its other roles. An example is an edge server that keeps edge. RemoveServerRoles of the admin API (the admin API) or hopboxd admin server remove-role <server> node (hopboxd) starts it. The call cordons the server, and the state turns cordoned, not draining.

The code is in internal/service/removals.go. The leader job calls service.AdvanceRemovals every 5 s, after service.AdvanceDrains. Each run does what a drain does with the machines of the node (The machines of the node): at most 2 moves at once, the same waits, and the same reasons of a stranded machine. The rows of removal_strands name the stranded machines, and removal_error says why the removal waits (Control store tables). The audit entry of each move is machine.move with the actor system and the detail removal, the ID of the server. Each run also sets the cordon again, when a control process of an older release lifted it.

These things differ from a drain:

  • No empty check and no decommission come at the end. The removal is ready once the server holds no machine, no allocation, and no move from or to it. It must also hold no old copy of a moved machine, and no copy of a disk that a failed move left. An enrollment of the server with the roles that stay then ends the removal (Enrollment and the install PKI).
  • A stranded machine stays stranded until the cancel of the removal. A second RemoveServerRoles with the same roles returns the pending removal, and changes nothing.
  • CancelRoleRemoval ends a removal that cannot finish. Each move from the server that started with the removal and still runs ends as CancelMove ends it, with the error an instance admin canceled the removal of the node role. A machine that moved stays on its new node (the admin API).
  • The server keeps its row in node_subnets, because each moved machine keeps the address of its first node (the node network).

The control role logs with component=service:

Message Level Fields
the removal of roles from a server starts info server, roles, cordoned_before
the removal of the node role moves a machine info server, machine, move, target
the removal of the node role cannot move a machine, so the machine stays with its disk warn server, machine, reason
a step of the removal of the node role failed. The next run tries again warn server, err
an instance admin canceled the removal of roles from a server info server, roles, moved, canceled_moves

The leader logs taking the removals of the node role on failed at level warn with err, with component=leader.

Item After the move
Disk The same bytes, with the same holes.
Memory Lost. A running machine boots again on the target.
Name, URL, SSH port The same.
Address The same address of the subnet of its first node, and the same IPv6 address. The target node routes the /32 and the /128 to the tap device of the machine. The mesh peer of the target allows both (the node network, the mesh).
Route record Dropped at the stop, and written again with the lease of the target at the report of running. So no traffic goes to the source after the move.
Target state The same. During the stop, the spec of the source has the target stopped, and the machine row keeps its own target. So the usage of its org and of its node stay as they are.
Lifecycle calls They change the machine row as usual. During the stop, the spec stays stopped, apart from a delete. On the target, the machine reaches the target of the row once its disk is whole.

Three things let a node run the disk listener on port 7444 of its mesh address. Its driver keeps its disks in files, and the node has an identity and a mesh address. Once the node knows its mesh address, the listener listens on it. A check every 2 s finds a new address, and the listener then listens on it.

Both sides of a pull use their server certificates of the install CA (Enrollment and the install PKI):

  1. The listener asks each client for its certificate. The certificate must chain to the install CA, have the usage client auth, and name a server with the role node. Any other client fails the TLS handshake.
  2. The target checks the certificate of the listener the same way, and checks that it names the source node of the spec. The mesh address of a node is in no certificate, so this check replaces the check of the host name.
  3. The listener serves the disk of a machine only to one node, and only with one of its certificates. That node is the target in serve of the last DiskTransfers of the control role. The serial of the certificate must be in target_serials of that entry. The control role lists a disk there only while its move is pulling, with the target of that move. target_serials holds the serials of the certificates of the target that are not retired and not expired.

So a node can pull only the disk of a machine whose lease the control role granted to it for a move. A pull of another machine, a pull by another node, or a pull with a retired certificate gets 403. When the next DiskTransfers no longer lists a disk, the listener ends each stream of that disk at once. The listener never serves the disk of a machine whose executor holds a valid lease or whose microVM runs.

GET https://<mesh address>:7444/v1/disks/<machine ID>?offset=<bytes>
GET https://<mesh address>:7444/v1/extra-disks/<disk ID>?offset=<bytes>

The second path serves an extra disk, with the same rules, frames, and digest (Extra disks). Its export names the disk in disk_id of DiskExport. An export of a machine does not serve the second path, and an export of a disk does not serve the first. The listener answers 409 for an attached disk while the executor of its machine holds the lease or the microVM runs. It answers 409 for a detached disk while an executor of the node holds a valid lease of a machine with the disk.

Status When
200 The stream of the disk from offset follows.
400 The path names no machine, or offset is not a byte offset.
401 The request has no certificate of a node.
403 The control role names another node, or none, for the disk, or the certificate of the request is not in target_serials.
404 The node has no disk of the machine.
409 The machine still runs on the node, or its executor holds its lease.
416 offset is past the end of the disk.
500 The node cannot read the disk.
503 The node has no identity yet.
Header of 200 Value
Content-Type application/vnd.hopbox.disk
Hopbox-Disk-Size The size of the disk in bytes.
Hopbox-Disk-Version The version of the disk file: <inode>-<time of change in ns>-<size>.
Trailer Hopbox-Disk-Digest
Trailer of 200 Value
Hopbox-Disk-Digest The digest of the whole disk, sha256:<hex>. It comes after the end frame. A stream that ends early has no digest.

The listener sends the headers at once, before it reads the disk. So no digest delays the start of a stream.

The body is a list of frames. Each frame is a header of 12 bytes, then its data:

Bytes Value
0 to 7 The offset of the data in the disk, big-endian.
8 to 11 The length of the data, at most 1 MiB, big-endian.

The frames come in the order of their offsets, from offset rounded down to a block. Each frame holds blocks that are not all zeros, so the holes of the disk and its blocks of zeros never cross the mesh. The listener skips the holes that the file system reports with SEEK_DATA and SEEK_HOLE, and reads the rest. A frame with the length 0 and the offset of the size of the disk ends the stream. A stream without it was cut.

The target writes each frame at its offset in the partial copy <disk>.pull, which it first makes the size of the disk. So the copy keeps the holes. The file <disk>.pull.json holds the progress. It has the move, the version of the disk file of the source, and the size. It also has the offset up to which the copy is on disk, and the digest state of the copy at that offset. A pull of another move, or a source whose size or version changed, starts again from zero.

The digest of a disk is one sha256. It takes each block that holds a byte other than zero, as its offset in 8 bytes big-endian and then its bytes. Then it takes the size of the disk in 8 bytes big-endian. A hole and a block of zeros give the same digest, so both nodes agree whatever their file systems allocate.

A stream from offset 0 computes the digest of the source while it sends the frames. A stream from another offset needs the digest of the whole disk. For such a stream, the source starts a digest job apart from the request. When the job ends, the source sends the trailer. The job outlives the request, so a pull that stops early finds the digest later. The source keeps each digest for the version of its disk file while the control role lists the disk.

The target adds each frame to the digest of its copy as it writes it, and keeps the state of that digest with the progress. After the end frame, the target waits for the trailer without an idle timeout. When both digests match, it renames the copy to the disk file of the machine, and syncs the dir. Otherwise, it drops the copy.

If the heartbeats of a node say disk_transfer, the node takes part in moves (the control channel). The control role keeps the version of hopboxd of the last such heartbeat in servers.disk_transfer_version (Control store tables). A node is a source or a target only while two things hold. That version is the current version of the node, and the node is in the mesh. So a node that went back to a release without moves takes no move.

A release of the schema version 44 to 49 runs beside migration 0050 (Control store tables). Such a control role sends the spec of a moving machine without move. Its lifecycle calls do not know the moves. Two checks keep the disk of a machine safe in that case:

  1. A live row of control_processes can have a schema_version below 50 (service.MovesSchema, Control store tables). While it does, the control role refuses MoveMachine and holds the hand-off of each move. A control process of a release before migration 0045 writes no row, so upgrade every control server before the first move.
  2. The target node keeps the move in its node-local state. It never boots the machine until it has the whole disk of that move, whatever the spec says (The pull).

An executor of an older release on the target can boot a new disk from the image, and report stopped or running. That report has no pulled_move_id, so the move fails and the source keeps the disk (End of a move).

The drain needs migration 0051 (service.DrainsSchema, Control store tables). A release of the schema version 44 to 50 runs beside it. It never reads the new tables, runs no drain job, and shows draining and shutting_down as unknown. It places nothing on such a node. It keeps the state in its heartbeats and never marks such a node unresponsive. Its uncordon can clear the cordon flag, which the next step of the drain sets again. Its hand-off of a move from a draining source waits and fails after 10 min. So while such a control process is live, DrainServer refuses, and the drain job starts no move, runs no check, and decommissions nothing (Start).

The cancel of a drain needs migration 0059 (service.DrainCancelSchema, Control store tables). A release of the schema version 57 or 58 runs beside it. It never reads the new columns, and its drains write no cordoned_before, so their cancel keeps the cordon. While such a control process is live, CancelDrain refuses (Cancel of a drain).

The removal of a role needs migration 0056 (service.RemovalsSchema, Control store tables). A release of the schema version 44 to 55 runs beside it. It never reads the removal, and its enrollment refuses a list that drops a role. Its uncordon can clear the cordon of a removal of node, which the next step of the removal sets again. So while such a control process is live, RemoveServerRoles refuses, and the removal job starts no move.

Metric Type Labels Description
hopbox_disk_transfer_bytes_total counter direction The bytes of disk data of the pulls. sent counts what the node sent to other nodes. received counts what it pulled from another node.
hopbox_disk_transfers gauge direction The pulls that run now. sent counts the pulls that the node serves, from the start of the stream to its end. received counts the pulls that the node makes, from the answer of the source that serves the disk to the end of the pull.
hopbox_disk_transfer_restarts_total counter reason The pulls that dropped their partial copy, so the next pull starts again from zero. digest_mismatch: the copy had another digest than the disk of the source. source_changed: the disk of the source changed since the pull that left the copy. bad_progress: the node cannot read the saved state of the digest of the copy.

Each series of the gauge and of the restarts starts at 0. A pull of another move drops the partial copy of the old move, but it is a new pull, and it does not count as a restart. A refused pull does not count in the gauge.

The pulls count in hopbox_executor_actions_total with the action pull (the node executor).

The control role logs with component=service:

Message Level Fields
a cold move of a machine starts info machine, move, source, target
handed a stopped machine to the target node of its move info move, machine, source, target
a cold move failed, so the machine stays on its node warn move, machine, source, target, err
a step of a cold move failed. The next run tries again warn move, machine, err
a machine moved to another node info machine, move, source, target
a cold move failed while its machine was not in the state moving on the target node, so the machine stays there. The source node keeps its copy of the disk warn machine, move, source, target, state, err
an instance admin canceled the move of a machine info machine, move, source, target
an instance admin asked the target node to give a machine back to its source node info machine, move, source, target
an instance admin withdrew the give-back of a machine info machine, move, source, target
the target node withholds its answer to the give-back of a machine warn machine, move, source, target, reason
the target node never proved the pull, so it gave the machine back to its source node info machine, move, source, target
the target node holds the whole disk of the move, so it keeps the machine, and the source node removes its copy info machine, move, source, target
the target node could not pull the disk, so the machine stays stopped on its source node warn machine, move, source, target, err
a node removed the old files of a machine that left it info machine, move, server
Message Level Component Fields
taking the cold moves on failed warn leader err
reading the moves of a node failed. The next heartbeat tries again warn channel server, err
the control plane sent the disks of cold moves to a server that takes part in no move warn node

The executor logs with component=executor and machine:

Message Level Fields
the disk of the machine is on this node info move, source, size. With extra disks, it comes once every disk is here.
an extra disk of the machine is on this node info move, disk, size
the pull of the disk stopped, and the executor tries again warn move, source, received, err, retry_in
the pull of the disk failed for good, so the machine goes back to its source node error move, source, err
the spec names no valid source node of the disk error source
this node never proved the pull of the move, so it gives the machine back to its source node info move
this node holds the disk of the move, so it keeps the machine, and the source node removes its copy info move
the control plane asks for the give-back of a machine whose microVM runs on this node, so the node keeps it warn move
the control plane asks for the give-back of a machine whose pull this node proved, but its disk is not here, so the node does not answer error move
the control plane asks for the give-back of a machine whose disk is on this node without the proof of the pull of the move, so the node does not answer, and an operator decides error move
the control plane asks for the give-back of a machine whose disk file this node cannot read, so the node does not answer error move, err
removed the files of a machine that left this node info
removing the files of a machine that left this node failed warn err. The next step tries again.
the control plane asks this node to remove the files of a machine that it still acts on, so they stay for now warn
cannot remove the node-local state of a machine that left this node error err
cannot remove the log of a machine that left this node error err

A moving machine whose spec names no source logs the executor cannot reach the target at level warn, with the reason the machine moves to this node, but the spec names no source node of its disk, or this node pulls no disk.

The disk listener and the pulls log with component=transfer and machine. The listener adds peer, the pulling node, and a pull adds source:

Message Level Fields
the disk listener serves the pulls of disks info address. No machine.
cannot listen for the pulls of disks. The next check tries again error address, port, err, retry_in. No machine.
a node pulls the disk of a machine info offset, size
a node pulled the disk of a machine info sent, size, duration
a node pulls an extra disk info offset, size. The field disk takes the place of machine.
a node pulled an extra disk info sent, size, duration. The field disk takes the place of machine.
the pull of a disk ended early warn sent, err
refused the pull of a disk by a node that the control plane did not name for it warn
a node pulls the disk of a machine that has no disk on this node error
a node pulls an extra disk that has no file on this node error disk in the place of machine
cannot open the disk of a machine for a pull error err
cannot compute the digest of a disk error err. The error transfer: the disk changed during the pull means that the disk file changed during the digest job. The next pull then starts again from zero.
pulling the disk of a machine info size
resumed the pull of a disk info offset, size
pulled the disk of a machine info size, received, digest, duration
pulling an extra disk info size, disk
pulled an extra disk info size, received, digest, duration, disk
the disk of the source changed since the last pull, so the pull starts again from zero warn
the control plane named a disk to serve without valid IDs warn machine, target
Error Cause
transfer: the source node does not serve the disk now: ... 403 or 409. The executor tries again.
transfer: the source node has no disk of the machine: ... 404. It counts toward the end of the move.
transfer: the copy of the disk has another digest than the disk of the source: ... The copy is dropped. It counts toward the end of the move.
transfer: cannot write the copy of the disk on this node: ... A local failure, such as a full disk. It counts toward the end of the move.
transfer: the peer is not a node of this install: ... A certificate that does not chain to the install CA, names no node, or names another node than the source.
transfer: the source sent nothing for 30s The idle timeout of a pull.
transfer: the source sent no valid size or version of the disk The headers of the source have no size or no version. The executor tries again.
transfer: the source sent no digest of the disk The stream ended without the trailer. The executor tries again from the saved progress.
Test Where it runs What it checks
The tests of internal/node/transfer make test, also on a Mac The digest of holes and zeros, and a pull that keeps the holes. The refusals of the listener, a node of another install, a server without the node role, and a retired certificate. A cut pull that resumes, a changed disk and another move that start from zero, and the idle timeout. A slow frame and a rate limit that the idle timeout does not end, and a stall in the middle of a frame that it ends. A digest that takes longer than the timeout of a pull, a digest that does not match, and a withdrawn disk that ends its stream, also between two frames and before the trailer.
The tests of internal/node/executor make test, also on a Mac A moving machine that never boots without its disk, also after a restart and with a spec of an older control role. A machine that boots only after the control role accepted the proof of its pull, also after an older control process accepted failed. The answers to a give-back: a release without the disk, also beside a partial copy, one answer for each version of the spec, a keep with the disk, and no answer while the microVM runs, also with the proof. A withheld answer with its reason for a disk without the move, a proof without its disk, and a disk file that the node cannot read. A keep with the proof from a node whose proof waits, after which the machine boots. Busy, and a removal that waits until the node stops acting on the machine. Refused pulls that try again every 1 s for 10 s, then twice as long each time, and never fail the move. A copy with another digest, which the next report marks with pull_restarted.
TestColdMove, TestColdMoveFails, TestMoveRefusals, TestDeleteDuringAMove, TestColdMoveNeedsTheProofOfThePull, TestCancelMove, TestPullDeadline, TestMoveTimeLimit, TestTimeLimitOfAMoveThatEndedMeanwhile, TestMoveLimit, TestMovesWaitForEveryControlProcess, TestMoveAfterAnOldControlAcceptedTheTarget of internal/service make test The steps of a move in the control store. The spec of the stop, the hand-off, the lease, the address, the mesh, DiskTransfers, the end, and the cleanup. A failed stop, a failed pull, the refusals, and a delete during a move. A target that leaves moving without the proof of the pull, a cancel, and the pull deadline with its progress. A control process of an older release, also one that accepted a step of the target.
TestGiveBack, TestGiveBackKeptByTheTarget, TestGiveBackWithTheCancelOfAPull, TestGiveBackRefusals, TestGiveBackDuringADrain, TestGiveBackAnswersThatNobodyAskedFor, TestGiveBackWithheldAndWithdrawn, TestDrainDropsAStrandOfACopyThatEnded, TestAKeptGiveBackEndsTheCopy of internal/service make test The give-back in the control store: the request, the spec, a release that takes the machine back to its source, an answer that keeps it on the target, and the refusals. A give-back during a drain of the source ends the strand of the machine, and the drain moves it.
TestColdMovePullStartsWhenTheSourceIsReady of internal/control make test A move at the heartbeat gap of a real node. The pull starts within 1.5 s of the end of the lease of the source.
TestColdMoveEndToEnd of internal/control make test Two nodes over mutual TLS on loopback, with their executors, the test driver, and the disk listener. A running machine moves with the data of its disk, its name, its URL, its SSH port, and its address. The source removes its old copy. A move back to a node that cannot write the disk fails, and the machine stays stopped with its disk.
TestSlowColdMoveFailsAtItsTimeLimit of internal/control make test A source that sends 512 bytes every 200 ms, so each pull makes progress. The move fails at its time limit, which the test sets to 4 s, and the machine stays stopped on its source with its disk.
TestColdMove of test/fleet make test-fleet Two nodes of the test driver on inet0 with the real mesh on their peer addresses. A cut of the uplink of the target in the middle of the pull, and the pull resumes. The data, the name, the URL, the SSH port, and the address stay. A failed target keeps the disk on the source.
TestColdMoveKVM of test/fleet make test-fleet with FLEET_KVM_BUNDLE, on a host with /dev/kvm Two KVM nodes with the real Firecracker. A file that the guest wrote is there after the move, and the address in the guest stays. It skips without KVM.
TestDrain, TestDrainWithoutRoom, TestDrainStrandsAFailedMove, TestDrainKeepsACopyOfADisk, TestDecommissionWaitsForAMove, TestDrainWaits, TestDrainOfTheLastControlServer, TestSubnetOfADecommissionedNode of internal/service make test The drain in the control store: the states, the moves at most 2 at once, the stranded machines and their reasons, the empty checks, the decommission, the refusals, and the subnet of a decommissioned node.
TestDrainRetriesAMachineOnceRoomAppears, TestDrainRetryNeedsWantOfRoom, TestDrainRetriesAtMostTwoMachinesAtOnce of internal/service make test A machine without room is tried again once a minute, and moves once a node with room joined, at most 2 at once. A machine stranded for another reason, such as a node that serves no disk, is not tried again.
TestCancelDrain, TestCancelDrainKeepsTheCordon, TestCancelDrainOfAnUnresponsiveNode, TestCancelDrainBesideAnOldControlProcess, TestLeaderEndsADrainStateWithoutADrain, TestLeaderKeepsADrainThatStartsDuringItsRepair, TestDrainMoveTakesTheLocksInTheOrderOfTheCalls, TestNoMoveStartsAfterACancel, TestCancelDrainKeepsAMoveOfBefore of internal/service make test The cancel of a drain: a stopping move ends, a pulling move goes on, no new move starts, and the node gets back its state of before the drain. Also a cordon of before or during the drain, a drain of an older release, an unresponsive node, the refusal beside an older control process, and a node in a state of a drain without one. A cancel, a second drain, or a cordon while a move of the drain holds its locks, and a cancel between the plan of a step and its move.
TestGiveBackEndToEnd of internal/control make test Two nodes over mutual TLS on loopback, with their executors. A pull that an older control process took out of moving, a cancel with the give-back, the release by the target, and a start of the machine on its source with its disk.
TestDrainEndToEnd of internal/control make test Two nodes over mutual TLS on loopback. A running and a stopped machine move with their data and their address, and the drain decommissions the node.
TestDrain of test/fleet make test-fleet With no room, the drain strands all three machines. Then a drain with a failed pull of box3 strands box3, while box1 and box2 move, at most 2 at once. A retry moves box3, and 3 empty checks a minute apart decommission node1.
TestDrainCancel of test/fleet make test-fleet A cancel while two moves pull: both pulls end on node2, box3 never moves, and node1 turns ready. Then a drain while node2 is cordoned strands box3 for want of room, and the drain moves box3 once node2 is uncordoned, without a second drain.
TestDrainKVM of test/fleet make test-fleet with FLEET_KVM_BUNDLE, on a host with /dev/kvm KVM nodes with the real Firecracker. It skips without /dev/kvm and FLEET_KVM_BUNDLE.
TestRemoveEdgeAndDNS, TestTwoRemovalsSeeEachOther, TestRemoveServerRolesRefusals, TestRemoveNode, TestRemoveNodeWithoutRoom, TestCancelEndsTheMovesOfTheRemoval, TestRemovalStartsNoMoveBesideAnOldControlProcess, TestEnrollEndsTheRemovalOfEdgeAndDNS, TestEnrollEndsTheRemovalOfNode, TestTokenAddsOnlyARoleThatTheServerLost, TestEnrollRefusesAnAddAndADropAtOnce, TestAnAddBesideTheEndOfARemovalAddsNothing, TestRemovalOfNodeWaitsForTheOldCopy, TestRemovalOfNodeWaitsForAKeptCopy, TestAddWaitsForAPendingRemoval, TestEndNeedsATokenForTheRolesThatStay, TestDecommissionEndsTheRemoval, TestRemoveServerRolesRefusesADrainingServer, TestLeaderCordonsTheRemovalAgain, TestCancelKeepsTheMovesOfAnAdmin of internal/service make test The removal of a role in the control store. The tests cover each refusal of the start, the moves of node at most 2 at once, and the stranded machines. They cover the cancel with its cordon and the moves of an admin, and the end through Enroll with its refusals and an unused token. They also cover the leftovers of a node, the old certificate, removed_roles, the gate of an add, and the mesh peer without the subnet.
TestRemoveNodeFromAnEdge of test/fleet make test-fleet The removal of node from an edge with three machines. The test covers the moves, a stranded machine, a cancel, and the end. It covers the add of node back with the same subnet, and a token for a role that the server never lost.