| Copyright 2020 The Monogon Project Authors. |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| |
| From 6cbcb8e61b60046e51ff79674b78031707739401 Mon Sep 17 00:00:00 2001 |
| From: Lorenz Brun <lorenz@brun.one> |
| Date: Wed, 6 May 2020 18:52:14 +0200 |
| Subject: [PATCH] Fix externally-configured non-standard root paths |
| |
| Going upstream as https://github.com/google/gvisor-containerd-shim/pull/60 |
| |
| --- |
| pkg/v2/service.go | 6 ++++-- |
| 1 file changed, 4 insertions(+), 2 deletions(-) |
| |
| diff --git a/pkg/v2/service.go b/pkg/v2/service.go |
| index c1df4b8..f7f5847 100644 |
| --- a/pkg/v2/service.go |
| +++ b/pkg/v2/service.go |
| @@ -103,6 +103,7 @@ type service struct { |
| processes map[string]process.Process |
| events chan interface{} |
| platform stdio.Platform |
| + opts options.Options |
| ec chan proc.Exit |
| |
| id string |
| @@ -194,7 +195,7 @@ func (s *service) Cleanup(ctx context.Context) (*taskAPI.DeleteResponse, error) |
| if err != nil { |
| return nil, err |
| } |
| - r := proc.NewRunsc(proc.RunscRoot, path, ns, runtime, nil) |
| + r := proc.NewRunsc(s.opts.Root, path, ns, runtime, nil) |
| if err := r.Delete(ctx, s.id, &runsc.DeleteOpts{ |
| Force: true, |
| }); err != nil { |
| @@ -344,6 +345,7 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ * |
| s.id = r.ID |
| s.bundle = r.Bundle |
| s.task = process |
| + s.opts = opts |
| return &taskAPI.CreateTaskResponse{ |
| Pid: uint32(process.Pid()), |
| }, nil |
| @@ -577,7 +579,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI. |
| if err != nil { |
| return nil, err |
| } |
| - rs := proc.NewRunsc(proc.RunscRoot, path, ns, runtime, nil) |
| + rs := proc.NewRunsc(s.opts.Root, path, ns, runtime, nil) |
| stats, err := rs.Stats(ctx, s.id) |
| if err != nil { |
| return nil, err |
| -- |
| 2.25.1 |
| |