(ctx context.Context, sandboxID string, verbose bool)
| 285 | } |
| 286 | |
| 287 | func (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 | |
| 326 | func (c *controllerLocal) Metrics(ctx context.Context, sandboxID string) (*types.Metric, error) { |
| 327 | sb, err := c.getSandbox(ctx, sandboxID) |
nothing calls this directly
no test coverage detected