MCPcopy
hub / github.com/containerd/containerd / SandboxInfo

Function SandboxInfo

integration/main_test.go:822–841  ·  view source on GitHub ↗

SandboxInfo gets sandbox info.

(id string)

Source from the content-addressed store, hash-verified

820
821// SandboxInfo gets sandbox info.
822func SandboxInfo(id string) (*runtime.PodSandboxStatus, *podsandboxtypes.SandboxInfo, error) {
823 client, conn, err := RawRuntimeClient()
824 if err != nil {
825 return nil, nil, fmt.Errorf("failed to get raw runtime client: %w", err)
826 }
827 defer conn.Close()
828 resp, err := client.PodSandboxStatus(context.Background(), &runtime.PodSandboxStatusRequest{
829 PodSandboxId: id,
830 Verbose: true,
831 })
832 if err != nil {
833 return nil, nil, fmt.Errorf("failed to get sandbox status: %w", err)
834 }
835 status := resp.GetStatus()
836 var info podsandboxtypes.SandboxInfo
837 if err := json.Unmarshal([]byte(resp.GetInfo()["info"]), &info); err != nil {
838 return nil, nil, fmt.Errorf("failed to unmarshal sandbox info: %w", err)
839 }
840 return status, &info, nil
841}
842
843func RestartContainerd(t *testing.T, signal syscall.Signal) {
844 require.NoError(t, KillProcess(*containerdBin, signal))

Calls 6

RawRuntimeClientFunction · 0.85
UnmarshalMethod · 0.80
CloseMethod · 0.65
GetStatusMethod · 0.65
PodSandboxStatusMethod · 0.45
GetInfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…