From 63878d14ea4d4f40db1daa154293ce961d8c7a2f Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 11:26:21 -0400 Subject: [PATCH 01/10] 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 --- api/services/events/v1/container.pb.go | 1 + api/services/events/v1/task.pb.go | 280 ++++++++++++--- api/services/events/v1/task.proto | 5 + cmd/ctr/shim.go | 11 +- linux/shim/exec.go | 142 ++++---- linux/shim/local.go | 4 +- linux/shim/process.go | 2 + linux/shim/service.go | 47 ++- linux/shim/v1/shim.pb.go | 479 +++++++++++++++++++------ linux/shim/v1/shim.proto | 14 +- linux/task.go | 13 +- 11 files changed, 749 insertions(+), 249 deletions(-) diff --git a/api/services/events/v1/container.pb.go b/api/services/events/v1/container.pb.go index b76b1d765..75ce359b6 100644 --- a/api/services/events/v1/container.pb.go +++ b/api/services/events/v1/container.pb.go @@ -39,6 +39,7 @@ TaskExit TaskOOM TaskExecAdded + TaskExecStarted TaskPaused TaskResumed TaskCheckpointed diff --git a/api/services/events/v1/task.pb.go b/api/services/events/v1/task.pb.go index 53f6335e0..97faa3808 100644 --- a/api/services/events/v1/task.pb.go +++ b/api/services/events/v1/task.pb.go @@ -94,20 +94,29 @@ func (*TaskOOM) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{ type TaskExecAdded 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 *TaskExecAdded) Reset() { *m = TaskExecAdded{} } func (*TaskExecAdded) ProtoMessage() {} 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 { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } func (m *TaskPaused) Reset() { *m = TaskPaused{} } func (*TaskPaused) ProtoMessage() {} -func (*TaskPaused) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{7} } +func (*TaskPaused) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{8} } type TaskResumed struct { 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 (*TaskResumed) ProtoMessage() {} -func (*TaskResumed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{8} } +func (*TaskResumed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{9} } type TaskCheckpointed struct { 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 (*TaskCheckpointed) ProtoMessage() {} -func (*TaskCheckpointed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{9} } +func (*TaskCheckpointed) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{10} } func init() { 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((*TaskOOM)(nil), "containerd.services.events.v1.TaskOOM") 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((*TaskResumed)(nil), "containerd.services.events.v1.TaskResumed") proto.RegisterType((*TaskCheckpointed)(nil), "containerd.services.events.v1.TaskCheckpointed") @@ -263,6 +273,22 @@ func (m *TaskExecAdded) Field(fieldpath []string) (string, bool) { 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] { // unhandled: pid case "container_id": @@ -579,6 +605,36 @@ func (m *TaskExecAdded) Marshal() (dAtA []byte, err 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 _ = i var l int @@ -824,6 +880,20 @@ func (m *TaskOOM) 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 _ = l l = len(m.ContainerID) @@ -968,6 +1038,17 @@ func (this *TaskExecAdded) String() string { return "nil" } 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) + `,`, `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `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) } 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: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) @@ -2394,45 +2583,46 @@ func init() { } var fileDescriptorTask = []byte{ - // 634 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0x6b, 0xa7, 0x75, 0x93, 0x0d, 0x15, 0x95, 0x55, 0x41, 0x14, 0x09, 0x3b, 0x32, 0x42, - 0xca, 0xc9, 0x56, 0x8b, 0xc4, 0x05, 0x15, 0x35, 0x69, 0x38, 0xe4, 0x50, 0x05, 0xdc, 0x9e, 0x10, - 0x52, 0xe4, 0xd8, 0x93, 0x74, 0x69, 0xec, 0xb5, 0xbc, 0xe3, 0xa8, 0x70, 0xe2, 0x11, 0x78, 0x04, - 0x9e, 0x82, 0x67, 0xe8, 0x81, 0x03, 0x47, 0x4e, 0x81, 0xfa, 0x19, 0x38, 0x71, 0x42, 0xeb, 0x75, - 0xdc, 0xf2, 0x55, 0x90, 0x6f, 0x33, 0xe3, 0x99, 0xff, 0xce, 0xfc, 0x76, 0xb2, 0x21, 0xfd, 0x19, - 0xc5, 0xd3, 0x74, 0x62, 0xfb, 0x2c, 0x74, 0x7c, 0x16, 0xa1, 0x47, 0x23, 0x48, 0x82, 0xeb, 0xa6, - 0x17, 0x53, 0x87, 0x43, 0xb2, 0xa0, 0x3e, 0x70, 0x07, 0x16, 0x10, 0x21, 0x77, 0x16, 0xbb, 0x0e, - 0x7a, 0xfc, 0xcc, 0x8e, 0x13, 0x86, 0x4c, 0xbf, 0x77, 0x95, 0x6d, 0xaf, 0x32, 0x6d, 0x99, 0x69, - 0x2f, 0x76, 0xdb, 0x3b, 0x33, 0x36, 0x63, 0x79, 0xa6, 0x23, 0x2c, 0x59, 0xd4, 0x36, 0x67, 0x8c, - 0xcd, 0xe6, 0xe0, 0xe4, 0xde, 0x24, 0x9d, 0x3a, 0x48, 0x43, 0xe0, 0xe8, 0x85, 0x71, 0x91, 0xf0, - 0xe8, 0xbf, 0x3a, 0xc3, 0xd7, 0x31, 0x70, 0x27, 0x64, 0x69, 0x84, 0x45, 0xdd, 0xc1, 0x3f, 0xeb, - 0xca, 0x23, 0xe3, 0x79, 0x3a, 0xa3, 0x91, 0x33, 0xa5, 0x30, 0x0f, 0x62, 0x0f, 0x4f, 0xa5, 0x82, - 0xf5, 0x5d, 0x21, 0xe4, 0xc4, 0xe3, 0x67, 0x87, 0x09, 0x78, 0x08, 0xfa, 0x1e, 0xb9, 0x55, 0x16, - 0x8f, 0x69, 0xd0, 0x52, 0x3a, 0x4a, 0xb7, 0xd1, 0xbf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, 0xcc, 0x50, 0x3e, 0x65, 0x86, 0xf2, 0x35, 0x33, 0x94, 0xf7, 0xdf, 0x0c, 0xe5, - 0xc5, 0x93, 0x8a, 0xff, 0x0e, 0x8f, 0xa5, 0x35, 0xd1, 0xf2, 0x6d, 0x79, 0xf8, 0x23, 0x00, 0x00, - 0xff, 0xff, 0xfd, 0xdf, 0x0f, 0x7f, 0x66, 0x06, 0x00, 0x00, + // 648 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0x6b, 0xa7, 0x75, 0x93, 0x0d, 0x55, 0x2b, 0xab, 0x82, 0x28, 0x12, 0x76, 0x64, 0x84, + 0x94, 0x93, 0xad, 0x16, 0x89, 0x0b, 0x2a, 0x6a, 0xd2, 0x70, 0xc8, 0xa1, 0x0a, 0xb8, 0x3d, 0x21, + 0xa4, 0xc8, 0xb1, 0x27, 0xc9, 0xd2, 0xc4, 0x6b, 0x79, 0xc7, 0x51, 0x91, 0x38, 0xf0, 0x08, 0x3c, + 0x02, 0x4f, 0xc1, 0x33, 0xf4, 0xc0, 0x81, 0x23, 0xa7, 0x40, 0xfd, 0x0c, 0x9c, 0x38, 0xa1, 0xf5, + 0x3a, 0x6e, 0xa1, 0xa2, 0x20, 0x4b, 0xdc, 0x76, 0xc6, 0x33, 0xff, 0xcc, 0x7c, 0x3b, 0xd9, 0x90, + 0xee, 0x84, 0xe2, 0x34, 0x19, 0xd9, 0x3e, 0x9b, 0x3b, 0x3e, 0x0b, 0xd1, 0xa3, 0x21, 0xc4, 0xc1, + 0xf5, 0xa3, 0x17, 0x51, 0x87, 0x43, 0xbc, 0xa0, 0x3e, 0x70, 0x07, 0x16, 0x10, 0x22, 0x77, 0x16, + 0x7b, 0x0e, 0x7a, 0xfc, 0xcc, 0x8e, 0x62, 0x86, 0x4c, 0xbf, 0x7f, 0x15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36, 0xc5, 0x34, 0x83, 0xc1, 0x71, 0x99, 0x61, + 0xac, 0x29, 0xd9, 0x92, 0x30, 0xc0, 0xef, 0x04, 0x01, 0x04, 0xa5, 0x88, 0x3c, 0x20, 0x9b, 0x70, + 0x0e, 0xfe, 0xb0, 0xc0, 0x42, 0xd2, 0xa5, 0xa9, 0x09, 0xcd, 0x7e, 0xcf, 0xd5, 0xc4, 0xa7, 0x7e, + 0x60, 0xbd, 0x25, 0xdb, 0xab, 0x4a, 0xd9, 0xce, 0xff, 0xc7, 0x5a, 0x37, 0xaf, 0xc2, 0x3a, 0x94, + 0xbf, 0x8c, 0xe7, 0x5e, 0xc2, 0xcb, 0x15, 0xb6, 0x3a, 0xa4, 0x2e, 0x14, 0x5c, 0xe0, 0xc9, 0xbc, + 0xa4, 0xc4, 0x98, 0xec, 0x64, 0xcf, 0x5d, 0xf1, 0x2c, 0x94, 0x64, 0xf0, 0xeb, 0x63, 0xa3, 0xfe, + 0xfe, 0xd8, 0x74, 0x5f, 0x5d, 0x5c, 0x1a, 0x6b, 0x5f, 0x2e, 0x8d, 0xb5, 0x77, 0xa9, 0xa1, 0x5c, + 0xa4, 0x86, 0xf2, 0x39, 0x35, 0x94, 0x6f, 0xa9, 0xa1, 0x7c, 0xf8, 0x6e, 0x28, 0x2f, 0x9f, 0x96, + 0xfc, 0x27, 0x7a, 0x22, 0x4f, 0x23, 0x2d, 0xdb, 0xcc, 0x47, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x76, 0xdf, 0xe7, 0xaa, 0xd2, 0x06, 0x00, 0x00, } diff --git a/api/services/events/v1/task.proto b/api/services/events/v1/task.proto index 6a0f3756b..79f87a6c5 100644 --- a/api/services/events/v1/task.proto +++ b/api/services/events/v1/task.proto @@ -53,6 +53,11 @@ message TaskOOM { message TaskExecAdded { string container_id = 1; string exec_id = 2; +} + +message TaskExecStarted { + string container_id = 1; + string exec_id = 2; uint32 pid = 3; } diff --git a/cmd/ctr/shim.go b/cmd/ctr/shim.go index b435e788e..1b2e09bad 100644 --- a/cmd/ctr/shim.go +++ b/cmd/ctr/shim.go @@ -149,7 +149,9 @@ var shimStartCommand = cli.Command{ if err != nil { return err } - _, err = service.Start(gocontext.Background(), empty) + _, err = service.Start(gocontext.Background(), &shim.StartRequest{ + ID: context.Args().First(), + }) return err }, } @@ -261,7 +263,12 @@ var shimExecCommand = cli.Command{ Stderr: context.String("stderr"), 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 { return err } diff --git a/linux/shim/exec.go b/linux/shim/exec.go index c031298f9..950df8ae4 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -36,6 +36,8 @@ type execProcess struct { closers []io.Closer stdin io.Closer stdio stdio + path string + spec specs.Process parent *initProcess } @@ -44,43 +46,6 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecProcess if err := identifiers.Validate(id); err != nil { 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 var spec specs.Process 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 - if err := parent.runtime.Exec(context, parent.id, spec, opts); err != nil { - return nil, parent.runtimeError(err, "OCI runtime exec failed") + e := &execProcess{ + 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, ©WaitGroup) - 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, ©WaitGroup); 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 } @@ -178,3 +122,63 @@ func (e *execProcess) Stdin() io.Closer { func (e *execProcess) Stdio() 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, ©WaitGroup); 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, ©WaitGroup); 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 +} diff --git a/linux/shim/local.go b/linux/shim/local.go index eda8ec52b..7e993a3d2 100644 --- a/linux/shim/local.go +++ b/linux/shim/local.go @@ -27,7 +27,7 @@ func (c *local) Create(ctx context.Context, in *shimapi.CreateTaskRequest, opts 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) } @@ -43,7 +43,7 @@ func (c *local) DeleteProcess(ctx context.Context, in *shimapi.DeleteProcessRequ 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) } diff --git a/linux/shim/process.go b/linux/shim/process.go index 183176373..c7550011a 100644 --- a/linux/shim/process.go +++ b/linux/shim/process.go @@ -38,4 +38,6 @@ type process interface { Kill(context.Context, uint32, bool) error // Stdio returns io information for the container Stdio() stdio + // Start execution of the process + Start(context.Context) error } diff --git a/linux/shim/service.go b/linux/shim/service.go index 9ed22b36d..2147cf280 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -108,18 +108,36 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*sh }, nil } -func (s *Service) Start(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { - if s.initProcess == nil { - return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created") +func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*shimapi.StartResponse, error) { + p, ok := s.processes[r.ID] + 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 } - s.events <- &eventsapi.TaskStart{ - ContainerID: s.id, - Pid: uint32(s.initProcess.Pid()), + if r.ID == s.id { + s.events <- &eventsapi.TaskStart{ + 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) { @@ -170,7 +188,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq }, 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 { 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 { 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.events <- &eventsapi.TaskExecAdded{ ContainerID: s.id, ExecID: r.ID, - Pid: uint32(pid), } - go s.waitExit(process, pid, cmd) - return &shimapi.ExecProcessResponse{ - Pid: uint32(pid), - }, nil + return empty, nil } func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) { diff --git a/linux/shim/v1/shim.pb.go b/linux/shim/v1/shim.pb.go index 5c14a0243..0f370f67d 100644 --- a/linux/shim/v1/shim.pb.go +++ b/linux/shim/v1/shim.pb.go @@ -25,6 +25,8 @@ CheckpointTaskRequest ShimInfoResponse UpdateTaskRequest + StartRequest + StartResponse */ package shim @@ -122,7 +124,6 @@ func (*ExecProcessRequest) ProtoMessage() {} func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{4} } type ExecProcessResponse struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` } func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} } @@ -222,6 +223,23 @@ func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{ func (*UpdateTaskRequest) ProtoMessage() {} 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() { proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest") 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((*ShimInfoResponse)(nil), "containerd.runtime.linux.shim.v1.ShimInfoResponse") 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. @@ -255,7 +275,7 @@ type ShimClient interface { // State returns shim and task state information. State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, 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) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, 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) 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) - 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) CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) // ShimInfo returns information about the shim. @@ -297,8 +317,8 @@ func (c *shimClient) Create(ctx context.Context, in *CreateTaskRequest, opts ... return out, nil } -func (c *shimClient) Start(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { - out := new(google_protobuf1.Empty) +func (c *shimClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { + out := new(StartResponse) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Start", in, out, c.cc, opts...) if err != nil { return nil, err @@ -369,8 +389,8 @@ func (c *shimClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.Cal return out, nil } -func (c *shimClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) { - out := new(ExecProcessResponse) +func (c *shimClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Exec", in, out, c.cc, opts...) if err != nil { return nil, err @@ -420,7 +440,7 @@ type ShimServer interface { // State returns shim and task state information. State(context.Context, *StateRequest) (*StateResponse, 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) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) ListPids(context.Context, *ListPidsRequest) (*ListPidsResponse, error) @@ -428,7 +448,7 @@ type ShimServer interface { Resume(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) Checkpoint(context.Context, *CheckpointTaskRequest) (*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) CloseIO(context.Context, *CloseIORequest) (*google_protobuf1.Empty, error) // 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) { - in := new(google_protobuf1.Empty) + in := new(StartRequest) if err := dec(in); err != nil { 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", } 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) } @@ -1037,11 +1057,6 @@ func (m *ExecProcessResponse) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Pid != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintShim(dAtA, i, uint64(m.Pid)) - } return i, nil } @@ -1388,6 +1403,59 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) { 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 { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1531,9 +1599,6 @@ func (m *ExecProcessRequest) Size() (n int) { func (m *ExecProcessResponse) Size() (n int) { var l int _ = l - if m.Pid != 0 { - n += 1 + sovShim(uint64(m.Pid)) - } return n } @@ -1683,6 +1748,29 @@ func (m *UpdateTaskRequest) Size() (n int) { 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) { for { n++ @@ -1768,7 +1856,6 @@ func (this *ExecProcessResponse) String() string { return "nil" } s := strings.Join([]string{`&ExecProcessResponse{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s @@ -1886,6 +1973,27 @@ func (this *UpdateTaskRequest) String() string { }, "") 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 { rv := reflect.ValueOf(v) 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) } 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: iNdEx = preIndex skippy, err := skipShim(dAtA[iNdEx:]) @@ -3935,6 +4024,183 @@ func (m *UpdateTaskRequest) Unmarshal(dAtA []byte) error { } 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) { l := len(dAtA) iNdEx := 0 @@ -4045,71 +4311,72 @@ func init() { } var fileDescriptorShim = []byte{ - // 1049 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x5f, 0xe7, 0xaf, 0xfb, 0x42, 0x4a, 0x3b, 0x94, 0xe2, 0xcd, 0x4a, 0x69, 0xe4, 0x43, 0x09, - 0x42, 0x6b, 0xd3, 0x14, 0x76, 0xf9, 0x23, 0x21, 0xb5, 0xdd, 0x15, 0xaa, 0xa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7b, 0x69, 0x66, 0x36, - 0x27, 0x50, 0x57, 0xca, 0x8d, 0x0a, 0x94, 0xe7, 0xac, 0xc8, 0x67, 0x6e, 0xfa, 0x35, 0xe8, 0x13, - 0x79, 0xcc, 0x2c, 0x86, 0x02, 0x49, 0x2c, 0x48, 0xec, 0x0b, 0xa8, 0x25, 0x3a, 0x5a, 0x44, 0x8b, - 0x16, 0x14, 0x37, 0x2b, 0xdc, 0xfd, 0xa3, 0x9b, 0xd7, 0xed, 0x7b, 0x7f, 0xbe, 0x6e, 0xdf, 0xfb, - 0x79, 0xdc, 0xd6, 0x6e, 0xc6, 0x6d, 0xed, 0xf7, 0x71, 0x5b, 0xfb, 0x7b, 0xdc, 0xd6, 0xbe, 0xdb, - 0x5d, 0xee, 0xa7, 0xd0, 0x67, 0xe2, 0x7b, 0x56, 0x93, 0xdb, 0xef, 0xfe, 0x17, 0x00, 0x00, 0xff, - 0xff, 0xa3, 0x6e, 0xef, 0x88, 0x48, 0x0d, 0x00, 0x00, + // 1072 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x5f, 0x6f, 0xe3, 0x44, + 0x10, 0xaf, 0xf3, 0xbf, 0x13, 0x52, 0xda, 0xa5, 0x57, 0x7c, 0x39, 0x29, 0x8d, 0xfc, 0x50, 0x05, + 0xa1, 0x73, 0x68, 0x8a, 0xee, 0x38, 0x90, 0x90, 0xda, 0xde, 0x09, 0x55, 0x50, 0x5d, 0xe5, 0xf6, + 0x00, 0x81, 0x50, 0xe5, 0xc6, 0xdb, 0x64, 0xd5, 0xc4, 0xeb, 0xf3, 0xae, 0x4b, 0xcb, 0x13, 0x4f, + 0x3c, 0xf3, 0x71, 0xf8, 0x08, 0x7d, 0xe4, 0x91, 0xa7, 0x83, 0x8b, 0x84, 0xc4, 0x0b, 0xdf, 0x01, + 0xed, 0x9f, 0x24, 0x4e, 0x52, 0xcb, 0x0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x89, 0x33, 0x47, 0x4b, 0xc8, + 0x84, 0xb2, 0xce, 0xa0, 0x99, 0x97, 0x07, 0x63, 0x11, 0xb5, 0xa1, 0x14, 0x52, 0xca, 0x2f, 0x99, + 0x59, 0x68, 0xe6, 0x5b, 0xd5, 0xce, 0xfb, 0x76, 0x2c, 0xeb, 0xd2, 0x25, 0xfb, 0x58, 0x84, 0xe2, + 0x68, 0x18, 0xaa, 0x43, 0x85, 0xe3, 0x70, 0x48, 0x7c, 0x77, 0x60, 0x16, 0x9b, 0x46, 0xab, 0xe2, + 0x4c, 0x64, 0xb4, 0x09, 0x45, 0xc6, 0x3d, 0xe2, 0x9b, 0x25, 0x79, 0x89, 0x12, 0x84, 0x53, 0x8c, + 0x7b, 0x34, 0xe2, 0x66, 0x59, 0x39, 0xa5, 0x24, 0xbd, 0x8f, 0xc3, 0xd0, 0xac, 0x4c, 0xf6, 0x71, + 0x18, 0xa2, 0x06, 0x40, 0xb7, 0x8f, 0xbb, 0x57, 0x01, 0x25, 0x3e, 0x37, 0x57, 0xe5, 0x59, 0x6c, + 0x07, 0x7d, 0x08, 0x1b, 0x81, 0x1b, 0x62, 0x9f, 0x9f, 0xc7, 0x60, 0x20, 0x61, 0xeb, 0xea, 0xe0, + 0x70, 0x0a, 0xb6, 0xa1, 0x4c, 0x03, 0x4e, 0xa8, 0xcf, 0xcc, 0x6a, 0xd3, 0x68, 0x55, 0x3b, 0x9b, + 0xb6, 0xa2, 0xd9, 0x1e, 0xd3, 0x6c, 0xef, 0xfb, 0xb7, 0xce, 0x18, 0x64, 0xed, 0x00, 0x8a, 0xa7, + 0x9b, 0x05, 0xd4, 0x67, 0x18, 0xad, 0x43, 0x3e, 0xd0, 0x09, 0xaf, 0x39, 0x62, 0x69, 0xfd, 0x62, + 0xc0, 0xda, 0x73, 0x3c, 0xc0, 0x1c, 0x27, 0x83, 0xd0, 0x36, 0x54, 0xf1, 0x0d, 0xe1, 0xe7, 0x8c, + 0xbb, 0x3c, 0x62, 0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c9, 0x89, 0x6c, 0x67, 0x08, 0x62, 0xa1, 0xaf, 0xbf, + 0x82, 0x92, 0x6a, 0xde, 0x59, 0xba, 0xd3, 0x42, 0x9b, 0x4f, 0x72, 0xf7, 0xe0, 0xf8, 0xee, 0x6d, + 0x63, 0xe5, 0x8f, 0xb7, 0x8d, 0x95, 0x9f, 0x47, 0x0d, 0xe3, 0x6e, 0xd4, 0x30, 0x7e, 0x1f, 0x35, + 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, } diff --git a/linux/shim/v1/shim.proto b/linux/shim/v1/shim.proto index 814cb8889..d475af587 100644 --- a/linux/shim/v1/shim.proto +++ b/linux/shim/v1/shim.proto @@ -21,7 +21,7 @@ service Shim { 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); @@ -37,7 +37,7 @@ service Shim { 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); @@ -87,7 +87,6 @@ message ExecProcessRequest { } message ExecProcessResponse { - uint32 pid = 1; } message ResizePtyRequest { @@ -142,3 +141,12 @@ message ShimInfoResponse { message UpdateTaskRequest { google.protobuf.Any resources = 1; } + +message StartRequest { + string id = 1; +} + +message StartResponse { + string id = 1; + uint32 pid = 2; +} diff --git a/linux/task.go b/linux/task.go index 06e583dca..51a85079b 100644 --- a/linux/task.go +++ b/linux/task.go @@ -40,11 +40,13 @@ func (t *Task) Info() runtime.TaskInfo { } 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 { - err = errdefs.FromGRPC(err) + return errdefs.FromGRPC(err) } - return err + return nil } 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 { return nil, errdefs.FromGRPC(err) } + if _, err := t.shim.Start(ctx, &shim.StartRequest{ + ID: id, + }); err != nil { + return nil, errdefs.FromGRPC(err) + } return &Process{ id: id, t: t, From a2a34519259562e669c1f91d0f4d74687911740f Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 14:02:52 -0400 Subject: [PATCH 02/10] Implement Exec + Start for tasks service This splits up the exec creation and start in the tasks service Signed-off-by: Michael Crosby --- api/services/tasks/v1/tasks.pb.go | 434 +++++++++++++++++++----------- api/services/tasks/v1/tasks.proto | 14 +- container_test.go | 2 +- linux/process.go | 14 +- linux/task.go | 5 - process.go | 16 +- runtime/task.go | 4 +- services/tasks/service.go | 34 +-- task.go | 21 +- 9 files changed, 350 insertions(+), 194 deletions(-) diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index a6e60108c..1b6513899 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -11,7 +11,8 @@ It has these top-level messages: CreateTaskRequest CreateTaskResponse - StartTaskRequest + StartRequest + StartResponse DeleteTaskRequest DeleteResponse DeleteProcessRequest @@ -102,13 +103,22 @@ func (m *CreateTaskResponse) Reset() { *m = CreateTaskRespons func (*CreateTaskResponse) ProtoMessage() {} func (*CreateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{1} } -type StartTaskRequest struct { +type StartRequest 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"` } -func (m *StartTaskRequest) Reset() { *m = StartTaskRequest{} } -func (*StartTaskRequest) ProtoMessage() {} -func (*StartTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{2} } +func (m *StartRequest) Reset() { *m = StartRequest{} } +func (*StartRequest) ProtoMessage() {} +func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{2} } + +type StartResponse struct { + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (m *StartResponse) Reset() { *m = StartResponse{} } +func (*StartResponse) ProtoMessage() {} +func (*StartResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} } type DeleteTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -116,7 +126,7 @@ type DeleteTaskRequest struct { func (m *DeleteTaskRequest) Reset() { *m = DeleteTaskRequest{} } func (*DeleteTaskRequest) ProtoMessage() {} -func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} } +func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{4} } type DeleteResponse struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -127,7 +137,7 @@ type DeleteResponse struct { func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{4} } +func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{5} } type DeleteProcessRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -136,7 +146,7 @@ type DeleteProcessRequest struct { func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } func (*DeleteProcessRequest) ProtoMessage() {} -func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{5} } +func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{6} } type GetTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -144,7 +154,7 @@ type GetTaskRequest struct { func (m *GetTaskRequest) Reset() { *m = GetTaskRequest{} } func (*GetTaskRequest) ProtoMessage() {} -func (*GetTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{6} } +func (*GetTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} } type GetTaskResponse struct { Task *containerd_v1_types.Task `protobuf:"bytes,1,opt,name=task" json:"task,omitempty"` @@ -152,7 +162,7 @@ type GetTaskResponse struct { func (m *GetTaskResponse) Reset() { *m = GetTaskResponse{} } func (*GetTaskResponse) ProtoMessage() {} -func (*GetTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} } +func (*GetTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} } type ListTasksRequest struct { Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` @@ -160,7 +170,7 @@ type ListTasksRequest struct { func (m *ListTasksRequest) Reset() { *m = ListTasksRequest{} } func (*ListTasksRequest) ProtoMessage() {} -func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} } +func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{9} } type ListTasksResponse struct { Tasks []*containerd_v1_types.Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` @@ -168,7 +178,7 @@ type ListTasksResponse struct { func (m *ListTasksResponse) Reset() { *m = ListTasksResponse{} } func (*ListTasksResponse) ProtoMessage() {} -func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{9} } +func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} } type KillRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -179,7 +189,7 @@ type KillRequest struct { func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} -func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} } +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{11} } type ExecProcessRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -197,15 +207,14 @@ type ExecProcessRequest struct { func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} } func (*ExecProcessRequest) ProtoMessage() {} -func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{11} } +func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{12} } type ExecProcessResponse struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` } func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} } func (*ExecProcessResponse) ProtoMessage() {} -func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{12} } +func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{13} } type ResizePtyRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -216,7 +225,7 @@ type ResizePtyRequest struct { func (m *ResizePtyRequest) Reset() { *m = ResizePtyRequest{} } func (*ResizePtyRequest) ProtoMessage() {} -func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{13} } +func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{14} } type CloseIORequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -226,7 +235,7 @@ type CloseIORequest struct { func (m *CloseIORequest) Reset() { *m = CloseIORequest{} } func (*CloseIORequest) ProtoMessage() {} -func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{14} } +func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{15} } type PauseTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -234,7 +243,7 @@ type PauseTaskRequest struct { func (m *PauseTaskRequest) Reset() { *m = PauseTaskRequest{} } func (*PauseTaskRequest) ProtoMessage() {} -func (*PauseTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{15} } +func (*PauseTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{16} } type ResumeTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -242,7 +251,7 @@ type ResumeTaskRequest struct { func (m *ResumeTaskRequest) Reset() { *m = ResumeTaskRequest{} } func (*ResumeTaskRequest) ProtoMessage() {} -func (*ResumeTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{16} } +func (*ResumeTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{17} } type ListPidsRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -250,7 +259,7 @@ type ListPidsRequest struct { func (m *ListPidsRequest) Reset() { *m = ListPidsRequest{} } func (*ListPidsRequest) ProtoMessage() {} -func (*ListPidsRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{17} } +func (*ListPidsRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{18} } type ListPidsResponse struct { Pids []uint32 `protobuf:"varint,1,rep,packed,name=pids" json:"pids,omitempty"` @@ -258,7 +267,7 @@ type ListPidsResponse struct { func (m *ListPidsResponse) Reset() { *m = ListPidsResponse{} } func (*ListPidsResponse) ProtoMessage() {} -func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{18} } +func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{19} } type CheckpointTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -268,7 +277,7 @@ type CheckpointTaskRequest struct { func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } func (*CheckpointTaskRequest) ProtoMessage() {} -func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{19} } +func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} } type CheckpointTaskResponse struct { Descriptors []*containerd_types1.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` @@ -276,7 +285,7 @@ type CheckpointTaskResponse struct { func (m *CheckpointTaskResponse) Reset() { *m = CheckpointTaskResponse{} } func (*CheckpointTaskResponse) ProtoMessage() {} -func (*CheckpointTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} } +func (*CheckpointTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{21} } type UpdateTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -285,12 +294,13 @@ type UpdateTaskRequest struct { func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} } func (*UpdateTaskRequest) ProtoMessage() {} -func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{21} } +func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{22} } func init() { proto.RegisterType((*CreateTaskRequest)(nil), "containerd.services.tasks.v1.CreateTaskRequest") proto.RegisterType((*CreateTaskResponse)(nil), "containerd.services.tasks.v1.CreateTaskResponse") - proto.RegisterType((*StartTaskRequest)(nil), "containerd.services.tasks.v1.StartTaskRequest") + proto.RegisterType((*StartRequest)(nil), "containerd.services.tasks.v1.StartRequest") + proto.RegisterType((*StartResponse)(nil), "containerd.services.tasks.v1.StartResponse") proto.RegisterType((*DeleteTaskRequest)(nil), "containerd.services.tasks.v1.DeleteTaskRequest") proto.RegisterType((*DeleteResponse)(nil), "containerd.services.tasks.v1.DeleteResponse") proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.services.tasks.v1.DeleteProcessRequest") @@ -325,8 +335,8 @@ const _ = grpc.SupportPackageIsVersion4 type TasksClient interface { // Create a task. Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) - // Start a task. - Start(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + // Start a process. + Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) // Delete a task and on disk state. Delete(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*DeleteResponse, error) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) @@ -334,7 +344,7 @@ type TasksClient interface { List(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) // Kill a task or process. Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) + Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Pause(ctx context.Context, in *PauseTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) @@ -361,8 +371,8 @@ func (c *tasksClient) Create(ctx context.Context, in *CreateTaskRequest, opts .. return out, nil } -func (c *tasksClient) Start(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - out := new(google_protobuf.Empty) +func (c *tasksClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { + out := new(StartResponse) err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Start", in, out, c.cc, opts...) if err != nil { return nil, err @@ -415,8 +425,8 @@ func (c *tasksClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.Ca return out, nil } -func (c *tasksClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) { - out := new(ExecProcessResponse) +func (c *tasksClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + out := new(google_protobuf.Empty) err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Exec", in, out, c.cc, opts...) if err != nil { return nil, err @@ -492,8 +502,8 @@ func (c *tasksClient) Update(ctx context.Context, in *UpdateTaskRequest, opts .. type TasksServer interface { // Create a task. Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) - // Start a task. - Start(context.Context, *StartTaskRequest) (*google_protobuf.Empty, error) + // Start a process. + Start(context.Context, *StartRequest) (*StartResponse, error) // Delete a task and on disk state. Delete(context.Context, *DeleteTaskRequest) (*DeleteResponse, error) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) @@ -501,7 +511,7 @@ type TasksServer interface { List(context.Context, *ListTasksRequest) (*ListTasksResponse, error) // Kill a task or process. Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) - Exec(context.Context, *ExecProcessRequest) (*ExecProcessResponse, error) + Exec(context.Context, *ExecProcessRequest) (*google_protobuf.Empty, error) ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf.Empty, error) CloseIO(context.Context, *CloseIORequest) (*google_protobuf.Empty, error) Pause(context.Context, *PauseTaskRequest) (*google_protobuf.Empty, error) @@ -534,7 +544,7 @@ func _Tasks_Create_Handler(srv interface{}, ctx context.Context, dec func(interf } func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartTaskRequest) + in := new(StartRequest) if err := dec(in); err != nil { return nil, err } @@ -546,7 +556,7 @@ func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: "/containerd.services.tasks.v1.Tasks/Start", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Start(ctx, req.(*StartTaskRequest)) + return srv.(TasksServer).Start(ctx, req.(*StartRequest)) } return interceptor(ctx, in, info, handler) } @@ -967,7 +977,7 @@ func (m *CreateTaskResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *StartTaskRequest) Marshal() (dAtA []byte, err error) { +func (m *StartRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -977,7 +987,7 @@ func (m *StartTaskRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StartTaskRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -988,6 +998,35 @@ func (m *StartTaskRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } + if len(m.ExecID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID))) + i += copy(dAtA[i:], m.ExecID) + } + 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 m.Pid != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) + } return i, nil } @@ -1321,11 +1360,6 @@ func (m *ExecProcessResponse) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Pid != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) - } return i, nil } @@ -1699,13 +1733,26 @@ func (m *CreateTaskResponse) Size() (n int) { return n } -func (m *StartTaskRequest) Size() (n int) { +func (m *StartRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { n += 1 + l + sovTasks(uint64(l)) } + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) + } + return n +} + +func (m *StartResponse) Size() (n int) { + var l int + _ = l + if m.Pid != 0 { + n += 1 + sovTasks(uint64(m.Pid)) + } return n } @@ -1849,9 +1896,6 @@ func (m *ExecProcessRequest) Size() (n int) { func (m *ExecProcessResponse) Size() (n int) { var l int _ = l - if m.Pid != 0 { - n += 1 + sovTasks(uint64(m.Pid)) - } return n } @@ -2020,12 +2064,23 @@ func (this *CreateTaskResponse) String() string { }, "") return s } -func (this *StartTaskRequest) String() string { +func (this *StartRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&StartTaskRequest{`, + s := strings.Join([]string{`&StartRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, + `}`, + }, "") + return s +} +func (this *StartResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StartResponse{`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s @@ -2138,7 +2193,6 @@ func (this *ExecProcessResponse) String() string { return "nil" } s := strings.Join([]string{`&ExecProcessResponse{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s @@ -2630,7 +2684,7 @@ func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *StartTaskRequest) Unmarshal(dAtA []byte) error { +func (m *StartRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2653,10 +2707,10 @@ func (m *StartTaskRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StartTaskRequest: wiretype end group for non-group") + return fmt.Errorf("proto: StartRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StartTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StartRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2688,6 +2742,104 @@ func (m *StartTaskRequest) Unmarshal(dAtA []byte) error { } 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 ErrIntOverflowTasks + } + 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 ErrInvalidLengthTasks + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExecID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTasks(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTasks + } + 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 ErrIntOverflowTasks + } + 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 != 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 ErrIntOverflowTasks + } + 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 := skipTasks(dAtA[iNdEx:]) @@ -3789,25 +3941,6 @@ func (m *ExecProcessResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire) } 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 ErrIntOverflowTasks - } - 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 := skipTasks(dAtA[iNdEx:]) @@ -4896,80 +5029,81 @@ func init() { } var fileDescriptorTasks = []byte{ - // 1200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4d, 0x6f, 0x1b, 0xc5, - 0x1b, 0xef, 0xfa, 0x65, 0x63, 0x3f, 0xfe, 0xa7, 0x49, 0xf6, 0x1f, 0x82, 0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, 0x7f, 0x38, 0x21, 0xc4, 0xd7, 0x35, 0x2f, 0xf3, 0xe3, 0x9b, 0x81, 0xd4, 0xc5, 0x4f, - 0x40, 0x97, 0x9c, 0x3e, 0x29, 0x6c, 0x43, 0xcc, 0x3f, 0x2a, 0x6c, 0x9b, 0xdf, 0x9e, 0xbf, 0x2a, - 0xdd, 0xf9, 0xfd, 0x55, 0xe9, 0xce, 0x4f, 0xbd, 0x92, 0x76, 0xde, 0x2b, 0x69, 0xbf, 0xf5, 0x4a, - 0xda, 0xdf, 0xbd, 0x92, 0xf6, 0xec, 0xf1, 0xeb, 0xfd, 0x28, 0xf2, 0x48, 0x2c, 0x0e, 0x74, 0x71, - 0xcf, 0xc3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xc3, 0x21, 0xef, 0x5b, 0x11, 0x00, 0x00, + // 1211 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5d, 0x6f, 0x1b, 0x45, + 0x17, 0xee, 0xfa, 0x63, 0x63, 0x1f, 0x37, 0x6d, 0x3c, 0x6f, 0x9a, 0xd7, 0x5d, 0x2a, 0x3b, 0x2c, + 0x12, 0x32, 0x85, 0xec, 0x52, 0x17, 0x71, 0x41, 0x2b, 0x44, 0x13, 0x87, 0xc8, 0x02, 0xd4, 0x74, + 0x53, 0x10, 0xea, 0x8d, 0xd9, 0x78, 0x27, 0xce, 0x28, 0xf6, 0xce, 0x76, 0x67, 0x9c, 0x26, 0x70, + 0x01, 0x3f, 0xa1, 0xb7, 0x5c, 0xc0, 0xef, 0xc9, 0x25, 0x97, 0x08, 0xa1, 0x40, 0xfd, 0x2f, 0xb8, + 0x43, 0x3b, 0x33, 0xde, 0x6c, 0xec, 0xf8, 0x23, 0x75, 0xc3, 0x4d, 0x32, 0x33, 0x7b, 0x9e, 0x33, + 0x33, 0xcf, 0x39, 0xf3, 0x9c, 0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07, 0x62, 0xb0, 0xab, 0x8b, 0x7d, 0xee, 0xff, 0x1b, 0x00, + 0x00, 0xff, 0xff, 0x55, 0x8b, 0x54, 0x53, 0x83, 0x11, 0x00, 0x00, } diff --git a/api/services/tasks/v1/tasks.proto b/api/services/tasks/v1/tasks.proto index b6a8edb5c..a36267900 100644 --- a/api/services/tasks/v1/tasks.proto +++ b/api/services/tasks/v1/tasks.proto @@ -16,8 +16,8 @@ service Tasks { // Create a task. rpc Create(CreateTaskRequest) returns (CreateTaskResponse); - // Start a task. - rpc Start(StartTaskRequest) returns (google.protobuf.Empty); + // Start a process. + rpc Start(StartRequest) returns (StartResponse); // Delete a task and on disk state. rpc Delete(DeleteTaskRequest) returns (DeleteResponse); @@ -31,7 +31,7 @@ service Tasks { // Kill a task or process. 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); @@ -74,8 +74,13 @@ message CreateTaskResponse { uint32 pid = 2; } -message StartTaskRequest { +message StartRequest { string container_id = 1; + string exec_id = 2; +} + +message StartResponse { + uint32 pid = 1; } message DeleteTaskRequest { @@ -132,7 +137,6 @@ message ExecProcessRequest { } message ExecProcessResponse { - uint32 pid = 1; } message ResizePtyRequest { diff --git a/container_test.go b/container_test.go index 2b423285f..a44c1f263 100644 --- a/container_test.go +++ b/container_test.go @@ -869,7 +869,7 @@ func TestContainerExecNoBinaryExists(t *testing.T) { close(finished) }() - // start an exec process without running the original container process info + // start an exec process without running the original container process processSpec := spec.Process processSpec.Args = []string{ "none", diff --git a/linux/process.go b/linux/process.go index 3c22574fc..337bc41bb 100644 --- a/linux/process.go +++ b/linux/process.go @@ -79,7 +79,17 @@ func (p *Process) CloseIO(ctx context.Context) error { Stdin: true, }) if err != nil { - err = errdefs.FromGRPC(err) + return errdefs.FromGRPC(err) } - return err + return nil +} + +func (p *Process) Start(ctx context.Context) error { + _, err := p.t.shim.Start(ctx, &shim.StartRequest{ + ID: p.id, + }) + if err != nil { + return errdefs.FromGRPC(err) + } + return nil } diff --git a/linux/task.go b/linux/task.go index 51a85079b..b0aadb6e5 100644 --- a/linux/task.go +++ b/linux/task.go @@ -118,11 +118,6 @@ func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt if _, err := t.shim.Exec(ctx, request); err != nil { return nil, errdefs.FromGRPC(err) } - if _, err := t.shim.Start(ctx, &shim.StartRequest{ - ID: id, - }); err != nil { - return nil, errdefs.FromGRPC(err) - } return &Process{ id: id, t: t, diff --git a/process.go b/process.go index 440be26ea..0ca6f23a6 100644 --- a/process.go +++ b/process.go @@ -31,27 +31,17 @@ func (p *process) Pid() uint32 { // Start starts the exec process func (p *process) Start(ctx context.Context) error { - any, err := typeurl.MarshalAny(p.spec) - if err != nil { - return err - } - request := &tasks.ExecProcessRequest{ + r, err := p.task.client.TaskService().Start(ctx, &tasks.StartRequest{ ContainerID: p.task.id, ExecID: p.id, - Terminal: p.io.Terminal, - Stdin: p.io.Stdin, - Stdout: p.io.Stdout, - Stderr: p.io.Stderr, - Spec: any, - } - response, err := p.task.client.TaskService().Exec(ctx, request) + }) if err != nil { p.io.Cancel() p.io.Wait() p.io.Close() return err } - p.pid = response.Pid + p.pid = r.Pid return nil } diff --git a/runtime/task.go b/runtime/task.go index 8d3c5b5c5..612d54523 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -23,6 +23,8 @@ type Process interface { ResizePty(context.Context, ConsoleSize) error // CloseStdin closes the processes stdin CloseIO(context.Context) error + // Start the container's user defined process + Start(context.Context) error } type Task interface { @@ -30,8 +32,6 @@ type Task interface { // Information of the container Info() TaskInfo - // Start the container's user defined process - Start(context.Context) error // Pause pauses the container process Pause(context.Context) error // Resume unpauses the container process diff --git a/services/tasks/service.go b/services/tasks/service.go index a6764ccdb..9ceadb5a6 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -152,16 +152,27 @@ func (s *Service) Create(ctx context.Context, r *api.CreateTaskRequest) (*api.Cr }, nil } -func (s *Service) Start(ctx context.Context, r *api.StartTaskRequest) (*google_protobuf.Empty, error) { +func (s *Service) Start(ctx context.Context, r *api.StartRequest) (*api.StartResponse, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err } - if err := t.Start(ctx); err != nil { + p := runtime.Process(t) + if r.ExecID != "" { + if p, err = t.Process(ctx, r.ExecID); err != nil { + return nil, err + } + } + if err := p.Start(ctx); err != nil { return nil, err } - - return empty, nil + state, err := p.State(ctx) + if err != nil { + return nil, err + } + return &api.StartResponse{ + Pid: state.Pid, + }, nil } func (s *Service) Delete(ctx context.Context, r *api.DeleteTaskRequest) (*api.DeleteResponse, error) { @@ -317,7 +328,7 @@ func (s *Service) ListPids(ctx context.Context, r *api.ListPidsRequest) (*api.Li }, nil } -func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.ExecProcessResponse, error) { +func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*google_protobuf.Empty, error) { if r.ExecID == "" { return nil, grpc.Errorf(codes.InvalidArgument, "exec id cannot be empty") } @@ -325,7 +336,7 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.Exe if err != nil { return nil, err } - process, err := t.Exec(ctx, r.ExecID, runtime.ExecOpts{ + if _, err := t.Exec(ctx, r.ExecID, runtime.ExecOpts{ Spec: r.Spec, IO: runtime.IO{ Stdin: r.Stdin, @@ -333,17 +344,10 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.Exe Stderr: r.Stderr, Terminal: r.Terminal, }, - }) - if err != nil { + }); err != nil { return nil, err } - state, err := process.State(ctx) - if err != nil { - return nil, err - } - return &api.ExecProcessResponse{ - Pid: state.Pid, - }, nil + return empty, nil } func (s *Service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*google_protobuf.Empty, error) { diff --git a/task.go b/task.go index 640506497..4cb47d931 100644 --- a/task.go +++ b/task.go @@ -118,7 +118,7 @@ func (t *task) Start(ctx context.Context) error { t.pid = response.Pid return nil } - _, err := t.client.TaskService().Start(ctx, &tasks.StartTaskRequest{ + _, err := t.client.TaskService().Start(ctx, &tasks.StartRequest{ ContainerID: t.id, }) if err != nil { @@ -214,6 +214,25 @@ func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreat if err != nil { return nil, err } + any, err := typeurl.MarshalAny(spec) + if err != nil { + return nil, err + } + request := &tasks.ExecProcessRequest{ + ContainerID: t.id, + ExecID: id, + Terminal: i.Terminal, + Stdin: i.Stdin, + Stdout: i.Stdout, + Stderr: i.Stderr, + Spec: any, + } + if _, err := t.client.TaskService().Exec(ctx, request); err != nil { + i.Cancel() + i.Wait() + i.Close() + return nil, err + } return &process{ id: id, task: t, From 9f08965699189fafc5315f5641af643d1b3f0dfc Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 14:14:11 -0400 Subject: [PATCH 03/10] Change Exited/Status to SetExited/ExitStatus Signed-off-by: Michael Crosby --- linux/shim/exec.go | 4 ++-- linux/shim/init.go | 4 ++-- linux/shim/process.go | 8 ++++---- linux/shim/service.go | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/linux/shim/exec.go b/linux/shim/exec.go index 950df8ae4..292d378bb 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -76,7 +76,7 @@ func (e *execProcess) Pid() int { return e.pid } -func (e *execProcess) Status() int { +func (e *execProcess) ExitStatus() int { return e.status } @@ -84,7 +84,7 @@ func (e *execProcess) ExitedAt() time.Time { return e.exited } -func (e *execProcess) Exited(status int) { +func (e *execProcess) SetExited(status int) { e.status = status e.exited = time.Now() e.parent.platform.shutdownConsole(context.Background(), e.console) diff --git a/linux/shim/init.go b/linux/shim/init.go index 452c1ff53..c32494d98 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -201,7 +201,7 @@ func (p *initProcess) Pid() int { return p.pid } -func (p *initProcess) Status() int { +func (p *initProcess) ExitStatus() int { return p.status } @@ -225,7 +225,7 @@ func (p *initProcess) Start(context context.Context) error { return p.runtimeError(err, "OCI runtime start failed") } -func (p *initProcess) Exited(status int) { +func (p *initProcess) SetExited(status int) { p.mu.Lock() p.status = status p.exited = time.Now() diff --git a/linux/shim/process.go b/linux/shim/process.go index c7550011a..5f0a1bb3e 100644 --- a/linux/shim/process.go +++ b/linux/shim/process.go @@ -24,10 +24,10 @@ type process interface { Pid() int // Resize resizes the process console Resize(ws console.WinSize) error - // Exited sets the exit status for the process - Exited(status int) - // Status returns the exit status - Status() int + // SetExited sets the exit status for the process + SetExited(status int) + // ExitStatus returns the exit status + ExitStatus() int // ExitedAt is the time the process exited ExitedAt() time.Time // Delete deletes the process and its resourcess diff --git a/linux/shim/service.go b/linux/shim/service.go index 2147cf280..682e76c38 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -152,12 +152,12 @@ func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimap s.mu.Unlock() s.events <- &eventsapi.TaskDelete{ ContainerID: s.id, - ExitStatus: uint32(p.Status()), + ExitStatus: uint32(p.ExitStatus()), ExitedAt: p.ExitedAt(), Pid: uint32(p.Pid()), } return &shimapi.DeleteResponse{ - ExitStatus: uint32(p.Status()), + ExitStatus: uint32(p.ExitStatus()), ExitedAt: p.ExitedAt(), Pid: uint32(p.Pid()), }, nil @@ -182,7 +182,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq delete(s.processes, p.ID()) s.mu.Unlock() return &shimapi.DeleteResponse{ - ExitStatus: uint32(p.Status()), + ExitStatus: uint32(p.ExitStatus()), ExitedAt: p.ExitedAt(), Pid: uint32(p.Pid()), }, nil @@ -362,7 +362,7 @@ func (s *Service) Update(ctx context.Context, r *shimapi.UpdateTaskRequest) (*go func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) { status := <-cmd.ExitCh - p.Exited(status) + p.SetExited(status) reaper.Default.Delete(pid) s.events <- &eventsapi.TaskExit{ From 2974e485f32eacfddb06852efd7ef4b235a7b4eb Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 15:54:34 -0400 Subject: [PATCH 04/10] Add no-criu flag for running tests Signed-off-by: Michael Crosby --- client_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client_test.go b/client_test.go index 379d876ac..68cc75612 100644 --- a/client_test.go +++ b/client_test.go @@ -21,12 +21,14 @@ import ( var ( address string noDaemon bool + noCriu bool supportsCriu bool ) func init() { flag.StringVar(&address, "address", defaultAddress, "The address to the containerd socket for use in the tests") flag.BoolVar(&noDaemon, "no-daemon", false, "Do not start a dedicated daemon for the tests") + flag.BoolVar(&noCriu, "no-criu", false, "Do not run the checkpoint tests") flag.Parse() } @@ -43,7 +45,7 @@ func TestMain(m *testing.M) { testutil.RequiresRootM() // check if criu is installed on the system _, err := exec.LookPath("criu") - supportsCriu = err == nil + supportsCriu = err == nil && !noCriu var ( cmd *exec.Cmd From 504033e37386ad060a18865196c4f79ddf25a920 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 15:56:56 -0400 Subject: [PATCH 05/10] Add Get of task and process state Signed-off-by: Michael Crosby --- api/services/tasks/v1/tasks.pb.go | 291 +++++++++++++++++------------- api/services/tasks/v1/tasks.proto | 11 +- api/types/task/task.pb.go | 201 ++++++++++----------- api/types/task/task.proto | 10 +- container.go | 20 +- linux/shim/exec.go | 39 +++- linux/shim/init.go | 6 +- linux/shim/process.go | 2 + linux/shim/service.go | 5 +- linux/task.go | 1 - process.go | 13 ++ services/tasks/service.go | 24 ++- task.go | 5 +- 13 files changed, 358 insertions(+), 270 deletions(-) diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index 1b6513899..1b38aaa25 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -16,8 +16,8 @@ DeleteTaskRequest DeleteResponse DeleteProcessRequest - GetTaskRequest - GetTaskResponse + GetRequest + GetResponse ListTasksRequest ListTasksResponse KillRequest @@ -148,21 +148,22 @@ func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRe func (*DeleteProcessRequest) ProtoMessage() {} func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{6} } -type GetTaskRequest struct { +type GetRequest 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"` } -func (m *GetTaskRequest) Reset() { *m = GetTaskRequest{} } -func (*GetTaskRequest) ProtoMessage() {} -func (*GetTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} } +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} } -type GetTaskResponse struct { - Task *containerd_v1_types.Task `protobuf:"bytes,1,opt,name=task" json:"task,omitempty"` +type GetResponse struct { + Process *containerd_v1_types.Process `protobuf:"bytes,1,opt,name=process" json:"process,omitempty"` } -func (m *GetTaskResponse) Reset() { *m = GetTaskResponse{} } -func (*GetTaskResponse) ProtoMessage() {} -func (*GetTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} } +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} } type ListTasksRequest struct { Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` @@ -173,7 +174,7 @@ func (*ListTasksRequest) ProtoMessage() {} func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{9} } type ListTasksResponse struct { - Tasks []*containerd_v1_types.Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` + Tasks []*containerd_v1_types.Process `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` } func (m *ListTasksResponse) Reset() { *m = ListTasksResponse{} } @@ -304,8 +305,8 @@ func init() { proto.RegisterType((*DeleteTaskRequest)(nil), "containerd.services.tasks.v1.DeleteTaskRequest") proto.RegisterType((*DeleteResponse)(nil), "containerd.services.tasks.v1.DeleteResponse") proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.services.tasks.v1.DeleteProcessRequest") - proto.RegisterType((*GetTaskRequest)(nil), "containerd.services.tasks.v1.GetTaskRequest") - proto.RegisterType((*GetTaskResponse)(nil), "containerd.services.tasks.v1.GetTaskResponse") + proto.RegisterType((*GetRequest)(nil), "containerd.services.tasks.v1.GetRequest") + proto.RegisterType((*GetResponse)(nil), "containerd.services.tasks.v1.GetResponse") proto.RegisterType((*ListTasksRequest)(nil), "containerd.services.tasks.v1.ListTasksRequest") proto.RegisterType((*ListTasksResponse)(nil), "containerd.services.tasks.v1.ListTasksResponse") proto.RegisterType((*KillRequest)(nil), "containerd.services.tasks.v1.KillRequest") @@ -340,7 +341,7 @@ type TasksClient interface { // Delete a task and on disk state. Delete(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*DeleteResponse, error) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - Get(ctx context.Context, in *GetTaskRequest, opts ...grpc.CallOption) (*GetTaskResponse, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) List(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) // Kill a task or process. Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) @@ -398,8 +399,8 @@ func (c *tasksClient) DeleteProcess(ctx context.Context, in *DeleteProcessReques return out, nil } -func (c *tasksClient) Get(ctx context.Context, in *GetTaskRequest, opts ...grpc.CallOption) (*GetTaskResponse, error) { - out := new(GetTaskResponse) +func (c *tasksClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Get", in, out, c.cc, opts...) if err != nil { return nil, err @@ -507,7 +508,7 @@ type TasksServer interface { // Delete a task and on disk state. Delete(context.Context, *DeleteTaskRequest) (*DeleteResponse, error) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) - Get(context.Context, *GetTaskRequest) (*GetTaskResponse, error) + Get(context.Context, *GetRequest) (*GetResponse, error) List(context.Context, *ListTasksRequest) (*ListTasksResponse, error) // Kill a task or process. Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) @@ -598,7 +599,7 @@ func _Tasks_DeleteProcess_Handler(srv interface{}, ctx context.Context, dec func } func _Tasks_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTaskRequest) + in := new(GetRequest) if err := dec(in); err != nil { return nil, err } @@ -610,7 +611,7 @@ func _Tasks_Get_Handler(srv interface{}, ctx context.Context, dec func(interface FullMethod: "/containerd.services.tasks.v1.Tasks/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Get(ctx, req.(*GetTaskRequest)) + return srv.(TasksServer).Get(ctx, req.(*GetRequest)) } return interceptor(ctx, in, info, handler) } @@ -1126,7 +1127,7 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *GetTaskRequest) Marshal() (dAtA []byte, err error) { +func (m *GetRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1136,7 +1137,7 @@ func (m *GetTaskRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetTaskRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1147,10 +1148,16 @@ func (m *GetTaskRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } + if len(m.ExecID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID))) + i += copy(dAtA[i:], m.ExecID) + } return i, nil } -func (m *GetTaskResponse) Marshal() (dAtA []byte, err error) { +func (m *GetResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1160,16 +1167,16 @@ func (m *GetTaskResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetTaskResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l - if m.Task != nil { + if m.Process != nil { dAtA[i] = 0xa i++ - i = encodeVarintTasks(dAtA, i, uint64(m.Task.Size())) - n4, err := m.Task.MarshalTo(dAtA[i:]) + i = encodeVarintTasks(dAtA, i, uint64(m.Process.Size())) + n4, err := m.Process.MarshalTo(dAtA[i:]) if err != nil { return 0, err } @@ -1798,21 +1805,25 @@ func (m *DeleteProcessRequest) Size() (n int) { return n } -func (m *GetTaskRequest) Size() (n int) { +func (m *GetRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { n += 1 + l + sovTasks(uint64(l)) } + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) + } return n } -func (m *GetTaskResponse) Size() (n int) { +func (m *GetResponse) Size() (n int) { var l int _ = l - if m.Task != nil { - l = m.Task.Size() + if m.Process != nil { + l = m.Process.Size() n += 1 + l + sovTasks(uint64(l)) } return n @@ -2119,22 +2130,23 @@ func (this *DeleteProcessRequest) String() string { }, "") return s } -func (this *GetTaskRequest) String() string { +func (this *GetRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&GetTaskRequest{`, + s := strings.Join([]string{`&GetRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `}`, }, "") return s } -func (this *GetTaskResponse) String() string { +func (this *GetResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&GetTaskResponse{`, - `Task:` + strings.Replace(fmt.Sprintf("%v", this.Task), "Task", "containerd_v1_types.Task", 1) + `,`, + s := strings.Join([]string{`&GetResponse{`, + `Process:` + strings.Replace(fmt.Sprintf("%v", this.Process), "Process", "containerd_v1_types.Process", 1) + `,`, `}`, }, "") return s @@ -2154,7 +2166,7 @@ func (this *ListTasksResponse) String() string { return "nil" } s := strings.Join([]string{`&ListTasksResponse{`, - `Tasks:` + strings.Replace(fmt.Sprintf("%v", this.Tasks), "Task", "containerd_v1_types.Task", 1) + `,`, + `Tasks:` + strings.Replace(fmt.Sprintf("%v", this.Tasks), "Process", "containerd_v1_types.Process", 1) + `,`, `}`, }, "") return s @@ -3195,7 +3207,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetTaskRequest) Unmarshal(dAtA []byte) error { +func (m *GetRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3218,10 +3230,10 @@ func (m *GetTaskRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetTaskRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3253,6 +3265,35 @@ func (m *GetTaskRequest) Unmarshal(dAtA []byte) error { } 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 ErrIntOverflowTasks + } + 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 ErrInvalidLengthTasks + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExecID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTasks(dAtA[iNdEx:]) @@ -3274,7 +3315,7 @@ func (m *GetTaskRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetTaskResponse) Unmarshal(dAtA []byte) error { +func (m *GetResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3297,15 +3338,15 @@ func (m *GetTaskResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetTaskResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Process", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3329,10 +3370,10 @@ func (m *GetTaskResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Task == nil { - m.Task = &containerd_v1_types.Task{} + if m.Process == nil { + m.Process = &containerd_v1_types.Process{} } - if err := m.Task.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Process.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3491,7 +3532,7 @@ func (m *ListTasksResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tasks = append(m.Tasks, &containerd_v1_types.Task{}) + m.Tasks = append(m.Tasks, &containerd_v1_types.Process{}) if err := m.Tasks[len(m.Tasks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5029,81 +5070,81 @@ func init() { } var fileDescriptorTasks = []byte{ - // 1211 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5d, 0x6f, 0x1b, 0x45, - 0x17, 0xee, 0xfa, 0x63, 0x63, 0x1f, 0x37, 0x6d, 0x3c, 0x6f, 0x9a, 0xd7, 0x5d, 0x2a, 0x3b, 0x2c, - 0x12, 0x32, 0x85, 0xec, 0x52, 0x17, 0x71, 0x41, 0x2b, 0x44, 0x13, 0x87, 0xc8, 0x02, 0xd4, 0x74, - 0x53, 0x10, 0xea, 0x8d, 0xd9, 0x78, 0x27, 0xce, 0x28, 0xf6, 0xce, 0x76, 0x67, 0x9c, 0x26, 0x70, - 0x01, 0x3f, 0xa1, 0xb7, 0x5c, 0xc0, 0xef, 0xc9, 0x25, 0x97, 0x08, 0xa1, 0x40, 0xfd, 0x2f, 0xb8, - 0x43, 0x3b, 0x33, 0xde, 0x6c, 0xec, 0xf8, 0x23, 0x75, 0xc3, 0x4d, 0x32, 0x33, 0x7b, 0x9e, 0x33, - 0x33, 0xcf, 0x39, 0xf3, 0x9c, 0x93, 0xc0, 0x7a, 0x9b, 0xf0, 0xfd, 0xde, 0xae, 0xd5, 0xa2, 0x5d, - 0xbb, 0x45, 0x7d, 0xee, 0x12, 0x1f, 0x87, 0x5e, 0x72, 0xe8, 0x06, 0xc4, 0x66, 0x38, 0x3c, 0x24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x54, 0xf9, 0xd1, 0x7b, 0x93, - 0x81, 0x89, 0xee, 0xc0, 0x58, 0x19, 0xc9, 0xea, 0xcd, 0xe8, 0xcf, 0x3a, 0xb4, 0x0d, 0x99, 0x48, - 0xaa, 0xd1, 0x94, 0x7c, 0x1c, 0xad, 0xea, 0x63, 0x3d, 0xee, 0x40, 0x3e, 0x2e, 0x78, 0xd3, 0xa8, - 0x18, 0xae, 0x8c, 0x63, 0x9d, 0x3e, 0x86, 0x05, 0x55, 0xaa, 0xa6, 0x85, 0xf0, 0x7c, 0x45, 0x9b, - 0xe0, 0x30, 0x2b, 0x4a, 0xcf, 0xb4, 0x13, 0x0e, 0xd7, 0xa7, 0xb1, 0x0e, 0x9f, 0x80, 0x2e, 0x6b, - 0xd0, 0xb4, 0xc7, 0x33, 0x52, 0xa9, 0xc6, 0xba, 0x24, 0x90, 0x1b, 0x94, 0x11, 0xb4, 0x36, 0x3d, - 0x47, 0x12, 0x55, 0xcb, 0xb0, 0x66, 0x35, 0x57, 0x19, 0xf5, 0x02, 0x20, 0x21, 0xf4, 0xf7, 0xa7, - 0x50, 0x7c, 0x51, 0xc9, 0x32, 0x3e, 0xba, 0x1c, 0x48, 0x6d, 0xfc, 0x04, 0x74, 0xa9, 0xe4, 0xd3, - 0x68, 0x1b, 0xd1, 0xfb, 0x71, 0xb4, 0xad, 0x7f, 0x73, 0xf2, 0xaa, 0x7c, 0xed, 0xf7, 0x57, 0xe5, - 0x6b, 0x3f, 0xf5, 0xcb, 0xda, 0x49, 0xbf, 0xac, 0xfd, 0xd6, 0x2f, 0x6b, 0x7f, 0xf7, 0xcb, 0xda, - 0xb3, 0x87, 0xaf, 0xf7, 0xcf, 0x93, 0x07, 0x62, 0xb0, 0xab, 0x8b, 0x7d, 0xee, 0xff, 0x1b, 0x00, - 0x00, 0xff, 0xff, 0x55, 0x8b, 0x54, 0x53, 0x83, 0x11, 0x00, 0x00, + // 1207 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xef, 0xfa, 0x63, 0x6d, 0x3f, 0x37, 0x6d, 0x32, 0xa4, 0xc1, 0x2c, 0x95, 0x1d, 0x16, 0x09, + 0x99, 0x42, 0x77, 0xa9, 0x8b, 0x7a, 0xa0, 0x15, 0x52, 0x13, 0x87, 0xc8, 0x02, 0xd4, 0x74, 0x53, + 0x10, 0xca, 0xc5, 0x6c, 0xbc, 0x13, 0x67, 0x14, 0x7b, 0x77, 0xbb, 0x33, 0x4e, 0x13, 0x38, 0xc0, + 0x9f, 0xd0, 0x0b, 0x07, 0x2e, 0xfc, 0x3d, 0x39, 0x72, 0x44, 0x08, 0x05, 0xea, 0xff, 0x82, 0x1b, + 0x9a, 0x0f, 0x6f, 0x36, 0x76, 0xfc, 0x91, 0xba, 0xe1, 0x92, 0xcc, 0xcc, 0xbe, 0xaf, 0xf9, 0xbd, + 0x37, 0xbf, 0xf7, 0x12, 0x58, 0x6b, 0x13, 0xb6, 0xdf, 0xdb, 0xb5, 0x5a, 0x41, 0xd7, 0x6e, 0x05, + 0x3e, 0x73, 0x89, 0x8f, 0x23, 0x2f, 0xb9, 0x74, 0x43, 0x62, 0x53, 0x1c, 0x1d, 0x92, 0x16, 0xa6, + 0x36, 0x73, 0xe9, 0x01, 0xb5, 0x0f, 0xef, 0xc9, 0x85, 0x15, 0x46, 0x01, 0x0b, 0xd0, 0xed, 0x33, + 0x69, 0x6b, 0x20, 0x69, 0x49, 0x81, 0xc3, 0x7b, 0xc6, 0xbb, 0xed, 0x20, 0x68, 0x77, 0xb0, 0x2d, + 0x64, 0x77, 0x7b, 0x7b, 0x36, 0xee, 0x86, 0xec, 0x58, 0xaa, 0x1a, 0xef, 0x0c, 0x7f, 0x74, 0xfd, + 0xc1, 0xa7, 0xe5, 0x76, 0xd0, 0x0e, 0xc4, 0xd2, 0xe6, 0x2b, 0x75, 0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, 0xed, 0xf6, 0x68, 0x58, 0xf5, 0x18, 0x71, 0x27, 0x21, 0x8f, 0x2c, 0xc8, 0x05, 0x21, + 0x23, 0x81, 0x4f, 0x4b, 0x05, 0xa1, 0xba, 0x6c, 0x49, 0x34, 0xad, 0x01, 0x9a, 0xd6, 0x63, 0xff, + 0xd8, 0x19, 0x08, 0x99, 0x3b, 0x80, 0x92, 0x48, 0xd2, 0x30, 0xf0, 0x29, 0x7e, 0x2d, 0x28, 0x17, + 0x21, 0x1d, 0x12, 0xaf, 0x94, 0x5a, 0xd5, 0xaa, 0x0b, 0x0e, 0x5f, 0x9a, 0x6d, 0xb8, 0xbe, 0xcd, + 0xdc, 0x88, 0xcd, 0x93, 0xa0, 0xf7, 0x21, 0x87, 0x8f, 0x70, 0xab, 0xa9, 0x2c, 0x17, 0xd6, 0xa0, + 0x7f, 0x5a, 0xd1, 0x37, 0x8e, 0x70, 0xab, 0x51, 0x77, 0x74, 0xfe, 0xa9, 0xe1, 0x99, 0xef, 0xc1, + 0x82, 0x72, 0xa4, 0xe2, 0x57, 0xb1, 0x68, 0x67, 0xb1, 0x6c, 0xc2, 0x52, 0x1d, 0x77, 0xf0, 0xdc, + 0x15, 0x63, 0xfe, 0xa6, 0xc1, 0x0d, 0x69, 0x29, 0xf6, 0xb6, 0x02, 0xa9, 0x58, 0x59, 0xef, 0x9f, + 0x56, 0x52, 0x8d, 0xba, 0x93, 0x22, 0x17, 0x20, 0x82, 0x2a, 0x50, 0xc4, 0x47, 0x84, 0x35, 0x29, + 0x73, 0x59, 0x8f, 0xd7, 0x1c, 0xff, 0x02, 0xfc, 0x68, 0x5b, 0x9c, 0xa0, 0xc7, 0x50, 0xe0, 0x3b, + 0xec, 0x35, 0x5d, 0x26, 0x4a, 0xac, 0x58, 0x33, 0x46, 0x12, 0xf8, 0x6c, 0xf0, 0x1c, 0xd6, 0xf2, + 0x27, 0xa7, 0x95, 0x6b, 0x2f, 0xff, 0xae, 0x68, 0x4e, 0x5e, 0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, 0xf6, 0x68, 0x46, + 0x3a, 0xd4, 0x58, 0x93, 0x04, 0xf2, 0x83, 0xf6, 0x81, 0xee, 0x4e, 0xaf, 0x91, 0x44, 0xb7, 0x32, + 0xac, 0x59, 0xc5, 0x55, 0x45, 0xbd, 0x00, 0x48, 0x10, 0xfc, 0xfd, 0x29, 0x10, 0x5f, 0xd4, 0xaa, + 0x8c, 0x4f, 0x2f, 0xa7, 0xa4, 0x1c, 0x3f, 0x05, 0x5d, 0x32, 0xf8, 0x34, 0xd8, 0x46, 0x78, 0x7e, + 0x1c, 0x6c, 0x6b, 0xdf, 0x9e, 0xbc, 0x2a, 0x5f, 0xfb, 0xe3, 0x55, 0xf9, 0xda, 0xcf, 0xfd, 0xb2, + 0x76, 0xd2, 0x2f, 0x6b, 0xbf, 0xf7, 0xcb, 0xda, 0x3f, 0xfd, 0xb2, 0xb6, 0xf3, 0xe8, 0xf5, 0xfe, + 0xbb, 0xf2, 0x50, 0x2c, 0x76, 0x75, 0xe1, 0xe7, 0xfe, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, + 0xec, 0xf8, 0x44, 0xa4, 0x11, 0x00, 0x00, } diff --git a/api/services/tasks/v1/tasks.proto b/api/services/tasks/v1/tasks.proto index a36267900..d0778ba94 100644 --- a/api/services/tasks/v1/tasks.proto +++ b/api/services/tasks/v1/tasks.proto @@ -24,7 +24,7 @@ service Tasks { rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse); - rpc Get(GetTaskRequest) returns (GetTaskResponse); + rpc Get(GetRequest) returns (GetResponse); rpc List(ListTasksRequest) returns (ListTasksResponse); @@ -99,12 +99,13 @@ message DeleteProcessRequest { string exec_id = 2; } -message GetTaskRequest { +message GetRequest { string container_id = 1; + string exec_id = 2; } -message GetTaskResponse { - containerd.v1.types.Task task = 1; +message GetResponse { + containerd.v1.types.Process process = 1; } message ListTasksRequest { @@ -112,7 +113,7 @@ message ListTasksRequest { } message ListTasksResponse { - repeated containerd.v1.types.Task tasks = 1; + repeated containerd.v1.types.Process tasks = 1; } message KillRequest { diff --git a/api/types/task/task.pb.go b/api/types/task/task.pb.go index 8d9b757bb..cc9bb847f 100644 --- a/api/types/task/task.pb.go +++ b/api/types/task/task.pb.go @@ -9,7 +9,7 @@ github.com/containerd/containerd/api/types/task/task.proto It has these top-level messages: - Task + Process */ package task @@ -17,7 +17,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import google_protobuf1 "github.com/gogo/protobuf/types" +import _ "github.com/gogo/protobuf/types" import strings "strings" import reflect "reflect" @@ -65,26 +65,26 @@ func (x Status) String() string { } func (Status) EnumDescriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } -type Task 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"` - Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` - Spec *google_protobuf1.Any `protobuf:"bytes,4,opt,name=spec" json:"spec,omitempty"` - Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` - Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` +type Process struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ID string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` + Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` } -func (m *Task) Reset() { *m = Task{} } -func (*Task) ProtoMessage() {} -func (*Task) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } +func (m *Process) Reset() { *m = Process{} } +func (*Process) ProtoMessage() {} +func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } func init() { - proto.RegisterType((*Task)(nil), "containerd.v1.types.Task") + proto.RegisterType((*Process)(nil), "containerd.v1.types.Process") proto.RegisterEnum("containerd.v1.types.Status", Status_name, Status_value) } -func (m *Task) Marshal() (dAtA []byte, err error) { +func (m *Process) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -94,37 +94,33 @@ func (m *Task) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Task) MarshalTo(dAtA []byte) (int, error) { +func (m *Process) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l - if len(m.ID) > 0 { + 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.ID) > 0 { + dAtA[i] = 0x12 + i++ i = encodeVarintTask(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } if m.Pid != 0 { - dAtA[i] = 0x10 + dAtA[i] = 0x18 i++ i = encodeVarintTask(dAtA, i, uint64(m.Pid)) } if m.Status != 0 { - dAtA[i] = 0x18 + dAtA[i] = 0x20 i++ i = encodeVarintTask(dAtA, i, uint64(m.Status)) } - if m.Spec != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Spec.Size())) - n1, err := m.Spec.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } if len(m.Stdin) > 0 { dAtA[i] = 0x2a i++ @@ -183,9 +179,13 @@ func encodeVarintTask(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } -func (m *Task) Size() (n int) { +func (m *Process) Size() (n int) { var l int _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } l = len(m.ID) if l > 0 { n += 1 + l + sovTask(uint64(l)) @@ -196,10 +196,6 @@ func (m *Task) Size() (n int) { if m.Status != 0 { n += 1 + sovTask(uint64(m.Status)) } - if m.Spec != nil { - l = m.Spec.Size() - n += 1 + l + sovTask(uint64(l)) - } l = len(m.Stdin) if l > 0 { n += 1 + l + sovTask(uint64(l)) @@ -231,15 +227,15 @@ func sovTask(x uint64) (n int) { func sozTask(x uint64) (n int) { return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *Task) String() string { +func (this *Process) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Task{`, + s := strings.Join([]string{`&Process{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, @@ -256,7 +252,7 @@ func valueToStringTask(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *Task) Unmarshal(dAtA []byte) error { +func (m *Process) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -279,13 +275,42 @@ func (m *Task) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Task: wiretype end group for non-group") + return fmt.Errorf("proto: Process: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Task: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Process: illegal tag %d (wire type %d)", fieldNum, wire) } 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 ID", wireType) } @@ -314,7 +339,7 @@ func (m *Task) Unmarshal(dAtA []byte) error { } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } @@ -333,7 +358,7 @@ func (m *Task) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } @@ -352,39 +377,6 @@ func (m *Task) Unmarshal(dAtA []byte) error { break } } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTask - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Spec == nil { - m.Spec = &google_protobuf1.Any{} - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) @@ -623,32 +615,33 @@ func init() { } var fileDescriptorTask = []byte{ - // 431 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x6e, 0xd3, 0x30, - 0x1c, 0xc6, 0xeb, 0xb4, 0xcb, 0x8a, 0x61, 0x53, 0x30, 0xd5, 0x64, 0x02, 0x32, 0x11, 0xa7, 0x88, - 0x83, 0x23, 0xb6, 0x1b, 0xb7, 0x6e, 0xad, 0xd0, 0x84, 0x94, 0x55, 0x6e, 0x2b, 0xce, 0x6e, 0x6d, - 0x82, 0xd5, 0xcd, 0x8e, 0x12, 0x07, 0xd4, 0x1b, 0x47, 0xb4, 0x77, 0xd8, 0x09, 0x9e, 0x81, 0x03, - 0x4f, 0xb0, 0x23, 0x47, 0x4e, 0x88, 0xe5, 0x0d, 0x78, 0x03, 0x14, 0xa7, 0x8c, 0x1e, 0x76, 0x89, - 0xfe, 0xdf, 0xf7, 0xfb, 0xa4, 0xfc, 0x64, 0xf8, 0x2a, 0x53, 0xf6, 0x7d, 0xb5, 0xa0, 0x4b, 0x73, - 0x91, 0x2c, 0x8d, 0xb6, 0x5c, 0x69, 0x59, 0x88, 0xed, 0x93, 0xe7, 0x2a, 0xb1, 0xeb, 0x5c, 0x96, - 0x89, 0xe5, 0xe5, 0xca, 0x7d, 0x68, 0x5e, 0x18, 0x6b, 0xd0, 0xa3, 0xff, 0x2b, 0xfa, 0xe1, 0x25, - 0x75, 0xa3, 0x70, 0x90, 0x99, 0xcc, 0x38, 0x9e, 0x34, 0x57, 0x3b, 0x0d, 0x1f, 0x67, 0xc6, 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, 0xe6, 0x27, 0x85, 0xe4, 0x56, 0x8a, 0x86, 0xb3, 0x79, 0x9a, 0x9e, 0xa6, 0xaf, - 0x03, 0x6f, 0x9b, 0xb3, 0x4a, 0x6b, 0xa5, 0xb3, 0x86, 0x4f, 0x67, 0x67, 0x93, 0xc9, 0x78, 0x14, - 0x74, 0xb7, 0xf9, 0xd4, 0x9a, 0x3c, 0x97, 0x02, 0x3d, 0x85, 0xfe, 0x64, 0x38, 0x9f, 0x8e, 0x47, - 0x41, 0x2f, 0x0c, 0x2e, 0xaf, 0xa2, 0x07, 0x2d, 0x9e, 0xf0, 0xaa, 0x94, 0x22, 0xdc, 0xff, 0xfc, - 0x85, 0x74, 0xbe, 0x7f, 0x25, 0x1b, 0xdb, 0x63, 0x7c, 0x7d, 0x43, 0x3a, 0x3f, 0x6f, 0x48, 0xe7, - 0x53, 0x4d, 0xc0, 0x75, 0x4d, 0xc0, 0x8f, 0x9a, 0x80, 0xdf, 0x35, 0x01, 0x0b, 0xdf, 0x3d, 0xe4, - 0xd1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xcf, 0x9e, 0x89, 0x51, 0x02, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0xc6, 0x73, 0x4e, 0xeb, 0x84, 0xeb, 0x1f, 0xcc, 0x51, 0x55, 0x87, 0x41, 0x57, 0x8b, 0x29, + 0x62, 0xb0, 0x45, 0xbb, 0xb1, 0xb5, 0x71, 0x84, 0x22, 0x24, 0xd7, 0xba, 0x34, 0x62, 0x44, 0x4e, + 0xee, 0x30, 0xa7, 0xb6, 0x77, 0xd6, 0xf9, 0x0c, 0xea, 0xc6, 0x88, 0xfa, 0x1d, 0x3a, 0xc1, 0x67, + 0x60, 0xe0, 0x13, 0x74, 0x64, 0x64, 0xaa,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x02, 0x00, 0x00, } diff --git a/api/types/task/task.proto b/api/types/task/task.proto index 8e4962ab0..f4c5c9429 100644 --- a/api/types/task/task.proto +++ b/api/types/task/task.proto @@ -16,11 +16,11 @@ enum Status { PAUSED = 4 [(gogoproto.enumvalue_customname) = "StatusPaused"]; } -message Task { - string id = 1; - uint32 pid = 2; - Status status = 3; - google.protobuf.Any spec = 4; +message Process { + string container_id = 1; + string id = 2; + uint32 pid = 3; + Status status = 4; string stdin = 5; string stdout = 6; string stderr = 7; diff --git a/container.go b/container.go index 3da1eefac..ccbc5be43 100644 --- a/container.go +++ b/container.go @@ -232,7 +232,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne } func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, error) { - response, err := c.client.TaskService().Get(ctx, &tasks.GetTaskRequest{ + response, err := c.client.TaskService().Get(ctx, &tasks.GetRequest{ ContainerID: c.c.ID, }) if err != nil { @@ -247,14 +247,14 @@ func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, erro // get the existing fifo paths from the task information stored by the daemon paths := &FIFOSet{ Dir: getFifoDir([]string{ - response.Task.Stdin, - response.Task.Stdout, - response.Task.Stderr, + response.Process.Stdin, + response.Process.Stdout, + response.Process.Stderr, }), - In: response.Task.Stdin, - Out: response.Task.Stdout, - Err: response.Task.Stderr, - Terminal: response.Task.Terminal, + In: response.Process.Stdin, + Out: response.Process.Stdout, + Err: response.Process.Stderr, + Terminal: response.Process.Terminal, } if i, err = ioAttach(paths); err != nil { return nil, err @@ -263,8 +263,8 @@ func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, erro t := &task{ client: c.client, io: i, - id: response.Task.ID, - pid: response.Task.Pid, + id: response.Process.ID, + pid: response.Process.Pid, } return t, nil } diff --git a/linux/shim/exec.go b/linux/shim/exec.go index 292d378bb..a698b22f1 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -27,6 +27,7 @@ import ( type execProcess struct { sync.WaitGroup + mu sync.Mutex id string console console.Console io runc.IO @@ -73,6 +74,8 @@ func (e *execProcess) ID() string { } func (e *execProcess) Pid() int { + e.mu.Lock() + defer e.mu.Unlock() return e.pid } @@ -109,8 +112,13 @@ func (e *execProcess) Resize(ws console.WinSize) error { } func (e *execProcess) Kill(ctx context.Context, sig uint32, _ bool) error { - if err := unix.Kill(e.pid, syscall.Signal(sig)); err != nil { - return errors.Wrapf(checkKillError(err), "exec kill error") + e.mu.Lock() + pid := e.pid + e.mu.Unlock() + if pid != 0 { + if err := unix.Kill(pid, syscall.Signal(sig)); err != nil { + return errors.Wrapf(checkKillError(err), "exec kill error") + } } return nil } @@ -179,6 +187,33 @@ func (e *execProcess) Start(ctx context.Context) (err error) { if err != nil { return errors.Wrap(err, "failed to retrieve OCI runtime exec pid") } + e.mu.Lock() e.pid = pid + e.mu.Unlock() return nil } + +func (e *execProcess) Status(ctx context.Context) (string, error) { + s, err := e.parent.Status(ctx) + if err != nil { + return "", err + } + // if the container as a whole is in the pausing/paused state, so are all + // other processes inside the container, use container state here + switch s { + case "paused", "pausing": + return s, nil + } + e.mu.Lock() + defer e.mu.Unlock() + // if we don't have a pid then the exec process has just been created + if e.pid == 0 { + return "created", nil + } + // if we have a pid and it can be signaled, the process is running + if err := unix.Kill(e.pid, 0); err == nil { + return "running", nil + } + // else if we have a pid but it can nolonger be signaled, it has stopped + return "stopped", nil +} diff --git a/linux/shim/init.go b/linux/shim/init.go index c32494d98..76657f2ed 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -209,8 +209,8 @@ func (p *initProcess) ExitedAt() time.Time { return p.exited } -// ContainerStatus return the state of the container (created, running, paused, stopped) -func (p *initProcess) ContainerStatus(ctx context.Context) (string, error) { +// Status return the state of the container (created, running, paused, stopped) +func (p *initProcess) Status(ctx context.Context) (string, error) { c, err := p.runtime.State(ctx, p.id) if err != nil { return "", p.runtimeError(err, "OCI runtime state failed") @@ -233,7 +233,7 @@ func (p *initProcess) SetExited(status int) { } func (p *initProcess) Delete(context context.Context) error { - status, err := p.ContainerStatus(context) + status, err := p.Status(context) if err != nil { return err } diff --git a/linux/shim/process.go b/linux/shim/process.go index 5f0a1bb3e..f005d8bb7 100644 --- a/linux/shim/process.go +++ b/linux/shim/process.go @@ -40,4 +40,6 @@ type process interface { Stdio() stdio // Start execution of the process Start(context.Context) error + // Status returns the process status + Status(ctx context.Context) (string, error) } diff --git a/linux/shim/service.go b/linux/shim/service.go index 682e76c38..5957351c4 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -229,14 +229,11 @@ func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (* } func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) { - if s.initProcess == nil { - return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created") - } p, ok := s.processes[r.ID] if !ok { return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process id %s not found", r.ID) } - st, err := s.initProcess.ContainerStatus(ctx) + st, err := p.Status(ctx) if err != nil { return nil, err } diff --git a/linux/task.go b/linux/task.go index b0aadb6e5..ee7807240 100644 --- a/linux/task.go +++ b/linux/task.go @@ -66,7 +66,6 @@ func (t *Task) State(ctx context.Context) (runtime.State, error) { status = runtime.StoppedStatus case task.StatusPaused: status = runtime.PausedStatus - // TODO: containerd.DeletedStatus } return runtime.State{ Pid: response.Pid, diff --git a/process.go b/process.go index 0ca6f23a6..512d9b3a4 100644 --- a/process.go +++ b/process.go @@ -2,10 +2,12 @@ package containerd import ( "context" + "strings" "syscall" eventsapi "github.com/containerd/containerd/api/services/events/v1" "github.com/containerd/containerd/api/services/tasks/v1" + "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/runtime" "github.com/containerd/containerd/typeurl" specs "github.com/opencontainers/runtime-spec/specs-go" @@ -121,3 +123,14 @@ func (p *process) Delete(ctx context.Context) (uint32, error) { } return r.ExitStatus, nil } + +func (p *process) Status(ctx context.Context) (TaskStatus, error) { + r, err := p.task.client.TaskService().Get(ctx, &tasks.GetRequest{ + ContainerID: p.task.id, + ExecID: p.id, + }) + if err != nil { + return "", errdefs.FromGRPC(err) + } + return TaskStatus(strings.ToLower(r.Process.Status.String())), nil +} diff --git a/services/tasks/service.go b/services/tasks/service.go index 9ceadb5a6..46c6d4380 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -212,8 +212,8 @@ func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest }, nil } -func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error) { - state, err := c.State(ctx) +func processFromContainerd(ctx context.Context, p runtime.Process) (*task.Process, error) { + state, err := p.State(ctx) if err != nil { return nil, err } @@ -230,8 +230,8 @@ func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error) default: log.G(ctx).WithField("status", state.Status).Warn("unknown status") } - return &task.Task{ - ID: c.Info().ID, + return &task.Process{ + ID: p.ID(), Pid: state.Pid, Status: status, Stdin: state.Stdin, @@ -241,17 +241,23 @@ func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error) }, nil } -func (s *Service) Get(ctx context.Context, r *api.GetTaskRequest) (*api.GetTaskResponse, error) { +func (s *Service) Get(ctx context.Context, r *api.GetRequest) (*api.GetResponse, error) { task, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err } - t, err := taskFromContainerd(ctx, task) + p := runtime.Process(task) + if r.ExecID != "" { + if p, err = task.Process(ctx, r.ExecID); err != nil { + return nil, err + } + } + t, err := processFromContainerd(ctx, p) if err != nil { return nil, err } - return &api.GetTaskResponse{ - Task: t, + return &api.GetResponse{ + Process: t, }, nil } @@ -263,7 +269,7 @@ func (s *Service) List(ctx context.Context, r *api.ListTasksRequest) (*api.ListT return nil, err } for _, t := range tasks { - tt, err := taskFromContainerd(ctx, t) + tt, err := processFromContainerd(ctx, t) if err != nil { return nil, err } diff --git a/task.go b/task.go index 4cb47d931..c051eaaed 100644 --- a/task.go +++ b/task.go @@ -88,6 +88,7 @@ type Process interface { CloseIO(context.Context, ...IOCloserOpts) error Resize(ctx context.Context, w, h uint32) error IO() *IO + Status(context.Context) (TaskStatus, error) } var _ = (Task)(&task{}) @@ -153,13 +154,13 @@ func (t *task) Resume(ctx context.Context) error { } func (t *task) Status(ctx context.Context) (TaskStatus, error) { - r, err := t.client.TaskService().Get(ctx, &tasks.GetTaskRequest{ + r, err := t.client.TaskService().Get(ctx, &tasks.GetRequest{ ContainerID: t.id, }) if err != nil { return "", errdefs.FromGRPC(err) } - return TaskStatus(strings.ToLower(r.Task.Status.String())), nil + return TaskStatus(strings.ToLower(r.Process.Status.String())), nil } // Wait is a blocking call that will wait for the task to exit and return the exit status From cd00216fd7d00f5e6511982ffa40dcea8b340231 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 16:07:57 -0400 Subject: [PATCH 06/10] Rename TaskStatus to Status This can be renamed because both Tasks and Processes share the same status consts Signed-off-by: Michael Crosby --- process.go | 4 ++-- task.go | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/process.go b/process.go index 512d9b3a4..00124aab8 100644 --- a/process.go +++ b/process.go @@ -124,7 +124,7 @@ func (p *process) Delete(ctx context.Context) (uint32, error) { return r.ExitStatus, nil } -func (p *process) Status(ctx context.Context) (TaskStatus, error) { +func (p *process) Status(ctx context.Context) (Status, error) { r, err := p.task.client.TaskService().Get(ctx, &tasks.GetRequest{ ContainerID: p.task.id, ExecID: p.id, @@ -132,5 +132,5 @@ func (p *process) Status(ctx context.Context) (TaskStatus, error) { if err != nil { return "", errdefs.FromGRPC(err) } - return TaskStatus(strings.ToLower(r.Process.Status.String())), nil + return Status(strings.ToLower(r.Process.Status.String())), nil } diff --git a/task.go b/task.go index c051eaaed..751e1262f 100644 --- a/task.go +++ b/task.go @@ -28,14 +28,14 @@ import ( const UnknownExitStatus = 255 -type TaskStatus string +type Status string const ( - Running TaskStatus = "running" - Created TaskStatus = "created" - Stopped TaskStatus = "stopped" - Paused TaskStatus = "paused" - Pausing TaskStatus = "pausing" + Running Status = "running" + Created Status = "created" + Stopped Status = "stopped" + Paused Status = "paused" + Pausing Status = "pausing" ) type IOCloseInfo struct { @@ -68,7 +68,7 @@ type Task interface { Pause(context.Context) error Resume(context.Context) error Start(context.Context) error - Status(context.Context) (TaskStatus, error) + Status(context.Context) (Status, error) Wait(context.Context) (uint32, error) Exec(context.Context, string, *specs.Process, IOCreation) (Process, error) Pids(context.Context) ([]uint32, error) @@ -88,7 +88,7 @@ type Process interface { CloseIO(context.Context, ...IOCloserOpts) error Resize(ctx context.Context, w, h uint32) error IO() *IO - Status(context.Context) (TaskStatus, error) + Status(context.Context) (Status, error) } var _ = (Task)(&task{}) @@ -153,14 +153,14 @@ func (t *task) Resume(ctx context.Context) error { return errdefs.FromGRPC(err) } -func (t *task) Status(ctx context.Context) (TaskStatus, error) { +func (t *task) Status(ctx context.Context) (Status, error) { r, err := t.client.TaskService().Get(ctx, &tasks.GetRequest{ ContainerID: t.id, }) if err != nil { return "", errdefs.FromGRPC(err) } - return TaskStatus(strings.ToLower(r.Process.Status.String())), nil + return Status(strings.ToLower(r.Process.Status.String())), nil } // Wait is a blocking call that will wait for the task to exit and return the exit status From 83b27db92308739d848fad8d9abbf7629ed2729f Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 16:09:42 -0400 Subject: [PATCH 07/10] Check status for stopped processes before wait Fixes #1054 Signed-off-by: Michael Crosby --- container_test.go | 165 ++++++++++++++++++++++++++++++++++++++++++++++ process.go | 16 +++++ task.go | 16 ++--- 3 files changed, 185 insertions(+), 12 deletions(-) diff --git a/container_test.go b/container_test.go index a44c1f263..5d0dda4d7 100644 --- a/container_test.go +++ b/container_test.go @@ -967,3 +967,168 @@ func TestUserNamespaces(t *testing.T) { t.Errorf("expected status 7 from delete but received %d", status) } } + +func TestWaitStoppedTask(t *testing.T) { + client, err := newClient(t, address) + if err != nil { + t.Fatal(err) + } + defer client.Close() + + var ( + image Image + ctx, cancel = testContext() + id = t.Name() + ) + defer cancel() + + if runtime.GOOS != "windows" { + image, err = client.GetImage(ctx, testImage) + if err != nil { + t.Error(err) + return + } + } + + spec, err := generateSpec(withImageConfig(ctx, image), withExitStatus(7)) + if err != nil { + t.Error(err) + return + } + container, err := client.NewContainer(ctx, id, WithSpec(spec), withNewSnapshot(id, image)) + if err != nil { + t.Error(err) + return + } + defer container.Delete(ctx, WithSnapshotCleanup) + + task, err := container.NewTask(ctx, Stdio) + if err != nil { + t.Error(err) + return + } + defer task.Delete(ctx) + + statusC := make(chan uint32, 1) + go func() { + status, err := task.Wait(ctx) + if err != nil { + t.Error(err) + } + statusC <- status + }() + + if pid := task.Pid(); pid <= 0 { + t.Errorf("invalid task pid %d", pid) + } + if err := task.Start(ctx); err != nil { + t.Error(err) + task.Delete(ctx) + return + } + // wait for the task to stop then call wait again + <-statusC + _, err = task.Wait(ctx) + if err == nil { + t.Error("Wait after task exits should return an error") + return + } + if !errdefs.IsUnavailable(err) { + t.Errorf("Wait should return %q when task Stopped: %v", errdefs.ErrUnavailable, err) + } +} + +func TestWaitStoppedProcess(t *testing.T) { + client, err := newClient(t, address) + if err != nil { + t.Fatal(err) + } + defer client.Close() + + var ( + image Image + ctx, cancel = testContext() + id = t.Name() + ) + defer cancel() + + if runtime.GOOS != "windows" { + image, err = client.GetImage(ctx, testImage) + if err != nil { + t.Error(err) + return + } + } + + spec, err := generateSpec(withImageConfig(ctx, image), withProcessArgs("sleep", "100")) + if err != nil { + t.Error(err) + return + } + container, err := client.NewContainer(ctx, id, WithSpec(spec), withNewSnapshot(id, image)) + if err != nil { + t.Error(err) + return + } + defer container.Delete(ctx, WithSnapshotCleanup) + + task, err := container.NewTask(ctx, empty()) + if err != nil { + t.Error(err) + return + } + defer task.Delete(ctx) + + finished := make(chan struct{}, 1) + go func() { + if _, err := task.Wait(ctx); err != nil { + t.Error(err) + } + close(finished) + }() + + if err := task.Start(ctx); err != nil { + t.Error(err) + return + } + + // start an exec process without running the original container process info + processSpec := spec.Process + withExecExitStatus(processSpec, 6) + execID := t.Name() + "_exec" + process, err := task.Exec(ctx, execID, processSpec, empty()) + if err != nil { + t.Error(err) + return + } + defer process.Delete(ctx) + processStatusC := make(chan uint32, 1) + go func() { + status, err := process.Wait(ctx) + if err != nil { + t.Error(err) + } + processStatusC <- status + }() + + if err := process.Start(ctx); err != nil { + t.Error(err) + return + } + + // wait for the exec to return + <-processStatusC + // try to wait on the process after it has stopped + _, err = process.Wait(ctx) + if err == nil { + t.Error("Wait after process exits should return an error") + return + } + if !errdefs.IsUnavailable(err) { + t.Errorf("Wait should return %q when process has exited: %v", errdefs.ErrUnavailable, err) + } + if err := task.Kill(ctx, syscall.SIGKILL); err != nil { + t.Error(err) + } + <-finished +} diff --git a/process.go b/process.go index 00124aab8..f85d6ad45 100644 --- a/process.go +++ b/process.go @@ -13,6 +13,18 @@ import ( specs "github.com/opencontainers/runtime-spec/specs-go" ) +type Process interface { + Pid() uint32 + Start(context.Context) error + Delete(context.Context) (uint32, error) + Kill(context.Context, syscall.Signal) error + Wait(context.Context) (uint32, error) + CloseIO(context.Context, ...IOCloserOpts) error + Resize(ctx context.Context, w, h uint32) error + IO() *IO + Status(context.Context) (Status, error) +} + type process struct { id string task *task @@ -63,6 +75,10 @@ func (p *process) Wait(ctx context.Context) (uint32, error) { if err != nil { return UnknownExitStatus, err } + // first check if the task has exited + if status, _ := p.Status(ctx); status == Stopped { + return UnknownExitStatus, errdefs.ErrUnavailable + } for { evt, err := eventstream.Recv() if err != nil { diff --git a/task.go b/task.go index 751e1262f..111339fd7 100644 --- a/task.go +++ b/task.go @@ -79,18 +79,6 @@ type Task interface { Update(context.Context, ...UpdateTaskOpts) error } -type Process interface { - Pid() uint32 - Start(context.Context) error - Delete(context.Context) (uint32, error) - Kill(context.Context, syscall.Signal) error - Wait(context.Context) (uint32, error) - CloseIO(context.Context, ...IOCloserOpts) error - Resize(ctx context.Context, w, h uint32) error - IO() *IO - Status(context.Context) (Status, error) -} - var _ = (Task)(&task{}) type task struct { @@ -171,6 +159,10 @@ func (t *task) Wait(ctx context.Context) (uint32, error) { if err != nil { return UnknownExitStatus, errdefs.FromGRPC(err) } + // first check if the task has exited + if status, _ := t.Status(ctx); status == Stopped { + return UnknownExitStatus, errdefs.ErrUnavailable + } for { evt, err := eventstream.Recv() if err != nil { From e827adaf1172dff196f1dc43c36a9f07f7cfca96 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 16:49:25 -0400 Subject: [PATCH 08/10] Update windows with exec create/start actions Signed-off-by: Michael Crosby --- windows/process.go | 86 ++++++++++++++++++++++++++++++++++++++++++++++ windows/task.go | 84 +------------------------------------------- 2 files changed, 87 insertions(+), 83 deletions(-) diff --git a/windows/process.go b/windows/process.go index 878339fe9..aa722b5de 100644 --- a/windows/process.go +++ b/windows/process.go @@ -4,12 +4,17 @@ package windows import ( "context" + "io" + "syscall" "time" "github.com/Microsoft/hcsshim" + eventsapi "github.com/containerd/containerd/api/services/events/v1" "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/log" "github.com/containerd/containerd/runtime" "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) // process implements containerd.Process and containerd.State @@ -25,6 +30,7 @@ type process struct { exitCh chan struct{} exitCode uint32 exitTime time.Time + conf *hcsshim.ProcessConfig } func (p *process) ID() string { @@ -81,3 +87,83 @@ func (p *process) ExitCode() (uint32, time.Time, error) { } return p.exitCode, p.exitTime, nil } + +func (p *process) Start(ctx context.Context) (err error) { + var hp hcsshim.Process + if hp, err = p.task.hcsContainer.CreateProcess(p.conf); err != nil { + return errors.Wrapf(err, "failed to create process") + } + + stdin, stdout, stderr, err := hp.Stdio() + if err != nil { + hp.Kill() + return errors.Wrapf(err, "failed to retrieve init process stdio") + } + + ioCopy := func(name string, dst io.WriteCloser, src io.ReadCloser) { + log.G(ctx).WithFields(logrus.Fields{"id": p.id, "pid": p.pid}). + Debugf("%s: copy started", name) + io.Copy(dst, src) + log.G(ctx).WithFields(logrus.Fields{"id": p.id, "pid": p.pid}). + Debugf("%s: copy done", name) + dst.Close() + src.Close() + } + + if p.io.stdin != nil { + go ioCopy("stdin", stdin, p.io.stdin) + } + + if p.io.stdout != nil { + go ioCopy("stdout", p.io.stdout, stdout) + } + + if p.io.stderr != nil { + go ioCopy("stderr", p.io.stderr, stderr) + } + + // Wait for the process to exit to get the exit status + go func() { + if err := hp.Wait(); err != nil { + herr, ok := err.(*hcsshim.ProcessError) + if ok && herr.Err != syscall.ERROR_BROKEN_PIPE { + log.G(ctx). + WithError(err). + WithFields(logrus.Fields{"id": p.id, "pid": p.pid}). + Warnf("hcsshim wait failed (process may have been killed)") + } + // Try to get the exit code nonetheless + } + p.exitTime = time.Now() + + ec, err := hp.ExitCode() + if err != nil { + log.G(ctx). + WithError(err). + WithFields(logrus.Fields{"id": p.id, "pid": p.pid}). + Warnf("hcsshim could not retrieve exit code") + // Use the unknown exit code + ec = 255 + } + p.exitCode = uint32(ec) + + p.task.publisher.Publish(ctx, + runtime.TaskExitEventTopic, + &eventsapi.TaskExit{ + ContainerID: p.task.id, + ID: p.id, + Pid: p.pid, + ExitStatus: p.exitCode, + ExitedAt: p.exitTime, + }) + + close(p.exitCh) + // Ensure io's are closed + p.io.Close() + // Cleanup HCS resources + hp.Close() + }() + p.status = runtime.RunningStatus + p.hcs = hp + return nil +} diff --git a/windows/task.go b/windows/task.go index 5114a2990..148a2ebf0 100644 --- a/windows/task.go +++ b/windows/task.go @@ -4,22 +4,18 @@ package windows import ( "context" - "io" "sync" - "syscall" "time" "github.com/Microsoft/hcsshim" eventsapi "github.com/containerd/containerd/api/services/events/v1" "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/events" - "github.com/containerd/containerd/log" "github.com/containerd/containerd/runtime" "github.com/containerd/containerd/typeurl" "github.com/gogo/protobuf/types" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) type task struct { @@ -203,7 +199,6 @@ func (t *task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt &eventsapi.TaskExecAdded{ ContainerID: t.id, ExecID: id, - Pid: p.Pid(), }) return p, nil @@ -290,95 +285,18 @@ func (t *task) newProcess(ctx context.Context, id string, conf *hcsshim.ProcessC }() } t.Unlock() - - var p hcsshim.Process - if p, err = t.hcsContainer.CreateProcess(conf); err != nil { - return nil, errors.Wrapf(err, "failed to create process") - } - - stdin, stdout, stderr, err := p.Stdio() - if err != nil { - p.Kill() - return nil, errors.Wrapf(err, "failed to retrieve init process stdio") - } - - ioCopy := func(name string, dst io.WriteCloser, src io.ReadCloser) { - log.G(ctx).WithFields(logrus.Fields{"id": id, "pid": pid}). - Debugf("%s: copy started", name) - io.Copy(dst, src) - log.G(ctx).WithFields(logrus.Fields{"id": id, "pid": pid}). - Debugf("%s: copy done", name) - dst.Close() - src.Close() - } - - if pset.stdin != nil { - go ioCopy("stdin", stdin, pset.stdin) - } - - if pset.stdout != nil { - go ioCopy("stdout", pset.stdout, stdout) - } - - if pset.stderr != nil { - go ioCopy("stderr", pset.stderr, stderr) - } - t.Lock() wp := &process{ id: id, pid: pid, io: pset, - status: runtime.RunningStatus, + status: runtime.CreatedStatus, task: t, - hcs: p, exitCh: make(chan struct{}), } t.processes[id] = wp t.Unlock() - // Wait for the process to exit to get the exit status - go func() { - if err := p.Wait(); err != nil { - herr, ok := err.(*hcsshim.ProcessError) - if ok && herr.Err != syscall.ERROR_BROKEN_PIPE { - log.G(ctx). - WithError(err). - WithFields(logrus.Fields{"id": id, "pid": pid}). - Warnf("hcsshim wait failed (process may have been killed)") - } - // Try to get the exit code nonetheless - } - wp.exitTime = time.Now() - - ec, err := p.ExitCode() - if err != nil { - log.G(ctx). - WithError(err). - WithFields(logrus.Fields{"id": id, "pid": pid}). - Warnf("hcsshim could not retrieve exit code") - // Use the unknown exit code - ec = 255 - } - wp.exitCode = uint32(ec) - - t.publisher.Publish(ctx, - runtime.TaskExitEventTopic, - &eventsapi.TaskExit{ - ContainerID: t.id, - ID: id, - Pid: pid, - ExitStatus: wp.exitCode, - ExitedAt: wp.exitTime, - }) - - close(wp.exitCh) - // Ensure io's are closed - pset.Close() - // Cleanup HCS resources - p.Close() - }() - return wp, nil } From d18af8699c01bf6bb53781b5c4e955320b898e46 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 31 Jul 2017 16:58:04 -0400 Subject: [PATCH 09/10] Update for epoll console handling Signed-off-by: Michael Crosby --- linux/shim/exec.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux/shim/exec.go b/linux/shim/exec.go index a698b22f1..610f53693 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -173,8 +173,7 @@ func (e *execProcess) Start(ctx context.Context) (err error) { 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, ©WaitGroup); err != nil { + if e.console, err = e.parent.platform.copyConsole(ctx, console, e.stdio.stdin, e.stdio.stdout, e.stdio.stderr, &e.WaitGroup, ©WaitGroup); err != nil { return errors.Wrap(err, "failed to start console copy") } } else { From f945cdc704d869bf9aa753f9e99c83d0da8a1b6b Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 1 Aug 2017 10:07:25 -0400 Subject: [PATCH 10/10] Update windows locking code Signed-off-by: Michael Crosby --- windows/process.go | 7 +++++++ windows/task.go | 16 ++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/windows/process.go b/windows/process.go index aa722b5de..e3c002527 100644 --- a/windows/process.go +++ b/windows/process.go @@ -89,6 +89,13 @@ func (p *process) ExitCode() (uint32, time.Time, error) { } func (p *process) Start(ctx context.Context) (err error) { + // If we fail, close the io right now + defer func() { + if err != nil { + p.io.Close() + } + }() + var hp hcsshim.Process if hp, err = p.task.hcsContainer.CreateProcess(p.conf); err != nil { return errors.Wrapf(err, "failed to create process") diff --git a/windows/task.go b/windows/task.go index 148a2ebf0..402847faa 100644 --- a/windows/task.go +++ b/windows/task.go @@ -104,17 +104,19 @@ func (t *task) Info() runtime.TaskInfo { func (t *task) Start(ctx context.Context) error { conf := newProcessConfig(t.spec.Process, t.io) - if _, err := t.newProcess(ctx, t.id, conf, t.io); err != nil { + p, err := t.newProcess(ctx, t.id, conf, t.io) + if err != nil { + return err + } + if err := p.Start(ctx); err != nil { return err } - t.publisher.Publish(ctx, runtime.TaskStartEventTopic, &eventsapi.TaskStart{ ContainerID: t.id, Pid: t.pid, }) - return nil } @@ -182,11 +184,6 @@ func (t *task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt if pset, err = newPipeSet(ctx, opts.IO); err != nil { return nil, err } - defer func() { - if err != nil { - pset.Close() - } - }() conf := newProcessConfig(spec, pset) p, err := t.newProcess(ctx, id, conf, pset) @@ -284,8 +281,6 @@ func (t *task) newProcess(ctx context.Context, id string, conf *hcsshim.ProcessC } }() } - t.Unlock() - t.Lock() wp := &process{ id: id, pid: pid, @@ -293,6 +288,7 @@ func (t *task) newProcess(ctx context.Context, id string, conf *hcsshim.ProcessC status: runtime.CreatedStatus, task: t, exitCh: make(chan struct{}), + conf: conf, } t.processes[id] = wp t.Unlock()