From f97fbba5cec3d27099e230f7c1dc278c54180d74 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 16 May 2017 14:19:19 -0700 Subject: [PATCH] LCOW: Add platform to container, init on FromDisk() Signed-off-by: John Howard --- container/container.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/container/container.go b/container/container.go index 02bfea59e2..4d99362311 100644 --- a/container/container.go +++ b/container/container.go @@ -7,6 +7,7 @@ import ( "net" "os" "path/filepath" + "runtime" "strconv" "strings" "sync" @@ -77,6 +78,7 @@ type Container struct { LogPath string Name string Driver string + Platform string // MountLabel contains the options for the 'mount' command MountLabel string ProcessLabel string @@ -142,6 +144,13 @@ func (container *Container) FromDisk() error { return err } + // Ensure the platform is set if blank. Assume it is the platform of the + // host OS if not, to ensure containers created before multiple-platform + // support are migrated + if container.Platform == "" { + container.Platform = runtime.GOOS + } + if err := label.ReserveLabel(container.ProcessLabel); err != nil { return err }