| 45 | } |
| 46 | |
| 47 | func (s *remoteSandboxController) Create(ctx context.Context, sandboxInfo sandbox.Sandbox, opts ...sandbox.CreateOpt) error { |
| 48 | var options sandbox.CreateOptions |
| 49 | for _, opt := range opts { |
| 50 | opt(&options) |
| 51 | } |
| 52 | apiSandbox := sandbox.ToProto(&sandboxInfo) |
| 53 | _, err := s.client.Create(ctx, &api.ControllerCreateRequest{ |
| 54 | SandboxID: sandboxInfo.ID, |
| 55 | Rootfs: mount.ToProto(options.Rootfs), |
| 56 | Options: typeurl.MarshalProto(options.Options), |
| 57 | NetnsPath: options.NetNSPath, |
| 58 | Annotations: options.Annotations, |
| 59 | Sandbox: apiSandbox, |
| 60 | Sandboxer: s.sandboxerName, |
| 61 | }) |
| 62 | if err != nil { |
| 63 | return errgrpc.ToNative(err) |
| 64 | } |
| 65 | |
| 66 | return nil |
| 67 | } |
| 68 | |
| 69 | func (s *remoteSandboxController) Start(ctx context.Context, sandboxID string) (sandbox.ControllerInstance, error) { |
| 70 | resp, err := s.client.Start(ctx, &api.ControllerStartRequest{ |