From 623b108227f9b7aee48944cb7a9f65d59fcde1b5 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 (cherry picked from commit e38686f74d6d324542b6cddabb6ee50a6ddba211) --- src/runtime/containerd-shim-v2/shim_management.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/runtime/containerd-shim-v2/shim_management.go b/src/runtime/containerd-shim-v2/shim_management.go index c25673459..05b228300 100644 --- a/src/runtime/containerd-shim-v2/shim_management.go +++ b/src/runtime/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")) }