blob: 6b10797ceeb7c1862d17d7cade2cb41ff860271b [file] [log] [blame]
Lorenz Brunc88c82d2020-05-08 14:35:04 +02001Copyright 2020 The Monogon Project Authors.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15
16From 6cbcb8e61b60046e51ff79674b78031707739401 Mon Sep 17 00:00:00 2001
17From: Lorenz Brun <lorenz@brun.one>
18Date: Wed, 6 May 2020 18:52:14 +0200
19Subject: [PATCH] Fix externally-configured non-standard root paths
20
21Going upstream as https://github.com/google/gvisor-containerd-shim/pull/60
22
23---
24 pkg/v2/service.go | 6 ++++--
25 1 file changed, 4 insertions(+), 2 deletions(-)
26
27diff --git a/pkg/v2/service.go b/pkg/v2/service.go
28index c1df4b8..f7f5847 100644
29--- a/pkg/v2/service.go
30+++ b/pkg/v2/service.go
31@@ -103,6 +103,7 @@ type service struct {
32 processes map[string]process.Process
33 events chan interface{}
34 platform stdio.Platform
35+ opts options.Options
36 ec chan proc.Exit
37
38 id string
39@@ -194,7 +195,7 @@ func (s *service) Cleanup(ctx context.Context) (*taskAPI.DeleteResponse, error)
40 if err != nil {
41 return nil, err
42 }
43- r := proc.NewRunsc(proc.RunscRoot, path, ns, runtime, nil)
44+ r := proc.NewRunsc(s.opts.Root, path, ns, runtime, nil)
45 if err := r.Delete(ctx, s.id, &runsc.DeleteOpts{
46 Force: true,
47 }); err != nil {
48@@ -344,6 +345,7 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
49 s.id = r.ID
50 s.bundle = r.Bundle
51 s.task = process
52+ s.opts = opts
53 return &taskAPI.CreateTaskResponse{
54 Pid: uint32(process.Pid()),
55 }, nil
56@@ -577,7 +579,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.
57 if err != nil {
58 return nil, err
59 }
60- rs := proc.NewRunsc(proc.RunscRoot, path, ns, runtime, nil)
61+ rs := proc.NewRunsc(s.opts.Root, path, ns, runtime, nil)
62 stats, err := rs.Stats(ctx, s.id)
63 if err != nil {
64 return nil, err
65--
662.25.1
67