MCPcopy
hub / github.com/containerd/containerd / Status

Method Status

plugins/sandbox/controller.go:287–324  ·  view source on GitHub ↗
(ctx context.Context, sandboxID string, verbose bool)

Source from the content-addressed store, hash-verified

285}
286
287func (c *controllerLocal) Status(ctx context.Context, sandboxID string, verbose bool) (sandbox.ControllerStatus, error) {
288 svc, err := c.getSandbox(ctx, sandboxID)
289 if errdefs.IsNotFound(err) {
290 return sandbox.ControllerStatus{
291 SandboxID: sandboxID,
292 ExitedAt: time.Now(),
293 }, nil
294 }
295 if err != nil {
296 return sandbox.ControllerStatus{}, err
297 }
298
299 resp, err := svc.SandboxStatus(ctx, &runtimeAPI.SandboxStatusRequest{
300 SandboxID: sandboxID,
301 Verbose: verbose,
302 })
303 if err != nil {
304 return sandbox.ControllerStatus{}, fmt.Errorf("failed to query sandbox %s status: %w", sandboxID, err)
305 }
306
307 shim, err := c.shims.Get(ctx, sandboxID)
308 if err != nil {
309 return sandbox.ControllerStatus{}, fmt.Errorf("unable to find sandbox %q", sandboxID)
310 }
311 address, version := shim.Endpoint()
312
313 return sandbox.ControllerStatus{
314 SandboxID: resp.GetSandboxID(),
315 Pid: resp.GetPid(),
316 State: resp.GetState(),
317 Info: resp.GetInfo(),
318 CreatedAt: resp.GetCreatedAt().AsTime(),
319 ExitedAt: resp.GetExitedAt().AsTime(),
320 Extra: resp.GetExtra(),
321 Address: address,
322 Version: uint32(version),
323 }, nil
324}
325
326func (c *controllerLocal) Metrics(ctx context.Context, sandboxID string) (*types.Metric, error) {
327 sb, err := c.getSandbox(ctx, sandboxID)

Callers

nothing calls this directly

Calls 11

getSandboxMethod · 0.95
SandboxStatusMethod · 0.65
GetMethod · 0.65
EndpointMethod · 0.65
GetPidMethod · 0.65
GetSandboxIDMethod · 0.45
GetStateMethod · 0.45
GetInfoMethod · 0.45
GetCreatedAtMethod · 0.45
GetExitedAtMethod · 0.45
GetExtraMethod · 0.45

Tested by

no test coverage detected