1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

libcontainerd/local: remove LCOW bits

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-03-19 15:03:22 +01:00
parent 12f1b3ce43
commit c33b9bcfd4
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -5,7 +5,6 @@ package local // import "github.com/docker/docker/libcontainerd/local"
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"os"
@ -47,7 +46,6 @@ type container struct {
// have access to the Spec
ociSpec *specs.Spec
isWindows bool
hcsContainer hcsshim.Container
id string
@ -334,7 +332,6 @@ func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions inter
ctr := &container{
id: id,
execs: make(map[string]*process),
isWindows: true,
ociSpec: spec,
hcsContainer: hcsContainer,
status: containerd.Created,
@ -435,24 +432,11 @@ func (c *client) Start(_ context.Context, id, _ string, withStdin bool, attachSt
createProcessParms.Environment = setupEnvironmentVariables(ctr.ociSpec.Process.Env)
// Configure the CommandLine/CommandArgs
setCommandLineAndArgs(ctr.isWindows, ctr.ociSpec.Process, createProcessParms)
if ctr.isWindows {
setCommandLineAndArgs(ctr.ociSpec.Process, createProcessParms)
logger.Debugf("start commandLine: %s", createProcessParms.CommandLine)
}
createProcessParms.User = ctr.ociSpec.Process.User.Username
// LCOW requires the raw OCI spec passed through HCS and onwards to
// GCS for the utility VM.
if !ctr.isWindows {
ociBuf, err := json.Marshal(ctr.ociSpec)
if err != nil {
return -1, err
}
ociRaw := json.RawMessage(ociBuf)
createProcessParms.OCISpecification = &ociRaw
}
ctr.Lock()
// Start the command running in the container.
@ -546,16 +530,12 @@ func (c *client) Start(_ context.Context, id, _ string, withStdin bool, attachSt
}
// setCommandLineAndArgs configures the HCS ProcessConfig based on an OCI process spec
func setCommandLineAndArgs(isWindows bool, process *specs.Process, createProcessParms *hcsshim.ProcessConfig) {
if isWindows {
func setCommandLineAndArgs(process *specs.Process, createProcessParms *hcsshim.ProcessConfig) {
if process.CommandLine != "" {
createProcessParms.CommandLine = process.CommandLine
} else {
createProcessParms.CommandLine = system.EscapeArgs(process.Args)
}
} else {
createProcessParms.CommandArgs = process.Args
}
}
func newIOFromProcess(newProcess hcsshim.Process, terminal bool) (*cio.DirectIO, error) {
@ -622,7 +602,7 @@ func (c *client) Exec(ctx context.Context, containerID, processID string, spec *
createProcessParms.Environment = setupEnvironmentVariables(spec.Env)
// Configure the CommandLine/CommandArgs
setCommandLineAndArgs(ctr.isWindows, spec, createProcessParms)
setCommandLineAndArgs(spec, createProcessParms)
logger.Debugf("exec commandLine: %s", createProcessParms.CommandLine)
createProcessParms.User = spec.User.Username