mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 20:54:26 +00:00
kata-runtime: add rust runtime path for kata-runtime exec
add rust runtime path for kata-runtime exec Fixes:#5963 Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
parent
1511587a9a
commit
dae6670628
@ -14,6 +14,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -306,8 +307,19 @@ func GetSandboxesStoragePath() string {
|
|||||||
return "/run/vc/sbs"
|
return "/run/vc/sbs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSandboxesStoragePath returns the storage path where sandboxes info are stored in runtime-rs
|
||||||
|
func GetSandboxesStoragePathRust() string {
|
||||||
|
return "/run/kata"
|
||||||
|
}
|
||||||
|
|
||||||
// SocketAddress returns the address of the unix domain socket for communicating with the
|
// SocketAddress returns the address of the unix domain socket for communicating with the
|
||||||
// shim management endpoint
|
// shim management endpoint
|
||||||
func SocketAddress(id string) string {
|
func SocketAddress(id string) string {
|
||||||
return fmt.Sprintf("unix://%s", filepath.Join(string(filepath.Separator), GetSandboxesStoragePath(), id, "shim-monitor.sock"))
|
socketAddress := fmt.Sprintf("unix://%s", filepath.Join(string(filepath.Separator), GetSandboxesStoragePath(), id, "shim-monitor.sock"))
|
||||||
|
_, err := os.Stat(socketAddress)
|
||||||
|
// if the path not exist, check the rust runtime path
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Sprintf("unix://%s", filepath.Join(string(filepath.Separator), GetSandboxesStoragePathRust(), id, "shim-monitor.sock"))
|
||||||
|
}
|
||||||
|
return socketAddress
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user