From 5a688c3e2862be320ad69b1363af3889609b3a35 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Mon, 2 May 2016 13:59:40 -0700 Subject: [PATCH 1/3] Cleanup stdio files upon start and exec termination (ctr). Signed-off-by: Kenfe-Mickael Laventure --- ctr/container.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ctr/container.go b/ctr/container.go index 434baba..a95ceea 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -164,6 +164,11 @@ var startCommand = cli.Command{ fatal(fmt.Sprintf("cannot get the absolute path of the bundle: %v", err), 1) } s, err := createStdio() + defer func() { + if s.stdin != "" { + os.RemoveAll(filepath.Dir(s.stdin)) + } + }() if err != nil { fatal(err.Error(), 1) } @@ -463,6 +468,11 @@ var execCommand = cli.Command{ }, } s, err := createStdio() + defer func() { + if s.stdin != "" { + os.RemoveAll(filepath.Dir(s.stdin)) + } + }() if err != nil { fatal(err.Error(), 1) } From 7279ff91c42d4fcb7460c3fb0dcff0fed1bddc15 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Mon, 2 May 2016 14:01:48 -0700 Subject: [PATCH 2/3] Add missing shim value when saving container state.json (containerd) Signed-off-by: Kenfe-Mickael Laventure --- runtime/container.go | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/container.go b/runtime/container.go index aced304..d2ba13d 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -130,6 +130,7 @@ func New(opts ContainerOpts) (Container, error) { Labels: c.labels, Runtime: c.runtime, RuntimeArgs: c.runtimeArgs, + Shim: c.shim, NoPivotRoot: opts.NoPivotRoot, }); err != nil { return nil, err From 7979ac24fed33d1f8c81a4815bb93f5e75e083ea Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Mon, 2 May 2016 14:03:01 -0700 Subject: [PATCH 3/3] Fix restore to correctly set the exec timeout value (containerd) Signed-off-by: Kenfe-Mickael Laventure --- runtime/container.go | 3 ++- supervisor/supervisor.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/container.go b/runtime/container.go index d2ba13d..23abe09 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -138,7 +138,7 @@ func New(opts ContainerOpts) (Container, error) { return c, nil } -func Load(root, id string) (Container, error) { +func Load(root, id string, timeout time.Duration) (Container, error) { var s state f, err := os.Open(filepath.Join(root, id, StateFile)) if err != nil { @@ -158,6 +158,7 @@ func Load(root, id string) (Container, error) { shim: s.Shim, noPivotRoot: s.NoPivotRoot, processes: make(map[string]*process), + timeout: timeout, } dirs, err := ioutil.ReadDir(filepath.Join(root, id)) if err != nil { diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go index 012eef2..cd3f87c 100644 --- a/supervisor/supervisor.go +++ b/supervisor/supervisor.go @@ -305,7 +305,7 @@ func (s *Supervisor) restore() error { continue } id := d.Name() - container, err := runtime.Load(s.stateDir, id) + container, err := runtime.Load(s.stateDir, id, s.timeout) if err != nil { return err }