From f42c762dc4303f3164bc681e2fa811d300beb564 Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Thu, 25 May 2017 12:15:00 -0400 Subject: [PATCH] updates the execution service to include ContainerID in tasks Signed-off-by: Evan Hazlett --- cmd/ctr/run.go | 2 +- cmd/ctr/run_unix.go | 5 +++-- cmd/ctr/run_windows.go | 5 +++-- linux/task.go | 1 + services/execution/service.go | 7 ++++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index f47317001..c782c8864 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -241,7 +241,7 @@ var runCommand = cli.Command{ } } - createContainer, err := newCreateContainerRequest(context, id, id, spec) + createContainer, err := newCreateContainerRequest(context, id, id, ref, spec) if err != nil { return err } diff --git a/cmd/ctr/run_unix.go b/cmd/ctr/run_unix.go index 23f5c8712..448770c35 100644 --- a/cmd/ctr/run_unix.go +++ b/cmd/ctr/run_unix.go @@ -282,10 +282,11 @@ func newContainerSpec(context *cli.Context, config *ocispec.ImageConfig, imageRe return json.Marshal(s) } -func newCreateContainerRequest(context *cli.Context, id, snapshot string, spec []byte) (*containersapi.CreateContainerRequest, error) { +func newCreateContainerRequest(context *cli.Context, id, snapshot, image string, spec []byte) (*containersapi.CreateContainerRequest, error) { create := &containersapi.CreateContainerRequest{ Container: containersapi.Container{ - ID: id, + ID: id, + Image: image, Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: spec, diff --git a/cmd/ctr/run_windows.go b/cmd/ctr/run_windows.go index 411209348..7e08c1b9d 100644 --- a/cmd/ctr/run_windows.go +++ b/cmd/ctr/run_windows.go @@ -139,10 +139,11 @@ func newContainerSpec(context *cli.Context, config *ocispec.ImageConfig, imageRe return json.Marshal(rtSpec) } -func newCreateContainerRequest(context *cli.Context, id, snapshot string, spec []byte) (*containersapi.CreateContainerRequest, error) { +func newCreateContainerRequest(context *cli.Context, id, snapshot, image string, spec []byte) (*containersapi.CreateContainerRequest, error) { create := &containersapi.CreateContainerRequest{ Container: containersapi.Container{ - ID: id, + ID: id, + Image: image, Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: spec, diff --git a/linux/task.go b/linux/task.go index bced436e5..da761abc9 100644 --- a/linux/task.go +++ b/linux/task.go @@ -41,6 +41,7 @@ func newTask(id string, spec []byte, shim shim.ShimClient) *Task { func (c *Task) Info() plugin.TaskInfo { return plugin.TaskInfo{ + ID: c.containerID, ContainerID: c.containerID, Runtime: runtimeName, Spec: c.spec, diff --git a/services/execution/service.go b/services/execution/service.go index 4a4483501..c4db8efee 100644 --- a/services/execution/service.go +++ b/services/execution/service.go @@ -220,9 +220,10 @@ func taskFromContainerd(ctx context.Context, c plugin.Task) (*task.Task, error) log.G(ctx).WithField("status", state.Status()).Warn("unknown status") } return &task.Task{ - ID: c.Info().ID, - Pid: state.Pid(), - Status: status, + ID: c.Info().ID, + ContainerID: c.Info().ContainerID, + Pid: state.Pid(), + Status: status, Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: c.Info().Spec,