summaryrefslogtreecommitdiffhomepage
path: root/pkg/v1
diff options
context:
space:
mode:
authorLantao Liu <taotaotheripper@gmail.com>2019-03-08 17:53:36 -0800
committerGitHub <noreply@github.com>2019-03-08 17:53:36 -0800
commitb7015c1a46fbea47ad8e7985583b30bd918ddc4b (patch)
tree4d1568f811e5772aa90120d96a0b53cdf85c42c4 /pkg/v1
parent326bc9f3bac1b89414950772ac0cb87619b847d9 (diff)
Put the gvisor user log into sandbox log directory. (#17)
Signed-off-by: Lantao Liu <lantaol@google.com>
Diffstat (limited to 'pkg/v1')
-rw-r--r--pkg/v1/shim/service.go4
-rw-r--r--pkg/v1/utils/utils.go9
2 files changed, 11 insertions, 2 deletions
diff --git a/pkg/v1/shim/service.go b/pkg/v1/shim/service.go
index e23bf957a..083dfa534 100644
--- a/pkg/v1/shim/service.go
+++ b/pkg/v1/shim/service.go
@@ -551,7 +551,7 @@ func newInit(ctx context.Context, path, workDir, runtimeRoot, namespace string,
if err != nil {
return nil, errors.Wrap(err, "read oci spec")
}
- userLog := runsc.FormatLogPath(r.ID, config)
+ runsc.FormatLogPath(r.ID, config)
rootfs := filepath.Join(path, "rootfs")
runtime := proc.NewRunsc(runtimeRoot, path, namespace, r.Runtime, config)
p := proc.New(r.ID, runtime, rproc.Stdio{
@@ -567,7 +567,7 @@ func newInit(ctx context.Context, path, workDir, runtimeRoot, namespace string,
p.IoUID = int(options.IoUid)
p.IoGID = int(options.IoGid)
p.Sandbox = utils.IsSandbox(spec)
- p.UserLog = userLog
+ p.UserLog = utils.UserLogPath(spec)
p.Monitor = shim.Default
return p, nil
}
diff --git a/pkg/v1/utils/utils.go b/pkg/v1/utils/utils.go
index b89edb064..83840c047 100644
--- a/pkg/v1/utils/utils.go
+++ b/pkg/v1/utils/utils.go
@@ -48,3 +48,12 @@ func IsSandbox(spec *specs.Spec) bool {
t, ok := spec.Annotations[annotations.ContainerType]
return !ok || t == annotations.ContainerTypeSandbox
}
+
+// UserLogPath gets user log path from OCI annotation.
+func UserLogPath(spec *specs.Spec) string {
+ sandboxLogDir := spec.Annotations[annotations.SandboxLogDir]
+ if sandboxLogDir == "" {
+ return ""
+ }
+ return filepath.Join(sandboxLogDir, "gvisor.log")
+}