From e38686f74d6d324542b6cddabb6ee50a6ddba211 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Tue, 14 Sep 2021 16:29:09 +0200 Subject: [PATCH] runtime: add GetSandboxesStoragePath() The storage path we use to collect the sandbox files is defined in the virtcontainers/persist/fs package. We create the runtime socket in that storage path, by hardcoding the full path in the SocketAddress() function in the runtime package. This commit splits the hardcoded path by the socket address path so that the runtime package will be able to provide the storage path to all the components that may need it. Signed-off-by: Francesco Giudici --- src/runtime/pkg/containerd-shim-v2/shim_management.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/runtime/pkg/containerd-shim-v2/shim_management.go b/src/runtime/pkg/containerd-shim-v2/shim_management.go index c25673459f..05b2283005 100644 --- a/src/runtime/pkg/containerd-shim-v2/shim_management.go +++ b/src/runtime/pkg/containerd-shim-v2/shim_management.go @@ -183,8 +183,13 @@ func (s *service) mountPprofHandle(m *http.ServeMux, ociSpec *specs.Spec) { m.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace)) } -// SocketAddress returns the address of the abstract domain socket for communicating with the +// GetSandboxesStoragePath returns the storage path where sandboxes info are stored +func GetSanboxesStoragePath() string { + return filepath.Join(string(filepath.Separator), "run", "vc", "sbs") +} + +// SocketAddress returns the address of the unix domain socket for communicating with the // shim management endpoint func SocketAddress(id string) string { - return fmt.Sprintf("unix://%s", filepath.Join(string(filepath.Separator), "run", "vc", "sbs", id, "shim-monitor.sock")) + return fmt.Sprintf("unix://%s", filepath.Join(string(filepath.Separator), GetSanboxesStoragePath(), id, "shim-monitor.sock")) }