Documentation
¶
Overview ¶
Package volmove moves every volume a tile mounts from one node to another.
Docker has no move-volume API and never will: a local volume is a directory on one host's disk. This is the two-pass copy VM live migration uses, run between the two nodes' agents over the stkr overlay with rsync (docs/plans/30-docker-swarm.md, "Moving a volume after the fact"):
- the tile keeps running, rsync each volume across, dirty
- stop the tile, rsync each again: only the delta, so seconds
- flip the home node and start on the target
- leave the source volumes alone, and only now
Step 4's ordering is not optional. Deleting the source before the target is verified and running is how the volume is lost. If anything fails before then, the move aborts with the source volumes untouched and the tile back where it was, which is why every failure path below leaves them alone.
Every volume, not the first one found. A tile can mount several volume subtiles, and a move that carried one of them set the home node anyway; the task came up on the target against an empty directory and swarm called it healthy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Move ¶
type Move struct {
ID string
TileID string
From string // source node ID
To string // target node ID
// Volumes is every volume the tile mounts, not the first one found. A
// tile with two volume subtiles that moved only one of them came up
// healthy on the target reading an empty directory, which is the silent
// loss placement.go opens by warning about.
Volumes []string
Phase Phase
Bytes int64
Total int64
Error string
Started time.Time
}
Move is one volume move in flight.
type Phase ¶
type Phase string
Phase is where a move has got to. The modal renders one line per phase.
type Redeployer ¶
type Redeployer interface {
EnqueueCurrent(ctx context.Context, t *repo.Tile, trigger string) (string, error)
}
Redeployer restarts one tile so it comes up under its new placement. The deploy engine behind an interface, because infra/deploy would otherwise import this package back.
type Service ¶
type Service struct {
Store repo.Store
C *cluster.Cluster // every docker call, and the two agents an rsync runs between
Deploy Redeployer
// Instances starts a managed instance again. It needs its own path: an
// instance is provisioned, never built, so it has no deployment row and
// the deploy engine's EnqueueCurrent answers "" and no error for it. That
// read as success and left a moved postgres scaled to zero, still
// constrained to the node it had just left, while the modal said "Moved".
Instances *managedtiles.Service
// contains filtered or unexported fields
}
Service runs moves and remembers the ones in flight.
In memory on purpose: a panel restart mid-move leaves the source volume intact and the tile where it started, which is the safe end of the failure. Persisting a half-move would mean resuming one, and a resume that guesses wrong deletes a volume.
func New ¶
func New(store repo.Store, c *cluster.Cluster, d Redeployer, inst *managedtiles.Service) *Service
func (*Service) Estimate ¶
Estimate is what the Move modal shows before the operator commits: every volume that is about to move, named and sized from the node holding them, and the total.
Named rather than only totalled, because the operator has to be able to see that a move covers all of them. A single "Volume size" line is what let a half-completed move look correct.
type VolumeSize ¶
VolumeSize is one volume of a move, named and sized, for the modal.