From 9a4e866654e8d579172e9ea0bd1e41e6215b38a4 Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Fri, 26 Mar 2021 15:11:19 -0700 Subject: [PATCH] container: on cleanup, rm container directory for mounts path A wrong path was being used for container directory when virtiofs is utilized. This resulted in a warning message in logs when a container is killed, or completes: level=warning msg="Could not remove container share dir" Without proper removal, they'd later be cleaned up when the shared path is removed as part of stopping the sandbox. Fixes: #1559 Signed-off-by: Eric Ernst --- src/runtime/virtcontainers/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/virtcontainers/container.go b/src/runtime/virtcontainers/container.go index 3ba9435e64..e088a1b772 100644 --- a/src/runtime/virtcontainers/container.go +++ b/src/runtime/virtcontainers/container.go @@ -1047,7 +1047,7 @@ func (c *Container) stop(ctx context.Context, force bool) error { return err } - shareDir := filepath.Join(kataHostSharedDir(), c.sandbox.id, c.id) + shareDir := filepath.Join(getMountPath(c.sandbox.id), c.id) if err := syscall.Rmdir(shareDir); err != nil { c.Logger().WithError(err).WithField("share-dir", shareDir).Warn("Could not remove container share dir") }