1
0
mirror of https://github.com/rancher/os.git synced 2025-07-07 11:58:38 +00:00
os/vendor/github.com/docker/containerd/supervisor/create.go
Darren Shepherd a14846152b Update vendor
2016-05-31 18:14:32 -07:00

58 lines
1.2 KiB
Go

package supervisor
import (
"time"
"github.com/docker/containerd/runtime"
)
type StartTask struct {
baseTask
ID string
BundlePath string
Stdout string
Stderr string
Stdin string
StartResponse chan StartResponse
Labels []string
NoPivotRoot bool
Checkpoint *runtime.Checkpoint
}
func (s *Supervisor) start(t *StartTask) error {
start := time.Now()
container, err := runtime.New(runtime.ContainerOpts{
Root: s.stateDir,
ID: t.ID,
Bundle: t.BundlePath,
Runtime: s.runtime,
RuntimeArgs: s.runtimeArgs,
Shim: s.shim,
Labels: t.Labels,
NoPivotRoot: t.NoPivotRoot,
Timeout: s.timeout,
})
if err != nil {
return err
}
s.containers[t.ID] = &containerInfo{
container: container,
}
ContainersCounter.Inc(1)
task := &startTask{
Err: t.ErrorCh(),
Container: container,
StartResponse: t.StartResponse,
Stdin: t.Stdin,
Stdout: t.Stdout,
Stderr: t.Stderr,
}
if t.Checkpoint != nil {
task.Checkpoint = t.Checkpoint.Name
}
s.startTasks <- task
ContainerCreateTimer.UpdateSince(start)
return errDeferredResponse
}