Add create/start to exec processes in shim

This splits up the create and start of an exec process in the shim to
have two separate steps like the initial process.  This will allow
better state reporting for individual process along with a more robust
wait for execs.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-07-31 11:26:21 -04:00
parent 2533bfeaaf
commit 63878d14ea
11 changed files with 749 additions and 249 deletions

View File

@ -39,6 +39,7 @@
TaskExit TaskExit
TaskOOM TaskOOM
TaskExecAdded TaskExecAdded
TaskExecStarted
TaskPaused TaskPaused
TaskResumed TaskResumed
TaskCheckpointed TaskCheckpointed

View File

@ -94,20 +94,29 @@ func (*TaskOOM) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{
type TaskExecAdded struct { type TaskExecAdded struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
} }
func (m *TaskExecAdded) Reset() { *m = TaskExecAdded{} } func (m *TaskExecAdded) Reset() { *m = TaskExecAdded{} }
func (*TaskExecAdded) ProtoMessage() {} func (*TaskExecAdded) ProtoMessage() {}
func (*TaskExecAdded) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{6} } func (*TaskExecAdded) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{6} }
type TaskExecStarted struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
}
func (m *TaskExecStarted) Reset() { *m = TaskExecStarted{} }
func (*TaskExecStarted) ProtoMessage() {}
func (*TaskExecStarted) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{7} }
type TaskPaused struct { type TaskPaused struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
} }
func (m *TaskPaused) Reset() { *m = TaskPaused{} } func (m *TaskPaused) Reset() { *m = TaskPaused{} }
func (*TaskPaused) ProtoMessage() {} func (*TaskPaused) ProtoMessage() {}
func (*TaskPaused) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{7} } func (*TaskPaused) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{8} }
type TaskResumed struct { type TaskResumed struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -115,7 +124,7 @@ type TaskResumed struct {
func (m *TaskResumed) Reset() { *m = TaskResumed{} } func (m *TaskResumed) Reset() { *m = TaskResumed{} }
func (*TaskResumed) ProtoMessage() {} func (*TaskResumed) ProtoMessage() {}
func (*TaskResumed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{8} } func (*TaskResumed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{9} }
type TaskCheckpointed struct { type TaskCheckpointed struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -124,7 +133,7 @@ type TaskCheckpointed struct {
func (m *TaskCheckpointed) Reset() { *m = TaskCheckpointed{} } func (m *TaskCheckpointed) Reset() { *m = TaskCheckpointed{} }
func (*TaskCheckpointed) ProtoMessage() {} func (*TaskCheckpointed) ProtoMessage() {}
func (*TaskCheckpointed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{9} } func (*TaskCheckpointed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{10} }
func init() { func init() {
proto.RegisterType((*TaskCreate)(nil), "containerd.services.events.v1.TaskCreate") proto.RegisterType((*TaskCreate)(nil), "containerd.services.events.v1.TaskCreate")
@ -134,6 +143,7 @@ func init() {
proto.RegisterType((*TaskExit)(nil), "containerd.services.events.v1.TaskExit") proto.RegisterType((*TaskExit)(nil), "containerd.services.events.v1.TaskExit")
proto.RegisterType((*TaskOOM)(nil), "containerd.services.events.v1.TaskOOM") proto.RegisterType((*TaskOOM)(nil), "containerd.services.events.v1.TaskOOM")
proto.RegisterType((*TaskExecAdded)(nil), "containerd.services.events.v1.TaskExecAdded") proto.RegisterType((*TaskExecAdded)(nil), "containerd.services.events.v1.TaskExecAdded")
proto.RegisterType((*TaskExecStarted)(nil), "containerd.services.events.v1.TaskExecStarted")
proto.RegisterType((*TaskPaused)(nil), "containerd.services.events.v1.TaskPaused") proto.RegisterType((*TaskPaused)(nil), "containerd.services.events.v1.TaskPaused")
proto.RegisterType((*TaskResumed)(nil), "containerd.services.events.v1.TaskResumed") proto.RegisterType((*TaskResumed)(nil), "containerd.services.events.v1.TaskResumed")
proto.RegisterType((*TaskCheckpointed)(nil), "containerd.services.events.v1.TaskCheckpointed") proto.RegisterType((*TaskCheckpointed)(nil), "containerd.services.events.v1.TaskCheckpointed")
@ -263,6 +273,22 @@ func (m *TaskExecAdded) Field(fieldpath []string) (string, bool) {
return "", false return "", false
} }
switch fieldpath[0] {
case "container_id":
return string(m.ContainerID), len(m.ContainerID) > 0
case "exec_id":
return string(m.ExecID), len(m.ExecID) > 0
}
return "", false
}
// Field returns the value for the given fieldpath as a string, if defined.
// If the value is not defined, the second value will be false.
func (m *TaskExecStarted) Field(fieldpath []string) (string, bool) {
if len(fieldpath) == 0 {
return "", false
}
switch fieldpath[0] { switch fieldpath[0] {
// unhandled: pid // unhandled: pid
case "container_id": case "container_id":
@ -579,6 +605,36 @@ func (m *TaskExecAdded) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskExecAdded) MarshalTo(dAtA []byte) (int, error) { func (m *TaskExecAdded) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.ContainerID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
}
if len(m.ExecID) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ExecID)))
i += copy(dAtA[i:], m.ExecID)
}
return i, nil
}
func (m *TaskExecStarted) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *TaskExecStarted) MarshalTo(dAtA []byte) (int, error) {
var i int var i int
_ = i _ = i
var l int var l int
@ -824,6 +880,20 @@ func (m *TaskOOM) Size() (n int) {
} }
func (m *TaskExecAdded) Size() (n int) { func (m *TaskExecAdded) Size() (n int) {
var l int
_ = l
l = len(m.ContainerID)
if l > 0 {
n += 1 + l + sovTask(uint64(l))
}
l = len(m.ExecID)
if l > 0 {
n += 1 + l + sovTask(uint64(l))
}
return n
}
func (m *TaskExecStarted) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ContainerID) l = len(m.ContainerID)
@ -968,6 +1038,17 @@ func (this *TaskExecAdded) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&TaskExecAdded{`, s := strings.Join([]string{`&TaskExecAdded{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`}`,
}, "")
return s
}
func (this *TaskExecStarted) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&TaskExecStarted{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
@ -1920,6 +2001,114 @@ func (m *TaskExecAdded) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: TaskExecAdded: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: TaskExecAdded: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTask
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTask
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTask
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTask
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ExecID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTask(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTask
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *TaskExecStarted) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTask
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: TaskExecStarted: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TaskExecStarted: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType)
@ -2394,45 +2583,46 @@ func init() {
} }
var fileDescriptorTask = []byte{ var fileDescriptorTask = []byte{
// 634 bytes of a gzipped FileDescriptorProto // 648 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xcd, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xc1, 0x6e, 0xd3, 0x40,
0x10, 0xc7, 0x6b, 0xa7, 0x75, 0x93, 0x0d, 0x15, 0x95, 0x55, 0x41, 0x14, 0x09, 0x3b, 0x32, 0x42, 0x10, 0x86, 0x6b, 0xa7, 0x75, 0x93, 0x0d, 0x55, 0x2b, 0xab, 0x82, 0x28, 0x12, 0x76, 0x64, 0x84,
0xca, 0xc9, 0x56, 0x8b, 0xc4, 0x05, 0x15, 0x35, 0x69, 0x38, 0xe4, 0x50,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xeb, 0x63, 0xa3, 0xfe,
0x33, 0x94, 0x8b, 0xcc, 0x50, 0x3e, 0x65, 0x86, 0xf2, 0x35, 0x33, 0x94, 0xf7, 0xdf, 0x0c, 0xe5, 0xfe, 0xd8, 0x74, 0x5f, 0x5d, 0x5c, 0x1a, 0x6b, 0x5f, 0x2e, 0x8d, 0xb5, 0x77, 0xa9, 0xa1, 0x5c,
0xc5, 0x93, 0x8a, 0xff, 0x0e, 0x8f, 0xa5, 0x35, 0xd1, 0xf2, 0x6d, 0x79, 0xf8, 0x23, 0x00, 0x00, 0xa4, 0x86, 0xf2, 0x39, 0x35, 0x94, 0x6f, 0xa9, 0xa1, 0x7c, 0xf8, 0x6e, 0x28, 0x2f, 0x9f, 0x96,
0xff, 0xff, 0xfd, 0xdf, 0x0f, 0x7f, 0x66, 0x06, 0x00, 0x00, 0xfc, 0x27, 0x7a, 0x22, 0x4f, 0x23, 0x2d, 0xdb, 0xcc, 0x47, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff,
0x76, 0xdf, 0xe7, 0xaa, 0xd2, 0x06, 0x00, 0x00,
} }

View File

@ -53,6 +53,11 @@ message TaskOOM {
message TaskExecAdded { message TaskExecAdded {
string container_id = 1; string container_id = 1;
string exec_id = 2; string exec_id = 2;
}
message TaskExecStarted {
string container_id = 1;
string exec_id = 2;
uint32 pid = 3; uint32 pid = 3;
} }

View File

@ -149,7 +149,9 @@ var shimStartCommand = cli.Command{
if err != nil { if err != nil {
return err return err
} }
_, err = service.Start(gocontext.Background(), empty) _, err = service.Start(gocontext.Background(), &shim.StartRequest{
ID: context.Args().First(),
})
return err return err
}, },
} }
@ -261,7 +263,12 @@ var shimExecCommand = cli.Command{
Stderr: context.String("stderr"), Stderr: context.String("stderr"),
Terminal: tty, Terminal: tty,
} }
r, err := service.Exec(ctx, rq) if _, err := service.Exec(ctx, rq); err != nil {
return err
}
r, err := service.Start(ctx, &shim.StartRequest{
ID: id,
})
if err != nil { if err != nil {
return err return err
} }

View File

@ -36,6 +36,8 @@ type execProcess struct {
closers []io.Closer closers []io.Closer
stdin io.Closer stdin io.Closer
stdio stdio stdio stdio
path string
spec specs.Process
parent *initProcess parent *initProcess
} }
@ -44,43 +46,6 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecProcess
if err := identifiers.Validate(id); err != nil { if err := identifiers.Validate(id); err != nil {
return nil, errors.Wrapf(err, "invalid exec id") return nil, errors.Wrapf(err, "invalid exec id")
} }
e := &execProcess{
id: id,
parent: parent,
stdio: stdio{
stdin: r.Stdin,
stdout: r.Stdout,
stderr: r.Stderr,
terminal: r.Terminal,
},
}
var (
err error
socket *runc.Socket
io runc.IO
pidfile = filepath.Join(path, fmt.Sprintf("%s.pid", id))
)
if r.Terminal {
if socket, err = runc.NewConsoleSocket(filepath.Join(path, "pty.sock")); err != nil {
return nil, errors.Wrap(err, "failed to create runc console socket")
}
defer os.Remove(socket.Path())
} else {
// TODO: get uid/gid
if io, err = runc.NewPipeIO(0, 0); err != nil {
return nil, errors.Wrap(err, "failed to create runc io pipes")
}
e.io = io
}
opts := &runc.ExecOpts{
PidFile: pidfile,
IO: io,
Detach: true,
}
if socket != nil {
opts.ConsoleSocket = socket
}
// process exec request // process exec request
var spec specs.Process var spec specs.Process
if err := json.Unmarshal(r.Spec.Value, &spec); err != nil { if err := json.Unmarshal(r.Spec.Value, &spec); err != nil {
@ -88,39 +53,18 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecProcess
} }
spec.Terminal = r.Terminal spec.Terminal = r.Terminal
if err := parent.runtime.Exec(context, parent.id, spec, opts); err != nil { e := &execProcess{
return nil, parent.runtimeError(err, "OCI runtime exec failed") id: id,
path: path,
parent: parent,
spec: spec,
stdio: stdio{
stdin: r.Stdin,
stdout: r.Stdout,
stderr: r.Stderr,
terminal: r.Terminal,
},
} }
if r.Stdin != "" {
sc, err := fifo.OpenFifo(context, r.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0)
if err != nil {
return nil, errors.Wrapf(err, "failed to open stdin fifo %s", r.Stdin)
}
e.closers = append(e.closers, sc)
e.stdin = sc
}
var copyWaitGroup sync.WaitGroup
if socket != nil {
console, err := socket.ReceiveMaster()
if err != nil {
return nil, errors.Wrap(err, "failed to retrieve console master")
}
console, err = e.parent.platform.copyConsole(context, console, r.Stdin, r.Stdout, r.Stderr, &e.WaitGroup, &copyWaitGroup)
if err != nil {
return nil, errors.Wrap(err, "failed to start console copy")
}
e.console = console
} else {
if err := copyPipes(context, io, r.Stdin, r.Stdout, r.Stderr, &e.WaitGroup, &copyWaitGroup); err != nil {
return nil, errors.Wrap(err, "failed to start io pipe copy")
}
}
copyWaitGroup.Wait()
pid, err := runc.ReadPidFile(opts.PidFile)
if err != nil {
return nil, errors.Wrap(err, "failed to retrieve OCI runtime exec pid")
}
e.pid = pid
return e, nil return e, nil
} }
@ -178,3 +122,63 @@ func (e *execProcess) Stdin() io.Closer {
func (e *execProcess) Stdio() stdio { func (e *execProcess) Stdio() stdio {
return e.stdio return e.stdio
} }
func (e *execProcess) Start(ctx context.Context) (err error) {
var (
socket *runc.Socket
io runc.IO
pidfile = filepath.Join(e.path, fmt.Sprintf("%s.pid", e.id))
)
if e.stdio.terminal {
if socket, err = runc.NewConsoleSocket(filepath.Join(e.path, "pty.sock")); err != nil {
return errors.Wrap(err, "failed to create runc console socket")
}
defer os.Remove(socket.Path())
} else {
if io, err = runc.NewPipeIO(0, 0); err != nil {
return errors.Wrap(err, "failed to create runc io pipes")
}
e.io = io
}
opts := &runc.ExecOpts{
PidFile: pidfile,
IO: io,
Detach: true,
}
if socket != nil {
opts.ConsoleSocket = socket
}
if err := e.parent.runtime.Exec(ctx, e.parent.id, e.spec, opts); err != nil {
return e.parent.runtimeError(err, "OCI runtime exec failed")
}
if e.stdio.stdin != "" {
sc, err := fifo.OpenFifo(ctx, e.stdio.stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0)
if err != nil {
return errors.Wrapf(err, "failed to open stdin fifo %s", e.stdio.stdin)
}
e.closers = append(e.closers, sc)
e.stdin = sc
}
var copyWaitGroup sync.WaitGroup
if socket != nil {
console, err := socket.ReceiveMaster()
if err != nil {
return errors.Wrap(err, "failed to retrieve console master")
}
e.console = console
if err := e.parent.platform.copyConsole(ctx, console, e.stdio.stdin, e.stdio.stdout, e.stdio.stderr, &e.WaitGroup, &copyWaitGroup); err != nil {
return errors.Wrap(err, "failed to start console copy")
}
} else {
if err := copyPipes(ctx, io, e.stdio.stdin, e.stdio.stdout, e.stdio.stderr, &e.WaitGroup, &copyWaitGroup); err != nil {
return errors.Wrap(err, "failed to start io pipe copy")
}
}
copyWaitGroup.Wait()
pid, err := runc.ReadPidFile(opts.PidFile)
if err != nil {
return errors.Wrap(err, "failed to retrieve OCI runtime exec pid")
}
e.pid = pid
return nil
}

View File

@ -27,7 +27,7 @@ func (c *local) Create(ctx context.Context, in *shimapi.CreateTaskRequest, opts
return c.s.Create(ctx, in) return c.s.Create(ctx, in)
} }
func (c *local) Start(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { func (c *local) Start(ctx context.Context, in *shimapi.StartRequest, opts ...grpc.CallOption) (*shimapi.StartResponse, error) {
return c.s.Start(ctx, in) return c.s.Start(ctx, in)
} }
@ -43,7 +43,7 @@ func (c *local) DeleteProcess(ctx context.Context, in *shimapi.DeleteProcessRequ
return c.s.DeleteProcess(ctx, in) return c.s.DeleteProcess(ctx, in)
} }
func (c *local) Exec(ctx context.Context, in *shimapi.ExecProcessRequest, opts ...grpc.CallOption) (*shimapi.ExecProcessResponse, error) { func (c *local) Exec(ctx context.Context, in *shimapi.ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
return c.s.Exec(ctx, in) return c.s.Exec(ctx, in)
} }

View File

@ -38,4 +38,6 @@ type process interface {
Kill(context.Context, uint32, bool) error Kill(context.Context, uint32, bool) error
// Stdio returns io information for the container // Stdio returns io information for the container
Stdio() stdio Stdio() stdio
// Start execution of the process
Start(context.Context) error
} }

View File

@ -108,18 +108,36 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*sh
}, nil }, nil
} }
func (s *Service) Start(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*shimapi.StartResponse, error) {
if s.initProcess == nil { p, ok := s.processes[r.ID]
return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created") if !ok {
return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process %s not found", r.ID)
} }
if err := s.initProcess.Start(ctx); err != nil { if err := p.Start(ctx); err != nil {
return nil, err return nil, err
} }
s.events <- &eventsapi.TaskStart{ if r.ID == s.id {
ContainerID: s.id, s.events <- &eventsapi.TaskStart{
Pid: uint32(s.initProcess.Pid()), ContainerID: s.id,
Pid: uint32(s.initProcess.Pid()),
}
} else {
pid := p.Pid()
cmd := &reaper.Cmd{
ExitCh: make(chan int, 1),
}
reaper.Default.Register(pid, cmd)
go s.waitExit(p, pid, cmd)
s.events <- &eventsapi.TaskExecStarted{
ContainerID: s.id,
ExecID: r.ID,
Pid: uint32(pid),
}
} }
return empty, nil return &shimapi.StartResponse{
ID: p.ID(),
Pid: uint32(p.Pid()),
}, nil
} }
func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimapi.DeleteResponse, error) { func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimapi.DeleteResponse, error) {
@ -170,7 +188,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq
}, nil }, nil
} }
func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shimapi.ExecProcessResponse, error) { func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*google_protobuf.Empty, error) {
if s.initProcess == nil { if s.initProcess == nil {
return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created") return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created")
} }
@ -181,22 +199,13 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi
if err != nil { if err != nil {
return nil, errdefs.ToGRPC(err) return nil, errdefs.ToGRPC(err)
} }
pid := process.Pid()
cmd := &reaper.Cmd{
ExitCh: make(chan int, 1),
}
reaper.Default.Register(pid, cmd)
s.processes[r.ID] = process s.processes[r.ID] = process
s.events <- &eventsapi.TaskExecAdded{ s.events <- &eventsapi.TaskExecAdded{
ContainerID: s.id, ContainerID: s.id,
ExecID: r.ID, ExecID: r.ID,
Pid: uint32(pid),
} }
go s.waitExit(process, pid, cmd) return empty, nil
return &shimapi.ExecProcessResponse{
Pid: uint32(pid),
}, nil
} }
func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) { func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) {

View File

@ -25,6 +25,8 @@
CheckpointTaskRequest CheckpointTaskRequest
ShimInfoResponse ShimInfoResponse
UpdateTaskRequest UpdateTaskRequest
StartRequest
StartResponse
*/ */
package shim package shim
@ -122,7 +124,6 @@ func (*ExecProcessRequest) ProtoMessage() {}
func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{4} } func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{4} }
type ExecProcessResponse struct { type ExecProcessResponse struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
} }
func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} } func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} }
@ -222,6 +223,23 @@ func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{
func (*UpdateTaskRequest) ProtoMessage() {} func (*UpdateTaskRequest) ProtoMessage() {}
func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} }
type StartRequest struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (m *StartRequest) Reset() { *m = StartRequest{} }
func (*StartRequest) ProtoMessage() {}
func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} }
type StartResponse struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"`
}
func (m *StartResponse) Reset() { *m = StartResponse{} }
func (*StartResponse) ProtoMessage() {}
func (*StartResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{17} }
func init() { func init() {
proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest") proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest")
proto.RegisterType((*CreateTaskResponse)(nil), "containerd.runtime.linux.shim.v1.CreateTaskResponse") proto.RegisterType((*CreateTaskResponse)(nil), "containerd.runtime.linux.shim.v1.CreateTaskResponse")
@ -239,6 +257,8 @@ func init() {
proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CheckpointTaskRequest") proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CheckpointTaskRequest")
proto.RegisterType((*ShimInfoResponse)(nil), "containerd.runtime.linux.shim.v1.ShimInfoResponse") proto.RegisterType((*ShimInfoResponse)(nil), "containerd.runtime.linux.shim.v1.ShimInfoResponse")
proto.RegisterType((*UpdateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.UpdateTaskRequest") proto.RegisterType((*UpdateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.UpdateTaskRequest")
proto.RegisterType((*StartRequest)(nil), "containerd.runtime.linux.shim.v1.StartRequest")
proto.RegisterType((*StartResponse)(nil), "containerd.runtime.linux.shim.v1.StartResponse")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -255,7 +275,7 @@ type ShimClient interface {
// State returns shim and task state information. // State returns shim and task state information.
State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error)
Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error)
Start(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
Delete(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*DeleteResponse, error) Delete(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*DeleteResponse, error)
DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
ListPids(ctx context.Context, in *ListPidsRequest, opts ...grpc.CallOption) (*ListPidsResponse, error) ListPids(ctx context.Context, in *ListPidsRequest, opts ...grpc.CallOption) (*ListPidsResponse, error)
@ -263,7 +283,7 @@ type ShimClient interface {
Resume(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Resume(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
// ShimInfo returns information about the shim. // ShimInfo returns information about the shim.
@ -297,8 +317,8 @@ func (c *shimClient) Create(ctx context.Context, in *CreateTaskRequest, opts ...
return out, nil return out, nil
} }
func (c *shimClient) Start(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { func (c *shimClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) {
out := new(google_protobuf1.Empty) out := new(StartResponse)
err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Start", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Start", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -369,8 +389,8 @@ func (c *shimClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.Cal
return out, nil return out, nil
} }
func (c *shimClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) { func (c *shimClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
out := new(ExecProcessResponse) out := new(google_protobuf1.Empty)
err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Exec", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Exec", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -420,7 +440,7 @@ type ShimServer interface {
// State returns shim and task state information. // State returns shim and task state information.
State(context.Context, *StateRequest) (*StateResponse, error) State(context.Context, *StateRequest) (*StateResponse, error)
Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error)
Start(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) Start(context.Context, *StartRequest) (*StartResponse, error)
Delete(context.Context, *google_protobuf1.Empty) (*DeleteResponse, error) Delete(context.Context, *google_protobuf1.Empty) (*DeleteResponse, error)
DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error)
ListPids(context.Context, *ListPidsRequest) (*ListPidsResponse, error) ListPids(context.Context, *ListPidsRequest) (*ListPidsResponse, error)
@ -428,7 +448,7 @@ type ShimServer interface {
Resume(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) Resume(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error)
Checkpoint(context.Context, *CheckpointTaskRequest) (*google_protobuf1.Empty, error) Checkpoint(context.Context, *CheckpointTaskRequest) (*google_protobuf1.Empty, error)
Kill(context.Context, *KillRequest) (*google_protobuf1.Empty, error) Kill(context.Context, *KillRequest) (*google_protobuf1.Empty, error)
Exec(context.Context, *ExecProcessRequest) (*ExecProcessResponse, error) Exec(context.Context, *ExecProcessRequest) (*google_protobuf1.Empty, error)
ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf1.Empty, error) ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf1.Empty, error)
CloseIO(context.Context, *CloseIORequest) (*google_protobuf1.Empty, error) CloseIO(context.Context, *CloseIORequest) (*google_protobuf1.Empty, error)
// ShimInfo returns information about the shim. // ShimInfo returns information about the shim.
@ -477,7 +497,7 @@ func _Shim_Create_Handler(srv interface{}, ctx context.Context, dec func(interfa
} }
func _Shim_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Shim_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(google_protobuf1.Empty) in := new(StartRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -489,7 +509,7 @@ func _Shim_Start_Handler(srv interface{}, ctx context.Context, dec func(interfac
FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Start", FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Start",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Start(ctx, req.(*google_protobuf1.Empty)) return srv.(ShimServer).Start(ctx, req.(*StartRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -1037,11 +1057,6 @@ func (m *ExecProcessResponse) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Pid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintShim(dAtA, i, uint64(m.Pid))
}
return i, nil return i, nil
} }
@ -1388,6 +1403,59 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func (m *StartRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintShim(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
return i, nil
}
func (m *StartResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *StartResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintShim(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if m.Pid != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintShim(dAtA, i, uint64(m.Pid))
}
return i, nil
}
func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int { func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8) dAtA[offset+1] = uint8(v >> 8)
@ -1531,9 +1599,6 @@ func (m *ExecProcessRequest) Size() (n int) {
func (m *ExecProcessResponse) Size() (n int) { func (m *ExecProcessResponse) Size() (n int) {
var l int var l int
_ = l _ = l
if m.Pid != 0 {
n += 1 + sovShim(uint64(m.Pid))
}
return n return n
} }
@ -1683,6 +1748,29 @@ func (m *UpdateTaskRequest) Size() (n int) {
return n return n
} }
func (m *StartRequest) Size() (n int) {
var l int
_ = l
l = len(m.ID)
if l > 0 {
n += 1 + l + sovShim(uint64(l))
}
return n
}
func (m *StartResponse) Size() (n int) {
var l int
_ = l
l = len(m.ID)
if l > 0 {
n += 1 + l + sovShim(uint64(l))
}
if m.Pid != 0 {
n += 1 + sovShim(uint64(m.Pid))
}
return n
}
func sovShim(x uint64) (n int) { func sovShim(x uint64) (n int) {
for { for {
n++ n++
@ -1768,7 +1856,6 @@ func (this *ExecProcessResponse) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&ExecProcessResponse{`, s := strings.Join([]string{`&ExecProcessResponse{`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -1886,6 +1973,27 @@ func (this *UpdateTaskRequest) String() string {
}, "") }, "")
return s return s
} }
func (this *StartRequest) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&StartRequest{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`}`,
}, "")
return s
}
func (this *StartResponse) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&StartResponse{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`}`,
}, "")
return s
}
func valueToStringShim(v interface{}) string { func valueToStringShim(v interface{}) string {
rv := reflect.ValueOf(v) rv := reflect.ValueOf(v)
if rv.IsNil() { if rv.IsNil() {
@ -2774,25 +2882,6 @@ func (m *ExecProcessResponse) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
}
m.Pid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipShim(dAtA[iNdEx:]) skippy, err := skipShim(dAtA[iNdEx:])
@ -3935,6 +4024,183 @@ func (m *UpdateTaskRequest) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *StartRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StartRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StartRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthShim
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipShim(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthShim
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *StartResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StartResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StartResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthShim
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
}
m.Pid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipShim(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthShim
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipShim(dAtA []byte) (n int, err error) { func skipShim(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
@ -4045,71 +4311,72 @@ func init() {
} }
var fileDescriptorShim = []byte{ var fileDescriptorShim = []byte{
// 1049 bytes of a gzipped FileDescriptorProto // 1072 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x5f, 0x6f, 0xe3, 0x44,
0x14, 0x5f, 0xe7, 0xaf, 0xfb, 0x42, 0x4a, 0x3b, 0x94, 0xe2, 0xcd, 0x4a, 0x69, 0xe4, 0x43, 0x09, 0x10,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f, 0x35,
0xff, 0xa3, 0x6e, 0xef, 0x88, 0x48, 0x0d, 0x00, 0x00, 0x8c, 0xbf, 0x46, 0x0d, 0xe3, 0xbb, 0xbd, 0xe5, 0xfe, 0xdb, 0xfa, 0x4c, 0xfc, 0x5e, 0x94, 0xa4,
0xf9, 0xbd, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x05, 0x95, 0x8a, 0x43, 0xab, 0x0d, 0x00, 0x00,
} }

View File

@ -21,7 +21,7 @@ service Shim {
rpc Create(CreateTaskRequest) returns (CreateTaskResponse); rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
rpc Start(google.protobuf.Empty) returns (google.protobuf.Empty); rpc Start(StartRequest) returns (StartResponse);
rpc Delete(google.protobuf.Empty) returns (DeleteResponse); rpc Delete(google.protobuf.Empty) returns (DeleteResponse);
@ -37,7 +37,7 @@ service Shim {
rpc Kill(KillRequest) returns (google.protobuf.Empty); rpc Kill(KillRequest) returns (google.protobuf.Empty);
rpc Exec(ExecProcessRequest) returns (ExecProcessResponse); rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty);
rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty); rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty);
@ -87,7 +87,6 @@ message ExecProcessRequest {
} }
message ExecProcessResponse { message ExecProcessResponse {
uint32 pid = 1;
} }
message ResizePtyRequest { message ResizePtyRequest {
@ -142,3 +141,12 @@ message ShimInfoResponse {
message UpdateTaskRequest { message UpdateTaskRequest {
google.protobuf.Any resources = 1; google.protobuf.Any resources = 1;
} }
message StartRequest {
string id = 1;
}
message StartResponse {
string id = 1;
uint32 pid = 2;
}

View File

@ -40,11 +40,13 @@ func (t *Task) Info() runtime.TaskInfo {
} }
func (t *Task) Start(ctx context.Context) error { func (t *Task) Start(ctx context.Context) error {
_, err := t.shim.Start(ctx, empty) _, err := t.shim.Start(ctx, &shim.StartRequest{
ID: t.id,
})
if err != nil { if err != nil {
err = errdefs.FromGRPC(err) return errdefs.FromGRPC(err)
} }
return err return nil
} }
func (t *Task) State(ctx context.Context) (runtime.State, error) { func (t *Task) State(ctx context.Context) (runtime.State, error) {
@ -116,6 +118,11 @@ func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt
if _, err := t.shim.Exec(ctx, request); err != nil { if _, err := t.shim.Exec(ctx, request); err != nil {
return nil, errdefs.FromGRPC(err) return nil, errdefs.FromGRPC(err)
} }
if _, err := t.shim.Start(ctx, &shim.StartRequest{
ID: id,
}); err != nil {
return nil, errdefs.FromGRPC(err)
}
return &Process{ return &Process{
id: id, id: id,
t: t, t: t,