Ask the container what it is running
Preflight's first check ran `--version` on --binary. A container-only host has no such file, so the check failed, and because it is first, nothing downstream ever ran — including every container check that exists to decide whether that container can be migrated at all. The container path was unreachable on exactly the hosts it is for. A host that happens to have a binary is the worse case, not the better one: a stray /usr/local/bin/stalwart from an older install answers confidently with a version nothing is running, and the whole migration plan is derived from that number. The source version now comes from running the image the container is on, by ID rather than by the tag it was started from, using the same command and the same fallback stage already uses for the target image — the two have to agree about what a Stalwart image reports or the source and target could be read by different rules. Verified against a real stalwartlabs/stalwart image, not only the fake. Deployment kind is detected once and shared, rather than asked again by the check that reports it. Two answers for one run is not a thing this should be able to produce. The same reasoning retires preserve-binary on a container: there is nothing on this host to move aside, and the equivalent is already guaranteed, since cutover renames the old container and never prunes the old image. Renaming a stray binary would have preserved something nothing was running.
This commit is contained in:
@@ -292,6 +292,17 @@ func runRun(args []string) (err error) {
|
||||
|
||||
fmt.Println("\n--- preserve the old binary ---")
|
||||
if _, err := store.RunStep(rs, checkpoint.PhaseBackup, "preserve-binary", func() (checkpoint.StepOutcome, error) {
|
||||
// A container has no binary on this host to move aside, and its
|
||||
// equivalent is already guaranteed elsewhere: cutover renames the
|
||||
// old container rather than removing it and never prunes the old
|
||||
// image, which together are what an operator starts again by hand
|
||||
// (§4.5). Renaming a stray /usr/local/bin/stalwart here would
|
||||
// preserve something nothing was running.
|
||||
if isContainer {
|
||||
return checkpoint.StepOutcome{Detail: fmt.Sprintf(
|
||||
"container deployment: nothing to preserve on this host. The old image (%s) is never pruned and the old "+
|
||||
"container is renamed rather than removed at cutover", containerFacts.Image)}, nil
|
||||
}
|
||||
preserved, err := backup.PreserveBinary(*binaryPath, rs.SourceVersion)
|
||||
if err != nil {
|
||||
return checkpoint.StepOutcome{}, err
|
||||
|
||||
Reference in New Issue
Block a user