(ctx context.Context, sandboxID string)
| 172 | } |
| 173 | |
| 174 | func (c *controllerLocal) Start(ctx context.Context, sandboxID string) (sandbox.ControllerInstance, error) { |
| 175 | shim, err := c.shims.Get(ctx, sandboxID) |
| 176 | if err != nil { |
| 177 | return sandbox.ControllerInstance{}, fmt.Errorf("unable to find sandbox %q", sandboxID) |
| 178 | } |
| 179 | |
| 180 | svc, err := sandbox.NewClient(shim.Client()) |
| 181 | if err != nil { |
| 182 | return sandbox.ControllerInstance{}, err |
| 183 | } |
| 184 | |
| 185 | resp, err := svc.StartSandbox(ctx, &runtimeAPI.StartSandboxRequest{SandboxID: sandboxID}) |
| 186 | if err != nil { |
| 187 | c.cleanupShim(ctx, sandboxID, svc) |
| 188 | return sandbox.ControllerInstance{}, fmt.Errorf("failed to start sandbox %s: %w", sandboxID, errgrpc.ToNative(err)) |
| 189 | } |
| 190 | address, version := shim.Endpoint() |
| 191 | return sandbox.ControllerInstance{ |
| 192 | SandboxID: sandboxID, |
| 193 | Pid: resp.GetPid(), |
| 194 | Address: address, |
| 195 | Version: uint32(version), |
| 196 | CreatedAt: resp.GetCreatedAt().AsTime(), |
| 197 | Spec: resp.GetSpec(), |
| 198 | }, nil |
| 199 | } |
| 200 | |
| 201 | func (c *controllerLocal) Platform(ctx context.Context, sandboxID string) (imagespec.Platform, error) { |
| 202 | svc, err := c.getSandbox(ctx, sandboxID) |
nothing calls this directly
no test coverage detected