зеркало из https://github.com/microsoft/docker.git
Merge pull request #33826 from Microsoft/jjh/lcownits
LCOW: Fix nits from 33241
This commit is contained in:
Коммит
950d472c9c
|
@ -37,7 +37,7 @@ func (bt *Tagger) TagImages(imageID image.ID) error {
|
|||
for _, rt := range bt.repoAndTags {
|
||||
// TODO @jhowardmsft LCOW support. Will need revisiting.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
if err := bt.imageComponent.TagImageWithReference(imageID, platform, rt); err != nil {
|
||||
|
|
|
@ -101,7 +101,7 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite
|
|||
// }
|
||||
// valid := []string{runtime.GOOS}
|
||||
//
|
||||
// if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
// if system.LCOWSupported() {
|
||||
// valid = append(valid, "linux")
|
||||
// }
|
||||
//
|
||||
|
@ -118,7 +118,7 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite
|
|||
// return err
|
||||
// }
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ func (s *dispatchState) beginStage(stageName string, image builder.Image) {
|
|||
func (s *dispatchState) setDefaultPath() {
|
||||
// TODO @jhowardmsft LCOW Support - This will need revisiting later
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
if system.DefaultPathEnv(platform) == "" {
|
||||
|
|
|
@ -91,8 +91,8 @@ var (
|
|||
// DefaultEscapeToken is the default escape token
|
||||
const DefaultEscapeToken = '\\'
|
||||
|
||||
// DefaultPlatformToken is the platform assumed for the build if not explicitly provided
|
||||
var DefaultPlatformToken = runtime.GOOS
|
||||
// defaultPlatformToken is the platform assumed for the build if not explicitly provided
|
||||
var defaultPlatformToken = runtime.GOOS
|
||||
|
||||
// Directive is the structure used during a build run to hold the state of
|
||||
// parsing directives.
|
||||
|
@ -119,7 +119,7 @@ func (d *Directive) setEscapeToken(s string) error {
|
|||
func (d *Directive) setPlatformToken(s string) error {
|
||||
s = strings.ToLower(s)
|
||||
valid := []string{runtime.GOOS}
|
||||
if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
valid = append(valid, "linux")
|
||||
}
|
||||
for _, item := range valid {
|
||||
|
@ -154,7 +154,7 @@ func (d *Directive) possibleParserDirective(line string) error {
|
|||
|
||||
// TODO @jhowardmsft LCOW Support: Eventually this check can be removed,
|
||||
// but only recognise a platform token if running in LCOW mode.
|
||||
if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
tpcMatch := tokenPlatformCommand.FindStringSubmatch(strings.ToLower(line))
|
||||
if len(tpcMatch) != 0 {
|
||||
for i, n := range tokenPlatformCommand.SubexpNames() {
|
||||
|
@ -177,7 +177,7 @@ func (d *Directive) possibleParserDirective(line string) error {
|
|||
func NewDefaultDirective() *Directive {
|
||||
directive := Directive{}
|
||||
directive.setEscapeToken(string(DefaultEscapeToken))
|
||||
directive.setPlatformToken(runtime.GOOS)
|
||||
directive.setPlatformToken(defaultPlatformToken)
|
||||
return &directive
|
||||
}
|
||||
|
||||
|
|
|
@ -1038,7 +1038,7 @@ func (container *Container) CreateDaemonEnvironment(tty bool, linkedEnv []string
|
|||
platform = runtime.GOOS
|
||||
}
|
||||
env := []string{}
|
||||
if runtime.GOOS != "windows" || (runtime.GOOS == "windows" && system.LCOWSupported() && platform == "linux") {
|
||||
if runtime.GOOS != "windows" || (system.LCOWSupported() && platform == "linux") {
|
||||
env = []string{
|
||||
"PATH=" + system.DefaultPathEnv(platform),
|
||||
"HOSTNAME=" + container.Config.Hostname,
|
||||
|
@ -1052,7 +1052,6 @@ func (container *Container) CreateDaemonEnvironment(tty bool, linkedEnv []string
|
|||
// because the env on the container can override certain default values
|
||||
// we need to replace the 'env' keys where they match and append anything
|
||||
// else.
|
||||
//return ReplaceOrAppendEnvValues(linkedEnv, container.Config.Env)
|
||||
foo := ReplaceOrAppendEnvValues(env, container.Config.Env)
|
||||
return foo
|
||||
env = ReplaceOrAppendEnvValues(env, container.Config.Env)
|
||||
return env
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ func (c *containerAdapter) pullImage(ctx context.Context) error {
|
|||
// TODO @jhowardmsft LCOW Support: This will need revisiting as
|
||||
// the stack is built up to include LCOW support for swarm.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
err := c.backend.PullImage(ctx, c.container.image(), "", platform, metaHeaders, authConfig, pw)
|
||||
|
|
|
@ -82,7 +82,7 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) (
|
|||
if params.Platform == "" {
|
||||
params.Platform = runtime.GOOS
|
||||
}
|
||||
if params.Platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
params.Platform = "linux"
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) (
|
|||
if img != nil {
|
||||
if params.Platform != img.Platform() {
|
||||
// Ignore this in LCOW mode. @jhowardmsft TODO - This will need revisiting later.
|
||||
if !(runtime.GOOS == "windows" && system.LCOWSupported()) {
|
||||
if !system.LCOWSupported() {
|
||||
return nil, fmt.Errorf("cannot create a %s container from a %s image", params.Platform, img.Platform())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ func (d *Driver) terminateUvm(context string) error {
|
|||
|
||||
// FIXME: @jhowardmsft
|
||||
// This isn't thread-safe yet, but will change anyway with the lifetime
|
||||
// changes and multiple instances. Defering that work for now.
|
||||
// changes and multiple instances. Deferring that work for now.
|
||||
uvm := d.config.Uvm
|
||||
d.config.Uvm = nil
|
||||
|
||||
|
@ -190,7 +190,6 @@ func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
|||
// Make sure layers are created with the correct ACL so that VMs can access them.
|
||||
layerPath := d.dir(id)
|
||||
logrus.Debugf("lcowdriver: create: id %s: creating layerPath %s", id, layerPath)
|
||||
// Make sure the layers are created with the correct ACL so that VMs can access them.
|
||||
if err := system.MkdirAllWithACL(layerPath, 755, system.SddlNtvmAdministratorsLocalSystem); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ func (d *Driver) Status() [][2]string {
|
|||
}
|
||||
|
||||
// panicIfUsedByLcow does exactly what it says.
|
||||
// TODO @jhowardmsft - this is an temporary measure for the bring-up of
|
||||
// TODO @jhowardmsft - this is a temporary measure for the bring-up of
|
||||
// Linux containers on Windows. It is a failsafe to ensure that the right
|
||||
// graphdriver is used.
|
||||
func panicIfUsedByLcow() {
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
||||
// TODO @jhowardmsft LCOW. This will need revisiting later.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
imageExporter := tarexport.NewTarExporter(daemon.stores[platform].imageStore, daemon.stores[platform].layerStore, daemon.stores[platform].referenceStore, daemon)
|
||||
|
@ -29,7 +29,7 @@ func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
|||
func (daemon *Daemon) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
|
||||
// TODO @jhowardmsft LCOW. This will need revisiting later.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
imageExporter := tarexport.NewTarExporter(daemon.stores[platform].imageStore, daemon.stores[platform].layerStore, daemon.stores[platform].referenceStore, daemon)
|
||||
|
|
|
@ -43,7 +43,7 @@ func (daemon *Daemon) PushImage(ctx context.Context, image, tag string, metaHead
|
|||
|
||||
// TODO @jhowardmsft LCOW Support. This will require revisiting. For now, hard-code.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
|
|||
func (daemon *Daemon) Map() map[image.ID]*image.Image {
|
||||
// TODO @jhowardmsft LCOW. This will need work to enumerate the stores for all platforms.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
return daemon.stores[platform].imageStore.Map()
|
||||
|
@ -53,7 +53,7 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs
|
|||
|
||||
// TODO @jhowardmsft LCOW. This will need work to enumerate the stores for all platforms.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|||
|
||||
// TODO @jhowardmsft LCOW support. For now, hard-code the platform shown for the driver status
|
||||
p := runtime.GOOS
|
||||
if p == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
p = "linux"
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ func (daemon *Daemon) VolumesPrune(ctx context.Context, pruneFilters filters.Arg
|
|||
func (daemon *Daemon) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) {
|
||||
// TODO @jhowardmsft LCOW Support: This will need revisiting later.
|
||||
platform := runtime.GOOS
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Named, unverif
|
|||
// the history does, but unfortunately that's a string, so search through
|
||||
// all the history until hopefully we find one which indicates the os.
|
||||
platform := runtime.GOOS
|
||||
if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
type config struct {
|
||||
Os string `json:"os,omitempty"`
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package image
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -119,8 +118,9 @@ func (is *store) Create(config []byte) (ID, error) {
|
|||
return "", err
|
||||
}
|
||||
|
||||
// TODO @jhowardmsft - LCOW Support. This will need revisiting.
|
||||
// Integrity check - ensure we are creating something for the correct platform
|
||||
if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
if strings.ToLower(img.Platform()) != strings.ToLower(is.platform) {
|
||||
return "", fmt.Errorf("cannot create entry for platform %q in image store for platform %q", img.Platform(), is.platform)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
|
@ -273,7 +272,7 @@ func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, platf
|
|||
var p *roLayer
|
||||
|
||||
// Integrity check - ensure we are creating something for the correct platform
|
||||
if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
if strings.ToLower(ls.platform) != strings.ToLower(string(platform)) {
|
||||
return nil, fmt.Errorf("cannot create entry for platform %q in layer store for platform %q", platform, ls.platform)
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ func isEqualPrivilege(a, b types.PluginPrivilege) bool {
|
|||
func configToRootFS(c []byte) (*image.RootFS, layer.Platform, error) {
|
||||
// TODO @jhowardmsft LCOW - Will need to revisit this. For now, calculate the platform.
|
||||
platform := layer.Platform(runtime.GOOS)
|
||||
if platform == "windows" && system.LCOWSupported() {
|
||||
if system.LCOWSupported() {
|
||||
platform = "linux"
|
||||
}
|
||||
var pluginConfig types.PluginConfig
|
||||
|
|
Загрузка…
Ссылка в новой задаче