From f93bfb62337b645a2b3ad2a0f6b60e1d89f553a4 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 28 Jun 2017 12:54:10 -0700 Subject: [PATCH] Add Exec IDs Signed-off-by: Michael Crosby --- api/services/events/v1/container.pb.go | 112 +-- api/services/events/v1/container.proto | 6 +- api/services/events/v1/runtime.pb.go | 198 +++-- api/services/events/v1/runtime.proto | 15 +- api/services/tasks/v1/tasks.pb.go | 618 +++++++-------- api/services/tasks/v1/tasks.proto | 43 +- api/types/task/task.pb.go | 996 +++---------------------- api/types/task/task.proto | 29 +- cmd/containerd-shim/main_unix.go | 5 +- cmd/ctr/events.go | 12 +- cmd/ctr/exec.go | 6 +- cmd/ctr/ps.go | 2 +- cmd/ctr/shim.go | 19 +- container.go | 21 +- container_test.go | 6 +- linux/list.go | 4 +- linux/process.go | 86 +++ linux/runtime.go | 22 +- linux/shim/exec.go | 36 +- linux/shim/init.go | 34 +- linux/shim/local.go | 2 +- linux/shim/process.go | 15 +- linux/shim/service.go | 154 ++-- linux/shim/v1/shim.pb.go | 635 ++++++++++------ linux/shim/v1/shim.proto | 38 +- linux/task.go | 89 +-- metrics/cgroups/cgroups.go | 7 +- process.go | 40 +- runtime/task.go | 45 +- services/containers/service.go | 14 +- services/tasks/service.go | 60 +- task.go | 59 +- windows/container.go | 33 +- windows/hcs/hcs.go | 22 +- windows/hcs/process.go | 5 + windows/process.go | 8 + 36 files changed, 1441 insertions(+), 2055 deletions(-) create mode 100644 linux/process.go diff --git a/api/services/events/v1/container.pb.go b/api/services/events/v1/container.pb.go index 6a45cb1b5..8d8d2d70d 100644 --- a/api/services/events/v1/container.pb.go +++ b/api/services/events/v1/container.pb.go @@ -65,9 +65,9 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type ContainerCreate struct { - ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` - Runtime *ContainerCreate_Runtime `protobuf:"bytes,3,opt,name=runtime" json:"runtime,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` + Runtime *ContainerCreate_Runtime `protobuf:"bytes,3,opt,name=runtime" json:"runtime,omitempty"` } func (m *ContainerCreate) Reset() { *m = ContainerCreate{} } @@ -86,10 +86,10 @@ func (*ContainerCreate_Runtime) Descriptor() ([]byte, []int) { } type ContainerUpdate struct { - ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` - Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - RootFS string `protobuf:"bytes,4,opt,name=rootfs,proto3" json:"rootfs,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` + Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + RootFS string `protobuf:"bytes,4,opt,name=rootfs,proto3" json:"rootfs,omitempty"` } func (m *ContainerUpdate) Reset() { *m = ContainerUpdate{} } @@ -97,7 +97,7 @@ func (*ContainerUpdate) ProtoMessage() {} func (*ContainerUpdate) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{1} } type ContainerDelete struct { - ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (m *ContainerDelete) Reset() { *m = ContainerDelete{} } @@ -125,11 +125,11 @@ func (m *ContainerCreate) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ContainerID) > 0 { + if len(m.ID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) - i += copy(dAtA[i:], m.ContainerID) + i = encodeVarintContainer(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } if len(m.Image) > 0 { dAtA[i] = 0x12 @@ -199,11 +199,11 @@ func (m *ContainerUpdate) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ContainerID) > 0 { + if len(m.ID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) - i += copy(dAtA[i:], m.ContainerID) + i = encodeVarintContainer(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } if len(m.Image) > 0 { dAtA[i] = 0x12 @@ -252,11 +252,11 @@ func (m *ContainerDelete) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ContainerID) > 0 { + if len(m.ID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) - i += copy(dAtA[i:], m.ContainerID) + i = encodeVarintContainer(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } return i, nil } @@ -291,7 +291,7 @@ func encodeVarintContainer(dAtA []byte, offset int, v uint64) int { func (m *ContainerCreate) Size() (n int) { var l int _ = l - l = len(m.ContainerID) + l = len(m.ID) if l > 0 { n += 1 + l + sovContainer(uint64(l)) } @@ -323,7 +323,7 @@ func (m *ContainerCreate_Runtime) Size() (n int) { func (m *ContainerUpdate) Size() (n int) { var l int _ = l - l = len(m.ContainerID) + l = len(m.ID) if l > 0 { n += 1 + l + sovContainer(uint64(l)) } @@ -349,7 +349,7 @@ func (m *ContainerUpdate) Size() (n int) { func (m *ContainerDelete) Size() (n int) { var l int _ = l - l = len(m.ContainerID) + l = len(m.ID) if l > 0 { n += 1 + l + sovContainer(uint64(l)) } @@ -374,7 +374,7 @@ func (this *ContainerCreate) String() string { return "nil" } s := strings.Join([]string{`&ContainerCreate{`, - `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Image:` + fmt.Sprintf("%v", this.Image) + `,`, `Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "ContainerCreate_Runtime", "ContainerCreate_Runtime", 1) + `,`, `}`, @@ -407,7 +407,7 @@ func (this *ContainerUpdate) String() string { } mapStringForLabels += "}" s := strings.Join([]string{`&ContainerUpdate{`, - `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Image:` + fmt.Sprintf("%v", this.Image) + `,`, `Labels:` + mapStringForLabels + `,`, `RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, @@ -420,7 +420,7 @@ func (this *ContainerDelete) String() string { return "nil" } s := strings.Join([]string{`&ContainerDelete{`, - `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `}`, }, "") return s @@ -464,7 +464,7 @@ func (m *ContainerCreate) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -489,7 +489,7 @@ func (m *ContainerCreate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerID = string(dAtA[iNdEx:postIndex]) + m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -717,7 +717,7 @@ func (m *ContainerUpdate) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -742,7 +742,7 @@ func (m *ContainerUpdate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerID = string(dAtA[iNdEx:postIndex]) + m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -970,7 +970,7 @@ func (m *ContainerDelete) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -995,7 +995,7 @@ func (m *ContainerDelete) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerID = string(dAtA[iNdEx:postIndex]) + m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1128,31 +1128,31 @@ func init() { } var fileDescriptorContainer = []byte{ - // 413 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x4d, 0x8b, 0xd5, 0x30, - 0x14, 0x9d, 0xbc, 0x8e, 0x7d, 0x98, 0x0a, 0x23, 0xe1, 0x2d, 0x6a, 0xc1, 0xce, 0xa3, 0xab, 0xb7, - 0x4a, 0x99, 0x0a, 0xa2, 0x23, 0x08, 0xce, 0x87, 0x32, 0xa0, 0x20, 0x11, 0x41, 0xdc, 0x48, 0xfa, - 0x9a, 0xa9, 0xc1, 0x36, 0x29, 0x6d, 0x5a, 0xe8, 0xce, 0x5f, 0xe0, 0xef, 0x9a, 0xa5, 0x4b, 0x57, - 0x83, 0xd3, 0xdf, 0xe1, 0x42, 0x9a, 0xb4, 0x9d, 0xe2, 0x42, 0xe4, 0xe1, 0xee, 0xdc, 0xdc, 0x73, - 0x6e, 0xce, 0xb9, 0x21, 0xf0, 0x55,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 0x49, 0xc1, 0xb7, - 0xc5, 0x2c, 0xfe, 0xfb, 0x22, 0xf9, 0xbf, 0xf1, 0x09, 0xb4, 0x33, 0x1a, 0xb3, 0xac, 0x72, 0xad, - 0xb5, 0xb5, 0x71, 0xa2, 0xe3, 0x7f, 0x4d, 0x6f, 0x9c, 0xe0, 0xd7, 0x5a, 0x7c, 0x2e, 0x54, 0xd9, - 0x92, 0x61, 0x12, 0x0a, 0xa0, 0x5d, 0x4a, 0xa9, 0x2e, 0x2b, 0x77, 0x5f, 0xfb, 0x82, 0xdd, 0xf5, - 0xa1, 0x4d, 0xa4, 0x54, 0x2f, 0xdf, 0x91, 0xa1, 0xe3, 0x3d, 0x85, 0xce, 0x4c, 0x8a, 0xee, 0x43, - 0xeb, 0x0b, 0x6b, 0x87, 0x3d, 0xf5, 0xb0, 0xb7, 0xdb, 0xd0, 0xac, 0x9e, 0xec, 0xea, 0xe2, 0x78, - 0xf1, 0x04, 0x04, 0xe7, 0xb3, 0x7d, 0x9c, 0xb1, 0x8c, 0xed, 0xb6, 0x8f, 0x93, 0x0f, 0x57, 0x37, - 0xfe, 0xde, 0x8f, 0x1b, 0x7f, 0xef, 0x6b, 0xe7, 0x83, 0xab, 0xce, 0x07, 0xdf, 0x3b, 0x1f, 0xfc, - 0xec, 0x7c, 0xf0, 0xf1, 0xf9, 0x8e, 0x3f, 0xe1, 0x99, 0x41, 0xb1, 0xad, 0x1f, 0xf2, 0xd1, 0xef, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x0b, 0xcd, 0x09, 0x52, 0x03, 0x00, 0x00, + // 401 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x41, 0x8b, 0xd4, 0x30, + 0x18, 0xdd, 0xb4, 0x6b, 0x07, 0xd3, 0x83, 0x12, 0x06, 0xa9, 0x05, 0xbb, 0x43, 0x4f, 0xe3, 0x25, + 0x65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fe, 0x02, 0x00, + 0x00, } diff --git a/api/services/events/v1/container.proto b/api/services/events/v1/container.proto index d211665b3..1d16f4670 100644 --- a/api/services/events/v1/container.proto +++ b/api/services/events/v1/container.proto @@ -8,7 +8,7 @@ import "google/protobuf/any.proto"; option go_package = "github.com/containerd/containerd/api/services/events/v1;events"; message ContainerCreate { - string container_id = 1; + string id = 1; string image = 2; message Runtime { string name = 1; @@ -18,12 +18,12 @@ message ContainerCreate { } message ContainerUpdate { - string container_id = 1; + string id = 1; string image = 2; map labels = 3; string rootfs = 4 [(gogoproto.customname) = "RootFS"]; } message ContainerDelete { - string container_id = 1; + string id = 1; } diff --git a/api/services/events/v1/runtime.pb.go b/api/services/events/v1/runtime.pb.go index 88e639463..d986e8efa 100644 --- a/api/services/events/v1/runtime.pb.go +++ b/api/services/events/v1/runtime.pb.go @@ -82,11 +82,11 @@ func (*RuntimeMount) ProtoMessage() {} func (*RuntimeMount) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{1} } type RuntimeCreate struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` - RootFS []*RuntimeMount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` - IO *RuntimeIO `protobuf:"bytes,4,opt,name=io" json:"io,omitempty"` - Checkpoint string `protobuf:"bytes,5,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` + RootFS []*RuntimeMount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` + IO *RuntimeIO `protobuf:"bytes,4,opt,name=io" json:"io,omitempty"` + Checkpoint string `protobuf:"bytes,5,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } func (m *RuntimeCreate) Reset() { *m = RuntimeCreate{} } @@ -94,12 +94,13 @@ func (*RuntimeCreate) ProtoMessage() {} func (*RuntimeCreate) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{2} } type RuntimeEvent struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Type RuntimeEvent_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.services.events.v1.RuntimeEvent_EventType" json:"type,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` - Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,stdtime" json:"timestamp"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Type RuntimeEvent_EventType `protobuf:"varint,3,opt,name=type,proto3,enum=containerd.services.events.v1.RuntimeEvent_EventType" json:"type,omitempty"` + Pid uint32 `protobuf:"varint,4,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,5,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,6,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` + Timestamp time.Time `protobuf:"bytes,7,opt,name=timestamp,stdtime" json:"timestamp"` } func (m *RuntimeEvent) Reset() { *m = RuntimeEvent{} } @@ -107,10 +108,10 @@ func (*RuntimeEvent) ProtoMessage() {} func (*RuntimeEvent) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{3} } type RuntimeDelete struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Runtime string `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime,omitempty"` - ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Runtime string `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime,omitempty"` + ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` } func (m *RuntimeDelete) Reset() { *m = RuntimeDelete{} } @@ -231,11 +232,11 @@ func (m *RuntimeCreate) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintRuntime(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if len(m.Bundle) > 0 { dAtA[i] = 0x12 @@ -295,22 +296,28 @@ func (m *RuntimeEvent) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } + if len(m.ContainerID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } if m.Type != 0 { - dAtA[i] = 0x10 + dAtA[i] = 0x18 i++ i = encodeVarintRuntime(dAtA, i, uint64(m.Type)) } if m.Pid != 0 { - dAtA[i] = 0x18 + dAtA[i] = 0x20 i++ i = encodeVarintRuntime(dAtA, i, uint64(m.Pid)) } if m.ExitStatus != 0 { - dAtA[i] = 0x20 + dAtA[i] = 0x28 i++ i = encodeVarintRuntime(dAtA, i, uint64(m.ExitStatus)) } - dAtA[i] = 0x2a + dAtA[i] = 0x32 i++ i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) @@ -318,7 +325,7 @@ func (m *RuntimeEvent) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n2 - dAtA[i] = 0x32 + dAtA[i] = 0x3a i++ i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:]) @@ -344,11 +351,11 @@ func (m *RuntimeDelete) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintRuntime(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if len(m.Runtime) > 0 { dAtA[i] = 0x12 @@ -443,7 +450,7 @@ func (m *RuntimeMount) Size() (n int) { func (m *RuntimeCreate) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovRuntime(uint64(l)) } @@ -475,6 +482,10 @@ func (m *RuntimeEvent) Size() (n int) { if l > 0 { n += 1 + l + sovRuntime(uint64(l)) } + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } if m.Type != 0 { n += 1 + sovRuntime(uint64(m.Type)) } @@ -494,7 +505,7 @@ func (m *RuntimeEvent) Size() (n int) { func (m *RuntimeDelete) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovRuntime(uint64(l)) } @@ -553,7 +564,7 @@ func (this *RuntimeCreate) String() string { return "nil" } s := strings.Join([]string{`&RuntimeCreate{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`, `RootFS:` + strings.Replace(fmt.Sprintf("%v", this.RootFS), "RuntimeMount", "RuntimeMount", 1) + `,`, `IO:` + strings.Replace(fmt.Sprintf("%v", this.IO), "RuntimeIO", "RuntimeIO", 1) + `,`, @@ -568,6 +579,7 @@ func (this *RuntimeEvent) String() string { } s := strings.Join([]string{`&RuntimeEvent{`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Type:` + fmt.Sprintf("%v", this.Type) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, @@ -582,7 +594,7 @@ func (this *RuntimeDelete) String() string { return "nil" } s := strings.Join([]string{`&RuntimeDelete{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`, @@ -923,7 +935,7 @@ func (m *RuntimeCreate) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -948,7 +960,7 @@ func (m *RuntimeCreate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1152,6 +1164,35 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + 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 ErrIntOverflowRuntime + } + 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 ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } @@ -1170,7 +1211,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } @@ -1189,7 +1230,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) } @@ -1208,7 +1249,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { break } } - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) } @@ -1238,7 +1279,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } @@ -1320,7 +1361,7 @@ func (m *RuntimeDelete) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1345,7 +1386,7 @@ func (m *RuntimeDelete) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1556,44 +1597,45 @@ func init() { } var fileDescriptorRuntime = []byte{ - // 610 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c, - 0x10, 0xb6, 0x24, 0x5b, 0xb1, 0xc6, 0x7f, 0x82, 0x58, 0xc2, 0x8f, 0x30, 0x54, 0x0e, 0x3e, 0x19, - 0x0a, 0x12, 0x71, 0xe9, 0xa9, 0x50, 0x6a, 0xc7, 0x2a, 0xf8, 0x10, 0xdc, 0xae, 0x55, 0x08, 0xbd, - 0x04, 0xd9, 0xda, 0x38, 0x4b, 0x6d, 0xad, 0x58, 0xad, 0x4c, 0x73, 0xeb, 0x23, 0xf4, 0x25, 0xfa, - 0x2e, 0x39, 0xf6, 0xd8, 0x53, 0xda, 0xf8, 0x11, 0xfa, 0x00, 0xa5, 0x68, 0x57, 0x56, 0x42, 0xa1, - 0x26, 0xcd, 0xc5, 0xcc, 0x37, 0xcc, 0x7c, 0x33, 0xdf, 0xec, 0x67, 0x41, 0xb0, 0xa0, 0xe2, 0x32, - 0x9f, 0x79, 0x73, 0xb6, 0xf2, 0xe7, 0x2c, 0x11, 0x11, 0x4d, 0x08, 0x8f, 0xef, 0x87, 0x51, 0x4a, - 0xfd, 0x8c, 0xf0, 0x35, 0x9d, 0x93, 0xcc, 0x27, 0x6b, 0x92, 0x88, 0xcc, 0x5f, 0x1f, 0xfb, 0x3c, - 0x4f, 0x04, 0x5d, 0x11, 0x2f, 0xe5, 0x4c, 0x30, 0xf4, 0xe4, 0xae, 0xc1, 0xdb, 0x16, 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 0x01, 0x0e, 0x6d, 0x03, 0x1d, - 0x00, 0x04, 0x67, 0xc1, 0xc9, 0xf9, 0x60, 0x34, 0x0a, 0x46, 0x76, 0xbd, 0x28, 0x7b, 0x33, 0x78, - 0x37, 0x0d, 0x46, 0x76, 0xa3, 0xfb, 0xe5, 0xce, 0x75, 0x23, 0xb2, 0x24, 0x3b, 0x5c, 0xe7, 0xc0, - 0x5e, 0xf9, 0x5f, 0x2e, 0x6d, 0xb7, 0x85, 0x7f, 0x9e, 0xcf, 0xd8, 0x7d, 0xbe, 0xfa, 0x63, 0xce, - 0x37, 0x3c, 0xbb, 0xbe, 0x75, 0x6b, 0xdf, 0x6e, 0xdd, 0xda, 0xa7, 0x8d, 0xab, 0x5d, 0x6f, 0x5c, - 0xed, 0xeb, 0xc6, 0xd5, 0x7e, 0x6c, 0x5c, 0xed, 0xfd, 0xcb, 0x47, 0x7e, 0x99, 0x5e, 0xa8, 0x68, - 0x66, 0xca, 0x0d, 0x9e, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x39, 0x80, 0x2a, 0xe2, 0x04, - 0x00, 0x00, + // 639 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6b, 0xdb, 0x4c, + 0x10, 0xb6, 0x24, 0x7f, 0x8e, 0x93, 0xbc, 0x62, 0x09, 0x41, 0x18, 0x5e, 0x29, 0xf8, 0x64, 0x78, + 0x41, 0x22, 0x7e, 0xe9, 0xa9, 0x50, 0x6a, 0x5b, 0x2a, 0xe8, 0x10, 0xdc, 0xae, 0x55, 0x08, 0xbd, + 0x18, 0xd9, 0xda, 0x38, 0x4b, 0x6d, 0xad, 0x90, 0x56, 0xa6, 0xb9, 0xf5, 0x17, 0x94, 0xfe, 0x96, + 0xfe, 0x83, 0xde, 0x72, 0xec, 0xb1, 0x27, 0xb7, 0xd1, 0x2f, 0x29, 0x5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, + 0xff, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x14, 0xb7, 0x09, 0x4e, 0x05, 0x00, 0x00, } diff --git a/api/services/events/v1/runtime.proto b/api/services/events/v1/runtime.proto index 0c8c5890d..9c472e17e 100644 --- a/api/services/events/v1/runtime.proto +++ b/api/services/events/v1/runtime.proto @@ -21,7 +21,7 @@ message RuntimeMount { } message RuntimeCreate { - string id = 1; + string container_id = 1; string bundle = 2; repeated RuntimeMount rootfs = 3 [(gogoproto.customname) = "RootFS"]; RuntimeIO io = 4 [(gogoproto.customname) = "IO"]; @@ -30,6 +30,7 @@ message RuntimeCreate { message RuntimeEvent { string id = 1; + string container_id = 2; enum EventType { EXIT = 0; OOM = 1; @@ -38,15 +39,15 @@ message RuntimeEvent { EXEC_ADDED = 4; PAUSED = 5; } - EventType type = 2; - uint32 pid = 3; - uint32 exit_status = 4; - google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp timestamp = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + EventType type = 3; + uint32 pid = 4; + uint32 exit_status = 5; + google.protobuf.Timestamp exited_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp timestamp = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } message RuntimeDelete { - string id = 1; + string container_id = 1; string runtime = 2; uint32 exit_status = 3; google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index 0fbc4fa5d..a6e60108c 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -73,12 +73,7 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type CreateTaskRequest struct { - // ContainerID specifies the container to use for creating this task. - // - // The spec from the provided container id will be used to create the - // task associated with this container. Only one task can be run at a time - // per container. - ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // RootFS provides the pre-chroot mounts to perform in the shim before // executing the container task. // @@ -99,8 +94,8 @@ func (*CreateTaskRequest) ProtoMessage() {} func (*CreateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{0} } type CreateTaskResponse struct { - ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` } func (m *CreateTaskResponse) Reset() { *m = CreateTaskResponse{} } @@ -124,10 +119,10 @@ func (*DeleteTaskRequest) ProtoMessage() {} func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} } type DeleteResponse struct { - ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` - ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } @@ -136,7 +131,7 @@ func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks type DeleteProcessRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` } func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } @@ -177,124 +172,16 @@ func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTa type KillRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Signal uint32 `protobuf:"varint,2,opt,name=signal,proto3" json:"signal,omitempty"` - // Types that are valid to be assigned to PidOrAll: - // *KillRequest_All - // *KillRequest_Pid - PidOrAll isKillRequest_PidOrAll `protobuf_oneof:"pid_or_all"` + ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` + Signal uint32 `protobuf:"varint,3,opt,name=signal,proto3" json:"signal,omitempty"` + All bool `protobuf:"varint,4,opt,name=all,proto3" json:"all,omitempty"` } func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} } -type isKillRequest_PidOrAll interface { - isKillRequest_PidOrAll() - MarshalTo([]byte) (int, error) - Size() int -} - -type KillRequest_All struct { - All bool `protobuf:"varint,3,opt,name=all,proto3,oneof"` -} -type KillRequest_Pid struct { - Pid uint32 `protobuf:"varint,4,opt,name=pid,proto3,oneof"` -} - -func (*KillRequest_All) isKillRequest_PidOrAll() {} -func (*KillRequest_Pid) isKillRequest_PidOrAll() {} - -func (m *KillRequest) GetPidOrAll() isKillRequest_PidOrAll { - if m != nil { - return m.PidOrAll - } - return nil -} - -func (m *KillRequest) GetAll() bool { - if x, ok := m.GetPidOrAll().(*KillRequest_All); ok { - return x.All - } - return false -} - -func (m *KillRequest) GetPid() uint32 { - if x, ok := m.GetPidOrAll().(*KillRequest_Pid); ok { - return x.Pid - } - return 0 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*KillRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _KillRequest_OneofMarshaler, _KillRequest_OneofUnmarshaler, _KillRequest_OneofSizer, []interface{}{ - (*KillRequest_All)(nil), - (*KillRequest_Pid)(nil), - } -} - -func _KillRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*KillRequest) - // pid_or_all - switch x := m.PidOrAll.(type) { - case *KillRequest_All: - t := uint64(0) - if x.All { - t = 1 - } - _ = b.EncodeVarint(3<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case *KillRequest_Pid: - _ = b.EncodeVarint(4<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Pid)) - case nil: - default: - return fmt.Errorf("KillRequest.PidOrAll has unexpected type %T", x) - } - return nil -} - -func _KillRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*KillRequest) - switch tag { - case 3: // pid_or_all.all - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.PidOrAll = &KillRequest_All{x != 0} - return true, err - case 4: // pid_or_all.pid - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.PidOrAll = &KillRequest_Pid{uint32(x)} - return true, err - default: - return false, nil - } -} - -func _KillRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*KillRequest) - // pid_or_all - switch x := m.PidOrAll.(type) { - case *KillRequest_All: - n += proto.SizeVarint(3<<3 | proto.WireVarint) - n += 1 - case *KillRequest_Pid: - n += proto.SizeVarint(4<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Pid)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type ExecProcessRequest struct { - // ContainerID specifies the container in which to exec the process. ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"` Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"` @@ -304,6 +191,8 @@ type ExecProcessRequest struct { // // For runc, this is a process spec, for example. Spec *google_protobuf1.Any `protobuf:"bytes,6,opt,name=spec" json:"spec,omitempty"` + // id of the exec process + ExecID string `protobuf:"bytes,7,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` } func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} } @@ -320,7 +209,7 @@ func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptor type ResizePtyRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"` Height uint32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` } @@ -331,7 +220,7 @@ func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorTas type CloseIORequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` Stdin bool `protobuf:"varint,3,opt,name=stdin,proto3" json:"stdin,omitempty"` } @@ -981,7 +870,7 @@ func (m *CreateTaskRequest) MarshalTo(dAtA []byte) (int, error) { var l int _ = l if len(m.ContainerID) > 0 { - dAtA[i] = 0x12 + dAtA[i] = 0xa i++ i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) @@ -1065,13 +954,13 @@ func (m *CreateTaskResponse) MarshalTo(dAtA []byte) (int, error) { var l int _ = l if len(m.ContainerID) > 0 { - dAtA[i] = 0x12 + dAtA[i] = 0xa i++ i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { - dAtA[i] = 0x18 + dAtA[i] = 0x10 i++ i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) } @@ -1141,11 +1030,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ContainerID) > 0 { + if len(m.ID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) - i += copy(dAtA[i:], m.ContainerID) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } if m.Pid != 0 { dAtA[i] = 0x10 @@ -1189,10 +1078,11 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } - if m.Pid != 0 { - dAtA[i] = 0x10 + if len(m.ExecID) > 0 { + dAtA[i] = 0x12 i++ - i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID))) + i += copy(dAtA[i:], m.ExecID) } return i, nil } @@ -1324,40 +1214,30 @@ func (m *KillRequest) 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) + } if m.Signal != 0 { - dAtA[i] = 0x10 + dAtA[i] = 0x18 i++ i = encodeVarintTasks(dAtA, i, uint64(m.Signal)) } - if m.PidOrAll != nil { - nn5, err := m.PidOrAll.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.All { + dAtA[i] = 0x20 + i++ + if m.All { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - i += nn5 + i++ } return i, nil } -func (m *KillRequest_All) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x18 - i++ - if m.All { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - return i, nil -} -func (m *KillRequest_Pid) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ - i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) - return i, nil -} func (m *ExecProcessRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1411,11 +1291,17 @@ func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x32 i++ i = encodeVarintTasks(dAtA, i, uint64(m.Spec.Size())) - n6, err := m.Spec.MarshalTo(dAtA[i:]) + n5, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n6 + i += n5 + } + if len(m.ExecID) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID))) + i += copy(dAtA[i:], m.ExecID) } return i, nil } @@ -1464,10 +1350,11 @@ func (m *ResizePtyRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } - if m.Pid != 0 { - dAtA[i] = 0x10 + if len(m.ExecID) > 0 { + dAtA[i] = 0x12 i++ - i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID))) + i += copy(dAtA[i:], m.ExecID) } if m.Width != 0 { dAtA[i] = 0x18 @@ -1503,10 +1390,11 @@ func (m *CloseIORequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } - if m.Pid != 0 { - dAtA[i] = 0x10 + if len(m.ExecID) > 0 { + dAtA[i] = 0x12 i++ - i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID))) + i += copy(dAtA[i:], m.ExecID) } if m.Stdin { dAtA[i] = 0x18 @@ -1609,21 +1497,21 @@ func (m *ListPidsResponse) MarshalTo(dAtA []byte) (int, error) { var l int _ = l if len(m.Pids) > 0 { - dAtA8 := make([]byte, len(m.Pids)*10) - var j7 int + dAtA7 := make([]byte, len(m.Pids)*10) + var j6 int for _, num := range m.Pids { for num >= 1<<7 { - dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + dAtA7[j6] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j7++ + j6++ } - dAtA8[j7] = uint8(num) - j7++ + dAtA7[j6] = uint8(num) + j6++ } dAtA[i] = 0xa i++ - i = encodeVarintTasks(dAtA, i, uint64(j7)) - i += copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintTasks(dAtA, i, uint64(j6)) + i += copy(dAtA[i:], dAtA7[:j6]) } return i, nil } @@ -1659,11 +1547,11 @@ func (m *CheckpointTaskRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintTasks(dAtA, i, uint64(m.Options.Size())) - n9, err := m.Options.MarshalTo(dAtA[i:]) + n8, err := m.Options.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n9 + i += n8 } return i, nil } @@ -1723,11 +1611,11 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintTasks(dAtA, i, uint64(m.Resources.Size())) - n10, err := m.Resources.MarshalTo(dAtA[i:]) + n9, err := m.Resources.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n10 + i += n9 } return i, nil } @@ -1834,7 +1722,7 @@ func (m *DeleteTaskRequest) Size() (n int) { func (m *DeleteResponse) Size() (n int) { var l int _ = l - l = len(m.ContainerID) + l = len(m.ID) if l > 0 { n += 1 + l + sovTasks(uint64(l)) } @@ -1856,8 +1744,9 @@ func (m *DeleteProcessRequest) Size() (n int) { if l > 0 { n += 1 + l + sovTasks(uint64(l)) } - if m.Pid != 0 { - n += 1 + sovTasks(uint64(m.Pid)) + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) } return n } @@ -1911,27 +1800,19 @@ func (m *KillRequest) Size() (n int) { if l > 0 { n += 1 + l + sovTasks(uint64(l)) } + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) + } if m.Signal != 0 { n += 1 + sovTasks(uint64(m.Signal)) } - if m.PidOrAll != nil { - n += m.PidOrAll.Size() + if m.All { + n += 2 } return n } -func (m *KillRequest_All) Size() (n int) { - var l int - _ = l - n += 2 - return n -} -func (m *KillRequest_Pid) Size() (n int) { - var l int - _ = l - n += 1 + sovTasks(uint64(m.Pid)) - return n -} func (m *ExecProcessRequest) Size() (n int) { var l int _ = l @@ -1958,6 +1839,10 @@ func (m *ExecProcessRequest) Size() (n int) { l = m.Spec.Size() n += 1 + l + sovTasks(uint64(l)) } + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) + } return n } @@ -1977,8 +1862,9 @@ func (m *ResizePtyRequest) Size() (n int) { if l > 0 { n += 1 + l + sovTasks(uint64(l)) } - if m.Pid != 0 { - n += 1 + sovTasks(uint64(m.Pid)) + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) } if m.Width != 0 { n += 1 + sovTasks(uint64(m.Width)) @@ -1996,8 +1882,9 @@ func (m *CloseIORequest) Size() (n int) { if l > 0 { n += 1 + l + sovTasks(uint64(l)) } - if m.Pid != 0 { - n += 1 + sovTasks(uint64(m.Pid)) + l = len(m.ExecID) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) } if m.Stdin { n += 2 @@ -2158,7 +2045,7 @@ func (this *DeleteResponse) String() string { return "nil" } s := strings.Join([]string{`&DeleteResponse{`, - `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf3.Timestamp", 1), `&`, ``, 1) + `,`, @@ -2172,7 +2059,7 @@ func (this *DeleteProcessRequest) String() string { } s := strings.Join([]string{`&DeleteProcessRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `}`, }, "") return s @@ -2223,32 +2110,13 @@ func (this *KillRequest) String() string { } s := strings.Join([]string{`&KillRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `Signal:` + fmt.Sprintf("%v", this.Signal) + `,`, - `PidOrAll:` + fmt.Sprintf("%v", this.PidOrAll) + `,`, - `}`, - }, "") - return s -} -func (this *KillRequest_All) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&KillRequest_All{`, `All:` + fmt.Sprintf("%v", this.All) + `,`, `}`, }, "") return s } -func (this *KillRequest_Pid) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&KillRequest_Pid{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, - `}`, - }, "") - return s -} func (this *ExecProcessRequest) String() string { if this == nil { return "nil" @@ -2260,6 +2128,7 @@ func (this *ExecProcessRequest) String() string { `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `}`, }, "") return s @@ -2280,7 +2149,7 @@ func (this *ResizePtyRequest) String() string { } s := strings.Join([]string{`&ResizePtyRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `Width:` + fmt.Sprintf("%v", this.Width) + `,`, `Height:` + fmt.Sprintf("%v", this.Height) + `,`, `}`, @@ -2293,7 +2162,7 @@ func (this *CloseIORequest) String() string { } s := strings.Join([]string{`&CloseIORequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `}`, }, "") @@ -2409,7 +2278,7 @@ func (m *CreateTaskRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: CreateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } @@ -2692,7 +2561,7 @@ func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: CreateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } @@ -2721,7 +2590,7 @@ func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error { } m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } @@ -2950,7 +2819,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2975,7 +2844,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerID = string(dAtA[iNdEx:postIndex]) + m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -3125,10 +2994,10 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType) } - m.Pid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTasks @@ -3138,11 +3007,21 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift + 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:]) @@ -3545,6 +3424,35 @@ func (m *KillRequest) 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 + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Signal", wireType) } @@ -3563,7 +3471,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) } @@ -3582,28 +3490,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { break } } - b := bool(v != 0) - m.PidOrAll = &KillRequest_All{b} - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTasks - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.PidOrAll = &KillRequest_Pid{v} + m.All = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTasks(dAtA[iNdEx:]) @@ -3823,6 +3710,35 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + 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:]) @@ -3972,10 +3888,10 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType) } - m.Pid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTasks @@ -3985,11 +3901,21 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift + 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 case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) @@ -4108,10 +4034,10 @@ func (m *CloseIORequest) Unmarshal(dAtA []byte) error { m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType) } - m.Pid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTasks @@ -4121,11 +4047,21 @@ func (m *CloseIORequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift + 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 case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) @@ -4960,80 +4896,80 @@ func init() { } var fileDescriptorTasks = []byte{ - // 1191 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6e, 0x1b, 0xc5, - 0x17, 0xcf, 0xc6, 0x1f, 0x75, 0x8e, 0x9b, 0x36, 0x99, 0x7f, 0xfe, 0xc1, 0x5d, 0x2a, 0x3b, 0xda, - 0x0b, 0x30, 0x15, 0xd9, 0x25, 0x2e, 0xe2, 0x82, 0x56, 0x88, 0x26, 0x0e, 0x21, 0x02, 0x94, 0x74, - 0x53, 0x10, 0xaa, 0x90, 0xac, 0x8d, 0x77, 0xe2, 0x8c, 0xb2, 0xde, 0xd9, 0xee, 0x8c, 0xd3, 0x06, - 0x6e, 0xb8, 0xe2, 0x16, 0xde, 0x82, 0x77, 0xe0, 0x09, 0x72, 0xc9, 0x05, 0x17, 0x08, 0xa1, 0x40, - 0xf3, 0x24, 0x68, 0x3e, 0xbc, 0xd9, 0xd8, 0xb1, 0xd7, 0xa9, 0x73, 0x93, 0xcc, 0xcc, 0x9e, 0x73, - 0xe6, 0x9c, 0xdf, 0xf9, 0xf8, 0x8d, 0x0c, 0xeb, 0x1d, 0xc2, 0x0f, 0x7b, 0xfb, 0x76, 0x9b, 0x76, - 0x9d, 0x36, 0x0d, 0xb9, 0x47, 0x42, 0x1c, 0xfb, 0xe9, 0xa5, 0x17, 0x11, 0x87, 0xe1, 0xf8, 0x98, - 0xb4, 0x31, 0x73, 0xb8, 0xc7, 0x8e, 0x98, 0x73, 0xbc, 0xa6, 0x16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0x96, 0x85, 0xd2, 0x20, 0xfb, - 0x8d, 0x8c, 0x60, 0x07, 0x6e, 0x69, 0x86, 0xca, 0xca, 0xee, 0x65, 0x22, 0x1b, 0x63, 0xb0, 0x20, - 0x49, 0x28, 0xcb, 0xc3, 0x41, 0xa6, 0x1a, 0x69, 0xf0, 0x29, 0x14, 0x15, 0x1b, 0x65, 0xf5, 0xd5, - 0x10, 0x67, 0x8d, 0x34, 0x49, 0xa0, 0xd4, 0x27, 0x14, 0xb4, 0x9a, 0x5d, 0x3e, 0x29, 0xfe, 0x32, - 0xed, 0x49, 0xc5, 0x75, 0xd2, 0x5e, 0x02, 0xa4, 0x46, 0xfe, 0xc3, 0x0c, 0x88, 0xaf, 0x22, 0x2f, - 0xf3, 0xc3, 0xeb, 0x29, 0xe9, 0x8b, 0x9f, 0x42, 0x51, 0xcd, 0xf4, 0x2c, 0xd8, 0x86, 0x26, 0xff, - 0x28, 0xd8, 0xd6, 0xbf, 0x39, 0x7d, 0x5d, 0x9d, 0xf9, 0xf3, 0x75, 0x75, 0xe6, 0xc7, 0xf3, 0xaa, - 0x71, 0x7a, 0x5e, 0x35, 0x7e, 0x3f, 0xaf, 0x1a, 0xff, 0x9e, 0x57, 0x8d, 0xe7, 0x8f, 0xdf, 0xec, - 0x17, 0x8d, 0x47, 0x72, 0xb1, 0x5f, 0x94, 0xf7, 0x3c, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x7e, - 0x07, 0x52, 0x7c, 0x18, 0x11, 0x00, 0x00, + // 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, 0xbb, 0x54, 0x76, 0xb4, + 0x48, 0x60, 0x2a, 0xb2, 0x4b, 0x5c, 0xc4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 0xac, 0xab, 0x12, 0x16, 0x00, 0x21, 0x66, + 0x3d, 0x80, 0xc5, 0xaf, 0x30, 0x15, 0x2a, 0x62, 0xa7, 0x57, 0x40, 0x3f, 0xc4, 0x6d, 0x86, 0x22, + 0x69, 0x83, 0xab, 0x76, 0x56, 0x0d, 0x96, 0x12, 0xb2, 0xea, 0x3e, 0x07, 0xb2, 0x82, 0x3e, 0x8b, + 0x9a, 0x78, 0xc7, 0x63, 0x2e, 0x94, 0x72, 0xd6, 0x4b, 0x0d, 0x0a, 0x5f, 0xe2, 0x76, 0xfb, 0x4d, + 0x87, 0x58, 0x70, 0x00, 0x6e, 0xf1, 0x97, 0x2e, 0x4b, 0x46, 0xed, 0x78, 0x85, 0x79, 0xed, 0xb6, + 0x28, 0x94, 0x9c, 0xcb, 0x97, 0xd6, 0x3f, 0x1a, 0x18, 0x1c, 0x7c, 0x0b, 0xc9, 0x8f, 0x69, 0x2a, + 0x75, 0x3d, 0x4d, 0xa5, 0x47, 0xd0, 0x54, 0x66, 0x24, 0x4d, 0x65, 0x07, 0x68, 0xaa, 0x02, 0x19, + 0x1a, 0xa2, 0xa6, 0x20, 0xb6, 0x51, 0x2c, 0x23, 0x24, 0x92, 0x51, 0x9a, 0x1b, 0x59, 0x88, 0xef, + 0xc3, 0xff, 0xaf, 0xb8, 0xae, 0xd2, 0xaa, 0x9e, 0xa1, 0x76, 0x49, 0x2a, 0x3f, 0x6b, 0xb0, 0xe8, + 0x22, 0x8a, 0xbf, 0x47, 0x7b, 0xec, 0xec, 0x8d, 0x27, 0x6f, 0x19, 0xb2, 0x2f, 0xb0, 0xcf, 0x8e, + 0x54, 0xee, 0xe4, 0x86, 0xc7, 0xeb, 0x08, 0xe1, 0xd6, 0x91, 0x7c, 0xe6, 0xf3, 0xae, 0xda, 0x59, + 0x3f, 0xc2, 0xdd, 0xad, 0x36, 0xa1, 0xa8, 0xbe, 0xfb, 0x5f, 0x18, 0x26, 0x13, 0x9c, 0x16, 0x79, + 0x91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x81, 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, } diff --git a/api/services/tasks/v1/tasks.proto b/api/services/tasks/v1/tasks.proto index f720bbbab..b6a8edb5c 100644 --- a/api/services/tasks/v1/tasks.proto +++ b/api/services/tasks/v1/tasks.proto @@ -49,14 +49,7 @@ service Tasks { } message CreateTaskRequest { - // NOTE: reserve field 1 for task id. - - // ContainerID specifies the container to use for creating this task. - // - // The spec from the provided container id will be used to create the - // task associated with this container. Only one task can be run at a time - // per container. - string container_id = 2; + string container_id = 1; // RootFS provides the pre-chroot mounts to perform in the shim before // executing the container task. @@ -77,17 +70,8 @@ message CreateTaskRequest { } message CreateTaskResponse { - // TODO(stevvooe): We no longer have an id for a task since they are bound - // to a single container. Although, we should represent each new task with - // an ID so one can differentiate between each instance of a container - // running. - // - // Hence, we are leaving this here and reserving the field number in case - // we need to move in this direction. - // string id = 1; - - string container_id = 2; - uint32 pid = 3; + string container_id = 1; + uint32 pid = 2; } message StartTaskRequest { @@ -99,7 +83,7 @@ message DeleteTaskRequest { } message DeleteResponse { - string container_id = 1; + string id = 1; uint32 pid = 2; uint32 exit_status = 3; google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; @@ -107,7 +91,7 @@ message DeleteResponse { message DeleteProcessRequest { string container_id = 1; - uint32 pid = 2; + string exec_id = 2; } message GetTaskRequest { @@ -128,26 +112,23 @@ message ListTasksResponse { message KillRequest { string container_id = 1; - uint32 signal = 2; - oneof pid_or_all { - bool all = 3; - uint32 pid = 4; - } + string exec_id = 2; + uint32 signal = 3; + bool all = 4; } message ExecProcessRequest { - // ContainerID specifies the container in which to exec the process. string container_id = 1; - string stdin = 2; string stdout = 3; string stderr = 4; bool terminal = 5; - // Spec for starting a process in the target container. // // For runc, this is a process spec, for example. google.protobuf.Any spec = 6; + // id of the exec process + string exec_id = 7; } message ExecProcessResponse { @@ -156,14 +137,14 @@ message ExecProcessResponse { message ResizePtyRequest { string container_id = 1; - uint32 pid = 2; + string exec_id = 2; uint32 width = 3; uint32 height = 4; } message CloseIORequest { string container_id = 1; - uint32 pid = 2; + string exec_id = 2; bool stdin = 3; } diff --git a/api/types/task/task.pb.go b/api/types/task/task.pb.go index 75da92141..8d9b757bb 100644 --- a/api/types/task/task.pb.go +++ b/api/types/task/task.pb.go @@ -10,8 +10,6 @@ It has these top-level messages: Task - Process - User */ package task @@ -68,53 +66,22 @@ 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"` - ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_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"` + 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"` } func (m *Task) Reset() { *m = Task{} } func (*Task) ProtoMessage() {} func (*Task) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } -type Process struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` - Args []string `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` - Env []string `protobuf:"bytes,3,rep,name=env" json:"env,omitempty"` - User *User `protobuf:"bytes,4,opt,name=user" json:"user,omitempty"` - Cwd string `protobuf:"bytes,5,opt,name=cwd,proto3" json:"cwd,omitempty"` - Terminal bool `protobuf:"varint,6,opt,name=terminal,proto3" json:"terminal,omitempty"` - ExitStatus uint32 `protobuf:"varint,7,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` - RuntimeData *google_protobuf1.Any `protobuf:"bytes,9,opt,name=runtime_data,json=runtimeData" json:"runtime_data,omitempty"` - Stdin string `protobuf:"bytes,10,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,11,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,12,opt,name=stderr,proto3" json:"stderr,omitempty"` -} - -func (m *Process) Reset() { *m = Process{} } -func (*Process) ProtoMessage() {} -func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{1} } - -type User struct { - Uid uint32 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` - Gid uint32 `protobuf:"varint,2,opt,name=gid,proto3" json:"gid,omitempty"` - AdditionalGids []uint32 `protobuf:"varint,3,rep,packed,name=additional_gids,json=additionalGids" json:"additional_gids,omitempty"` -} - -func (m *User) Reset() { *m = User{} } -func (*User) ProtoMessage() {} -func (*User) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{2} } - func init() { proto.RegisterType((*Task)(nil), "containerd.v1.types.Task") - proto.RegisterType((*Process)(nil), "containerd.v1.types.Process") - proto.RegisterType((*User)(nil), "containerd.v1.types.User") proto.RegisterEnum("containerd.v1.types.Status", Status_name, Status_value) } func (m *Task) Marshal() (dAtA []byte, err error) { @@ -138,22 +105,26 @@ func (m *Task) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTask(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } - if len(m.ContainerID) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID))) - i += copy(dAtA[i:], m.ContainerID) - } if m.Pid != 0 { - dAtA[i] = 0x18 + dAtA[i] = 0x10 i++ i = encodeVarintTask(dAtA, i, uint64(m.Pid)) } if m.Status != 0 { - dAtA[i] = 0x20 + dAtA[i] = 0x18 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++ @@ -185,168 +156,6 @@ func (m *Task) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *Process) 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 *Process) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Pid != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Pid)) - } - if len(m.Args) > 0 { - for _, s := range m.Args { - dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if len(m.Env) > 0 { - for _, s := range m.Env { - dAtA[i] = 0x1a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.User != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.User.Size())) - n1, err := m.User.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.Cwd) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintTask(dAtA, i, uint64(len(m.Cwd))) - i += copy(dAtA[i:], m.Cwd) - } - if m.Terminal { - dAtA[i] = 0x30 - i++ - if m.Terminal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.ExitStatus != 0 { - dAtA[i] = 0x38 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) - } - if m.Status != 0 { - dAtA[i] = 0x40 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Status)) - } - if m.RuntimeData != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintTask(dAtA, i, uint64(m.RuntimeData.Size())) - n2, err := m.RuntimeData.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if len(m.Stdin) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin))) - i += copy(dAtA[i:], m.Stdin) - } - if len(m.Stdout) > 0 { - dAtA[i] = 0x5a - i++ - i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout))) - i += copy(dAtA[i:], m.Stdout) - } - if len(m.Stderr) > 0 { - dAtA[i] = 0x62 - i++ - i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr))) - i += copy(dAtA[i:], m.Stderr) - } - return i, nil -} - -func (m *User) 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 *User) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Uid != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Uid)) - } - if m.Gid != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Gid)) - } - if len(m.AdditionalGids) > 0 { - dAtA4 := make([]byte, len(m.AdditionalGids)*10) - var j3 int - for _, num := range m.AdditionalGids { - for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j3++ - } - dAtA4[j3] = uint8(num) - j3++ - } - dAtA[i] = 0x1a - i++ - i = encodeVarintTask(dAtA, i, uint64(j3)) - i += copy(dAtA[i:], dAtA4[:j3]) - } - return i, nil -} - func encodeFixed64Task(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -381,16 +190,16 @@ func (m *Task) Size() (n int) { if l > 0 { n += 1 + l + sovTask(uint64(l)) } - l = len(m.ContainerID) - if l > 0 { - n += 1 + l + sovTask(uint64(l)) - } if m.Pid != 0 { n += 1 + sovTask(uint64(m.Pid)) } 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)) @@ -409,79 +218,6 @@ func (m *Task) Size() (n int) { return n } -func (m *Process) Size() (n int) { - var l int - _ = l - if m.Pid != 0 { - n += 1 + sovTask(uint64(m.Pid)) - } - if len(m.Args) > 0 { - for _, s := range m.Args { - l = len(s) - n += 1 + l + sovTask(uint64(l)) - } - } - if len(m.Env) > 0 { - for _, s := range m.Env { - l = len(s) - n += 1 + l + sovTask(uint64(l)) - } - } - if m.User != nil { - l = m.User.Size() - n += 1 + l + sovTask(uint64(l)) - } - l = len(m.Cwd) - if l > 0 { - n += 1 + l + sovTask(uint64(l)) - } - if m.Terminal { - n += 2 - } - if m.ExitStatus != 0 { - n += 1 + sovTask(uint64(m.ExitStatus)) - } - if m.Status != 0 { - n += 1 + sovTask(uint64(m.Status)) - } - if m.RuntimeData != nil { - l = m.RuntimeData.Size() - n += 1 + l + sovTask(uint64(l)) - } - l = len(m.Stdin) - if l > 0 { - n += 1 + l + sovTask(uint64(l)) - } - l = len(m.Stdout) - if l > 0 { - n += 1 + l + sovTask(uint64(l)) - } - l = len(m.Stderr) - if l > 0 { - n += 1 + l + sovTask(uint64(l)) - } - return n -} - -func (m *User) Size() (n int) { - var l int - _ = l - if m.Uid != 0 { - n += 1 + sovTask(uint64(m.Uid)) - } - if m.Gid != 0 { - n += 1 + sovTask(uint64(m.Gid)) - } - if len(m.AdditionalGids) > 0 { - l = 0 - for _, e := range m.AdditionalGids { - l += sovTask(uint64(e)) - } - n += 1 + sovTask(uint64(l)) + l - } - return n -} - func sovTask(x uint64) (n int) { for { n++ @@ -501,9 +237,9 @@ func (this *Task) String() string { } s := strings.Join([]string{`&Task{`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `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) + `,`, @@ -512,39 +248,6 @@ func (this *Task) String() string { }, "") return s } -func (this *Process) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Process{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, - `Args:` + fmt.Sprintf("%v", this.Args) + `,`, - `Env:` + fmt.Sprintf("%v", this.Env) + `,`, - `User:` + strings.Replace(fmt.Sprintf("%v", this.User), "User", "User", 1) + `,`, - `Cwd:` + fmt.Sprintf("%v", this.Cwd) + `,`, - `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, - `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `RuntimeData:` + strings.Replace(fmt.Sprintf("%v", this.RuntimeData), "Any", "google_protobuf1.Any", 1) + `,`, - `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, - `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, - `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, - `}`, - }, "") - return s -} -func (this *User) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&User{`, - `Uid:` + fmt.Sprintf("%v", this.Uid) + `,`, - `Gid:` + fmt.Sprintf("%v", this.Gid) + `,`, - `AdditionalGids:` + fmt.Sprintf("%v", this.AdditionalGids) + `,`, - `}`, - }, "") - return s -} func valueToStringTask(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -612,35 +315,6 @@ func (m *Task) Unmarshal(dAtA []byte) error { m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - 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 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } @@ -659,7 +333,7 @@ func (m *Task) Unmarshal(dAtA []byte) error { break } } - case 4: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } @@ -678,6 +352,39 @@ 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) @@ -806,523 +513,6 @@ func (m *Task) Unmarshal(dAtA []byte) error { } return nil } -func (m *Process) 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: Process: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Process: 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 ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", 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.Args = append(m.Args, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Env", 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.Env = append(m.Env, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", 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.User == nil { - m.User = &User{} - } - if err := m.User.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cwd", 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.Cwd = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Terminal = bool(v != 0) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) - } - m.ExitStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExitStatus |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= (Status(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RuntimeData", 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.RuntimeData == nil { - m.RuntimeData = &google_protobuf1.Any{} - } - if err := m.RuntimeData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stdin", 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.Stdin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stdout", 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.Stdout = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stderr", 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.Stderr = 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 *User) 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: User: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) - } - m.Uid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Uid |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) - } - m.Gid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Gid |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.AdditionalGids = append(m.AdditionalGids, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTask - } - postIndex := iNdEx + packedLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.AdditionalGids = append(m.AdditionalGids, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field AdditionalGids", wireType) - } - 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 skipTask(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -1433,44 +623,32 @@ func init() { } var fileDescriptorTask = []byte{ - // 616 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x31, 0x4f, 0x1b, 0x3f, - 0x1c, 0xcd, 0x5d, 0xc2, 0x25, 0x38, 0x09, 0xdc, 0xdf, 0x7f, 0x84, 0x8e, 0xb4, 0x3a, 0x4e, 0x2c, - 0x8d, 0x2a, 0xf5, 0xa2, 0xc2, 0x50, 0xa9, 0x1b, 0x90, 0x08, 0x45, 0x95, 0x42, 0xe4, 0x10, 0x75, - 0x8c, 0x4c, 0xec, 0x5e, 0x2d, 0xc0, 0x8e, 0x6c, 0x1f, 0x94, 0xad, 0x63, 0xc5, 0x77, 0x60, 0x6a, - 0x3f, 0x43, 0x87, 0x7e, 0x02, 0xc6, 0x8e, 0x9d, 0x50, 0xc9, 0x57, 0xe8, 0xd8, 0xa5, 0xb2, 0xef, - 0x48, 0x82, 0x44, 0xa5, 0x2e, 0xa7, 0xe7, 0xf7, 0x9e, 0xce, 0xcf, 0xef, 0xf7, 0x03, 0xaf, 0x13, - 0xa6, 0xdf, 0xa7, 0xc7, 0xf1, 0x58, 0x9c, 0xb5, 0xc6, 0x82, 0x6b, 0xcc, 0x38, 0x95, 0x64, 0x11, - 0xe2, 0x09, 0x6b, 0xe9, 0xcb, 0x09, 0x55, 0x2d, 0x8d, 0xd5, 0x89, 0xfd, 0xc4, 0x13, 0x29, 0xb4, - 0x80, 0xff, 0xcf, 0x5d, 0xf1, 0xf9, 0xcb, 0xd8, 0x9a, 0x1a, 0x6b, 0x89, 0x48, 0x84, 0xd5, 0x5b, - 0x06, 0x65, 0xd6, 0xc6, 0x46, 0x22, 0x44, 0x72, 0x4a, 0x5b, 0xf6, 0x74, 0x9c, 0xbe, 0x6b, 0x61, - 0x7e, 0x99, 0x49, 0x5b, 0xbf, 0x1d, 0x50, 0x3a, 0xc2, 0xea, 0x04, 0xae, 0x03, 0x97, 0x91, 0xc0, - 0x89, 0x9c, 0xe6, 0xf2, 0x9e, 0x37, 0xbd, 0xdd, 0x74, 0xbb, 0x6d, 0xe4, 0x32, 0x02, 0xb7, 0x41, - 0x6d, 0x76, 0xd1, 0x88, 0x91, 0xc0, 0xb5, 0x8e, 0xd5, 0xe9, 0xed, 0x66, 0x75, 0xff, 0x9e, 0xef, - 0xb6, 0x51, 0x75, 0x66, 0xea, 0x12, 0xe8, 0x83, 0xe2, 0x84, 0x91, 0xa0, 0x18, 0x39, 0xcd, 0x3a, - 0x32, 0x10, 0xee, 0x00, 0x4f, 0x69, 0xac, 0x53, 0x15, 0x94, 0x22, 0xa7, 0xb9, 0xb2, 0xfd, 0x24, - 0x7e, 0x24, 0x7d, 0x3c, 0xb0, 0x16, 0x94, 0x5b, 0xe1, 0x1a, 0x58, 0x52, 0x9a, 0x30, 0x1e, 0x2c, - 0x99, 0x3b, 0x51, 0x76, 0x80, 0xeb, 0xe6, 0x57, 0x44, 0xa4, 0x3a, 0xf0, 0x2c, 0x9d, 0x9f, 0x72, - 0x9e, 0x4a, 0x19, 0x94, 0x67, 0x3c, 0x95, 0x12, 0x36, 0x40, 0x45, 0x53, 0x79, 0xc6, 0x38, 0x3e, - 0x0d, 0x2a, 0x91, 0xd3, 0xac, 0xa0, 0xd9, 0x79, 0xeb, 0x97, 0x0b, 0xca, 0x7d, 0x29, 0xc6, 0x54, - 0xa9, 0xfb, 0xd0, 0xce, 0x3c, 0x34, 0x04, 0x25, 0x2c, 0x13, 0x15, 0xb8, 0x51, 0xb1, 0xb9, 0x8c, - 0x2c, 0x36, 0x2e, 0xca, 0xcf, 0x83, 0xa2, 0xa5, 0x0c, 0x84, 0x2f, 0x40, 0x29, 0x55, 0x54, 0xda, - 0x87, 0x55, 0xb7, 0x37, 0x1e, 0x7d, 0xd8, 0x50, 0x51, 0x89, 0xac, 0xcd, 0xfc, 0x60, 0x7c, 0x41, - 0xf2, 0x27, 0x19, 0xf8, 0x20, 0xa0, 0xf7, 0x30, 0x20, 0xdc, 0x04, 0x55, 0xfa, 0x81, 0xe9, 0x51, - 0x5e, 0x5e, 0xd9, 0x86, 0x03, 0x86, 0xca, 0xba, 0x5a, 0x28, 0xb6, 0xf2, 0xef, 0xc5, 0xbe, 0x02, - 0x35, 0x99, 0x72, 0xcd, 0xce, 0xe8, 0x88, 0x60, 0x8d, 0x83, 0x65, 0x1b, 0x7d, 0x2d, 0xce, 0xd6, - 0x24, 0xbe, 0x5f, 0x93, 0x78, 0x97, 0x5f, 0xa2, 0x6a, 0xee, 0x6c, 0x63, 0x8d, 0xe7, 0x13, 0x01, - 0x8f, 0x4f, 0xa4, 0xfa, 0x97, 0x89, 0xd4, 0x16, 0x27, 0xb2, 0x35, 0x00, 0xa5, 0x61, 0x5e, 0x45, - 0x3a, 0x6f, 0x3c, 0x65, 0x76, 0x71, 0x92, 0x7c, 0xc7, 0xea, 0xc8, 0x40, 0xf8, 0x0c, 0xac, 0x62, - 0x42, 0x98, 0x66, 0x82, 0xe3, 0xd3, 0x51, 0xc2, 0x88, 0xb2, 0xdd, 0xd7, 0xd1, 0xca, 0x9c, 0x3e, - 0x60, 0x44, 0x3d, 0xff, 0xea, 0x00, 0x2f, 0xef, 0x24, 0x04, 0xe5, 0x61, 0xef, 0x4d, 0xef, 0xf0, - 0x6d, 0xcf, 0x2f, 0x34, 0xfe, 0xbb, 0xba, 0x8e, 0xea, 0x99, 0x30, 0xe4, 0x27, 0x5c, 0x5c, 0x70, - 0xa3, 0xef, 0xa3, 0xce, 0xee, 0x51, 0xa7, 0xed, 0x3b, 0x8b, 0xfa, 0xbe, 0xa4, 0x58, 0x53, 0x62, - 0x74, 0x34, 0xec, 0xf5, 0xba, 0xbd, 0x03, 0xdf, 0x5d, 0xd4, 0x51, 0xca, 0x39, 0xe3, 0x89, 0xd1, - 0x07, 0x47, 0x87, 0xfd, 0x7e, 0xa7, 0xed, 0x17, 0x17, 0xf5, 0x81, 0x16, 0x93, 0x09, 0x25, 0xf0, - 0x29, 0xf0, 0xfa, 0xbb, 0xc3, 0x41, 0xa7, 0xed, 0x97, 0x1a, 0xfe, 0xd5, 0x75, 0x54, 0xcb, 0xe4, - 0x3e, 0x4e, 0x15, 0x25, 0x8d, 0x95, 0x4f, 0x9f, 0xc3, 0xc2, 0xb7, 0x2f, 0x61, 0x9e, 0x76, 0x2f, - 0xb8, 0xb9, 0x0b, 0x0b, 0x3f, 0xee, 0xc2, 0xc2, 0xc7, 0x69, 0xe8, 0xdc, 0x4c, 0x43, 0xe7, 0xfb, - 0x34, 0x74, 0x7e, 0x4e, 0x43, 0xe7, 0xd8, 0xb3, 0x83, 0xd8, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff, - 0x1e, 0xcd, 0x9c, 0x52, 0x26, 0x04, 0x00, 0x00, + // 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, 0x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xa2, 0xc0, 0xbb, 0xb7, 0xbd, 0x2c, 0x0a, 0x14, 0xc2, 0xbe, + 0x95, 0xc5, 0x85, 0xd2, 0xfc, 0x1c, 0xf7, 0x23, 0x10, 0xf7, 0xd9, 0x6d, 0x7e, 0xf1, 0x0d, 0x40, + 0xbf, 0xd5, 0x43, 0x04, 0xee, 0xce, 0xd3, 0x37, 0xe9, 0xd9, 0xdb, 0x34, 0xe8, 0x84, 0x0f, 0x2f, + 0xaf, 0xa2, 0xbd, 0x16, 0xcc, 0xf5, 0x4a, 0x9b, 0x8f, 0xba, 0xe1, 0x27, 0x6c, 0x3c, 0x9c, 0x8d, + 0x47, 0x01, 0xd8, 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, } diff --git a/api/types/task/task.proto b/api/types/task/task.proto index ee4517c68..8e4962ab0 100644 --- a/api/types/task/task.proto +++ b/api/types/task/task.proto @@ -17,33 +17,12 @@ enum Status { } message Task { - string id = 1; // TODO(stevvooe): For now, this is just the container id. - string container_id = 2; - uint32 pid = 3; - Status status = 4; + string id = 1; + uint32 pid = 2; + Status status = 3; + google.protobuf.Any spec = 4; string stdin = 5; string stdout = 6; string stderr = 7; bool terminal = 8; } - -message Process { - uint32 pid = 1; - repeated string args = 2; - repeated string env = 3; - User user = 4; - string cwd = 5; - bool terminal = 6; - uint32 exit_status = 7; - Status status = 8; - google.protobuf.Any runtime_data = 9; - string stdin = 10; - string stdout = 11; - string stderr = 12; -} - -message User { - uint32 uid = 1; - uint32 gid = 2; - repeated uint32 additional_gids = 3; -} diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go index 4bcab7973..8c83a9e63 100644 --- a/cmd/containerd-shim/main_unix.go +++ b/cmd/containerd-shim/main_unix.go @@ -71,7 +71,10 @@ func main() { return err } server := grpc.NewServer() - sv, err := shim.NewService(path, context.GlobalString("namespace")) + sv, err := shim.NewService( + path, + context.GlobalString("namespace"), + ) if err != nil { return err } diff --git a/cmd/ctr/events.go b/cmd/ctr/events.go index 7367629d5..a327a4795 100644 --- a/cmd/ctr/events.go +++ b/cmd/ctr/events.go @@ -63,7 +63,7 @@ func getEventOutput(env *eventsapi.Envelope) (string, error) { } switch e := v.(type) { case *eventsapi.ContainerCreate: - out = fmt.Sprintf("id=%s image=%s runtime=%s", e.ContainerID, e.Image, e.Runtime) + out = fmt.Sprintf("id=%s image=%s runtime=%s", e.ID, e.Image, e.Runtime) case *eventsapi.TaskCreate: out = "id=" + e.ContainerID case *eventsapi.TaskStart: @@ -71,9 +71,9 @@ func getEventOutput(env *eventsapi.Envelope) (string, error) { case *eventsapi.TaskDelete: out = fmt.Sprintf("id=%s pid=%d status=%d", e.ContainerID, e.Pid, e.ExitStatus) case *eventsapi.ContainerUpdate: - out = "id=" + e.ContainerID + out = "id=" + e.ID case *eventsapi.ContainerDelete: - out = "id=" + e.ContainerID + out = "id=" + e.ID case *eventsapi.SnapshotPrepare: out = fmt.Sprintf("key=%s parent=%s", e.Key, e.Parent) case *eventsapi.SnapshotCommit: @@ -95,11 +95,11 @@ func getEventOutput(env *eventsapi.Envelope) (string, error) { for _, m := range e.RootFS { mounts = append(mounts, fmt.Sprintf("type=%s:src=%s", m.Type, m.Source)) } - out = fmt.Sprintf("id=%s bundle=%s rootfs=%s checkpoint=%s", e.ID, e.Bundle, strings.Join(mounts, ","), e.Checkpoint) + out = fmt.Sprintf("id=%s bundle=%s rootfs=%s checkpoint=%s", e.ContainerID, e.Bundle, strings.Join(mounts, ","), e.Checkpoint) case *eventsapi.RuntimeEvent: - out = fmt.Sprintf("id=%s type=%s pid=%d status=%d exited=%s", e.ID, e.Type, e.Pid, e.ExitStatus, e.ExitedAt) + out = fmt.Sprintf("id=%s container_id=%s type=%s pid=%d status=%d exited=%s", e.ID, e.ContainerID, e.Type, e.Pid, e.ExitStatus, e.ExitedAt) case *eventsapi.RuntimeDelete: - out = fmt.Sprintf("id=%s runtime=%s status=%d exited=%s", e.ID, e.Runtime, e.ExitStatus, e.ExitedAt) + out = fmt.Sprintf("id=%s runtime=%s status=%d exited=%s", e.ContainerID, e.Runtime, e.ExitStatus, e.ExitedAt) default: out = env.Event.TypeUrl } diff --git a/cmd/ctr/exec.go b/cmd/ctr/exec.go index dc181bb05..710a217f2 100644 --- a/cmd/ctr/exec.go +++ b/cmd/ctr/exec.go @@ -22,6 +22,10 @@ var execCommand = cli.Command{ Name: "tty,t", Usage: "allocate a TTY for the container", }, + cli.StringFlag{ + Name: "exec-id", + Usage: "exec specific id for the process", + }, }, Action: func(context *cli.Context) error { var ( @@ -60,7 +64,7 @@ var execCommand = cli.Command{ if tty { io = containerd.StdioTerminal } - process, err := task.Exec(ctx, pspec, io) + process, err := task.Exec(ctx, context.String("exec-id"), pspec, io) if err != nil { return err } diff --git a/cmd/ctr/ps.go b/cmd/ctr/ps.go index 079a3eb18..5ed3eca46 100644 --- a/cmd/ctr/ps.go +++ b/cmd/ctr/ps.go @@ -36,7 +36,7 @@ var psCommand = cli.Command{ if err != nil { return err } - processes, err := task.Processes(ctx) + processes, err := task.Pids(ctx) if err != nil { return err } diff --git a/cmd/ctr/shim.go b/cmd/ctr/shim.go index 7932490e3..6b053904f 100644 --- a/cmd/ctr/shim.go +++ b/cmd/ctr/shim.go @@ -129,7 +129,7 @@ var shimCreateCommand = cli.Command{ return err } if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{ - Pid: r.Pid, + ID: id, Width: uint32(size.Width), Height: uint32(size.Height), }); err != nil { @@ -180,7 +180,9 @@ var shimStateCommand = cli.Command{ if err != nil { return err } - r, err := service.State(gocontext.Background(), empty) + r, err := service.State(gocontext.Background(), &shim.StateRequest{ + ID: context.Args().First(), + }) if err != nil { return err } @@ -221,10 +223,18 @@ var shimExecCommand = cli.Command{ ), Action: func(context *cli.Context) error { service, err := getShimService(context) - ctx := gocontext.Background() if err != nil { return err } + var ( + id = context.Args().First() + ctx = gocontext.Background() + ) + + if id == "" { + return errors.New("exec id must be provided") + } + tty := context.Bool("tty") wg, err := prepareStdio(context.String("stdin"), context.String("stdout"), context.String("stderr"), tty) if err != nil { @@ -242,6 +252,7 @@ var shimExecCommand = cli.Command{ } rq := &shim.ExecProcessRequest{ + ID: id, Spec: &protobuf.Any{ TypeUrl: url, Value: spec, @@ -269,7 +280,7 @@ var shimExecCommand = cli.Command{ return err } if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{ - Pid: r.Pid, + ID: id, Width: uint32(size.Width), Height: uint32(size.Height), }); err != nil { diff --git a/container.go b/container.go index 022a0a14d..684d23856 100644 --- a/container.go +++ b/container.go @@ -202,10 +202,9 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne } } t := &task{ - client: c.client, - io: i, - containerID: c.ID(), - pidSync: make(chan struct{}), + client: c.client, + io: i, + id: c.ID(), } if request.Checkpoint != nil { @@ -217,7 +216,6 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne return nil, err } t.pid = response.Pid - close(t.pidSync) } return t, nil } @@ -250,16 +248,11 @@ func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, erro return nil, err } } - // create and close a channel on load as we already have the pid - // and don't want to block calls to Wait(), etc... - ps := make(chan struct{}) - close(ps) t := &task{ - client: c.client, - io: i, - containerID: response.Task.ContainerID, - pid: response.Task.Pid, - pidSync: ps, + client: c.client, + io: i, + id: response.Task.ID, + pid: response.Task.Pid, } return t, nil } diff --git a/container_test.go b/container_test.go index 0c6f47a7c..a82b352be 100644 --- a/container_test.go +++ b/container_test.go @@ -263,8 +263,8 @@ func TestContainerExec(t *testing.T) { "sh", "-c", "exit 6", } - - process, err := task.Exec(ctx, processSpec, empty()) + execID := t.Name() + "_exec" + process, err := task.Exec(ctx, execID, processSpec, empty()) if err != nil { t.Error(err) return @@ -354,7 +354,7 @@ func TestContainerProcesses(t *testing.T) { if pid <= 0 { t.Errorf("invalid task pid %d", pid) } - processes, err := task.Processes(ctx) + processes, err := task.Pids(ctx) if err != nil { t.Error(err) return diff --git a/linux/list.go b/linux/list.go index 980ad2822..0b436f0c5 100644 --- a/linux/list.go +++ b/linux/list.go @@ -50,7 +50,7 @@ func (l *taskList) addWithNamespace(namespace string, t *Task) error { l.mu.Lock() defer l.mu.Unlock() - id := t.containerID + id := t.id if _, ok := l.tasks[namespace]; !ok { l.tasks[namespace] = make(map[string]*Task) } @@ -70,6 +70,6 @@ func (l *taskList) delete(ctx context.Context, t *Task) { } tasks, ok := l.tasks[namespace] if ok { - delete(tasks, t.containerID) + delete(tasks, t.id) } } diff --git a/linux/process.go b/linux/process.go new file mode 100644 index 000000000..f81390107 --- /dev/null +++ b/linux/process.go @@ -0,0 +1,86 @@ +// +build linux + +package linux + +import ( + "context" + "errors" + + "github.com/containerd/containerd/api/types/task" + shim "github.com/containerd/containerd/linux/shim/v1" + "github.com/containerd/containerd/runtime" + "google.golang.org/grpc" +) + +type Process struct { + id string + t *Task +} + +func (p *Process) ID() string { + return p.id +} + +func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error { + _, err := p.t.shim.Kill(ctx, &shim.KillRequest{ + Signal: signal, + ID: p.id, + }) + if err != nil { + err = errors.New(grpc.ErrorDesc(err)) + } + return err +} + +func (p *Process) State(ctx context.Context) (runtime.State, error) { + // use the container status for the status of the process + response, err := p.t.shim.State(ctx, &shim.StateRequest{ + ID: p.id, + }) + if err != nil { + return runtime.State{}, errors.New(grpc.ErrorDesc(err)) + } + var status runtime.Status + switch response.Status { + case task.StatusCreated: + status = runtime.CreatedStatus + case task.StatusRunning: + status = runtime.RunningStatus + case task.StatusStopped: + status = runtime.StoppedStatus + case task.StatusPaused: + status = runtime.PausedStatus + // TODO: containerd.DeletedStatus + } + return runtime.State{ + Pid: response.Pid, + Status: status, + Stdin: response.Stdin, + Stdout: response.Stdout, + Stderr: response.Stderr, + Terminal: response.Terminal, + }, nil +} + +func (p *Process) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { + _, err := p.t.shim.ResizePty(ctx, &shim.ResizePtyRequest{ + ID: p.id, + Width: size.Width, + Height: size.Height, + }) + if err != nil { + err = errors.New(grpc.ErrorDesc(err)) + } + return err +} + +func (p *Process) CloseIO(ctx context.Context) error { + _, err := p.t.shim.CloseIO(ctx, &shim.CloseIORequest{ + ID: p.id, + Stdin: true, + }) + if err != nil { + err = errors.New(grpc.ErrorDesc(err)) + } + return err +} diff --git a/linux/runtime.go b/linux/runtime.go index 8ef1ce1fe..32aa6e398 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -201,9 +201,9 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts }) } if err := r.emit(ctx, "/runtime/create", &eventsapi.RuntimeCreate{ - ID: id, - Bundle: bundle.path, - RootFS: runtimeMounts, + ContainerID: id, + Bundle: bundle.path, + RootFS: runtimeMounts, IO: &eventsapi.RuntimeIO{ Stdin: opts.IO.Stdin, Stdout: opts.IO.Stdout, @@ -239,14 +239,14 @@ func (r *Runtime) Delete(ctx context.Context, c runtime.Task) (*runtime.Exit, er r.tasks.delete(ctx, lc) var ( - bundle = loadBundle(filepath.Join(r.root, namespace, lc.containerID), namespace) + bundle = loadBundle(filepath.Join(r.root, namespace, lc.id), namespace) i = c.Info() ) if err := r.emit(ctx, "/runtime/delete", &eventsapi.RuntimeDelete{ - ID: i.ID, - Runtime: i.Runtime, - ExitStatus: rsp.ExitStatus, - ExitedAt: rsp.ExitedAt, + ContainerID: i.ID, + Runtime: i.Runtime, + ExitStatus: rsp.ExitStatus, + ExitedAt: rsp.ExitedAt, }); err != nil { return nil, err } @@ -324,9 +324,9 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { continue } o = append(o, &Task{ - containerID: id, - shim: s, - namespace: ns, + id: id, + shim: s, + namespace: ns, }) } return o, nil diff --git a/linux/shim/exec.go b/linux/shim/exec.go index 0cdb3b711..65135afa3 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -26,7 +26,7 @@ import ( type execProcess struct { sync.WaitGroup - id int + id string console console.Console io runc.IO status int @@ -34,29 +34,27 @@ type execProcess struct { pid int closers []io.Closer stdin io.Closer + stdio stdio parent *initProcess - - stdinPath string - stdoutPath string - stderrPath string - terminal bool } -func newExecProcess(context context.Context, path string, r *shimapi.ExecProcessRequest, parent *initProcess, id int) (process, error) { +func newExecProcess(context context.Context, path string, r *shimapi.ExecProcessRequest, parent *initProcess, id string) (process, error) { e := &execProcess{ - id: id, - parent: parent, - stdinPath: r.Stdin, - stdoutPath: r.Stdout, - stderrPath: r.Stderr, - terminal: r.Terminal, + 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("%d.pid", id)) + pidfile = filepath.Join(path, fmt.Sprintf("%s.pid", id)) ) if r.Terminal { if socket, err = runc.NewConsoleSocket(filepath.Join(path, "pty.sock")); err != nil { @@ -120,6 +118,10 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecProcess return e, nil } +func (e *execProcess) ID() string { + return e.id +} + func (e *execProcess) Pid() int { return e.pid } @@ -155,7 +157,7 @@ func (e *execProcess) Resize(ws console.WinSize) error { return e.console.Resize(ws) } -func (e *execProcess) Signal(sig int) error { +func (e *execProcess) Kill(ctx context.Context, sig uint32, _ bool) error { if err := unix.Kill(e.pid, syscall.Signal(sig)); err != nil { return checkKillError(err) } @@ -165,3 +167,7 @@ func (e *execProcess) Signal(sig int) error { func (e *execProcess) Stdin() io.Closer { return e.stdin } + +func (e *execProcess) Stdio() stdio { + return e.stdio +} diff --git a/linux/shim/init.go b/linux/shim/init.go index d8388b39c..87aa11715 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -48,11 +48,7 @@ type initProcess struct { pid int closers []io.Closer stdin io.Closer - - stdinPath string - stdoutPath string - stderrPath string - terminal bool + stdio stdio } func newInitProcess(context context.Context, path, namespace string, r *shimapi.CreateTaskRequest) (*initProcess, error) { @@ -82,13 +78,15 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi. Root: filepath.Join(RuncRoot, namespace), } p := &initProcess{ - id: r.ID, - bundle: r.Bundle, - runtime: runtime, - stdinPath: r.Stdin, - stdoutPath: r.Stdout, - stderrPath: r.Stderr, - terminal: r.Terminal, + id: r.ID, + bundle: r.Bundle, + runtime: runtime, + stdio: stdio{ + stdin: r.Stdin, + stdout: r.Stdout, + stderr: r.Stderr, + terminal: r.Terminal, + }, } var ( err error @@ -171,6 +169,10 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi. return p, nil } +func (p *initProcess) ID() string { + return p.id +} + func (p *initProcess) Pid() int { return p.pid } @@ -257,10 +259,6 @@ func (p *initProcess) killAll(context context.Context) error { return p.runtimeError(err, "OCI runtime killall failed") } -func (p *initProcess) Signal(sig int) error { - return checkKillError(unix.Kill(p.pid, syscall.Signal(sig))) -} - func (p *initProcess) Stdin() io.Closer { return p.stdin } @@ -306,6 +304,10 @@ func (p *initProcess) Update(context context.Context, r *shimapi.UpdateTaskReque return p.runtime.Update(context, p.id, &resources) } +func (p *initProcess) Stdio() stdio { + return p.stdio +} + // TODO(mlaventure): move to runc package? func getLastRuntimeError(r *runc.Runc) (string, error) { if r.Log == "" { diff --git a/linux/shim/local.go b/linux/shim/local.go index 493215db1..fdde79e90 100644 --- a/linux/shim/local.go +++ b/linux/shim/local.go @@ -60,7 +60,7 @@ func (c *local) Stream(ctx context.Context, in *shimapi.StreamEventsRequest, opt }, nil } -func (c *local) State(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*shimapi.StateResponse, error) { +func (c *local) State(ctx context.Context, in *shimapi.StateRequest, opts ...grpc.CallOption) (*shimapi.StateResponse, error) { return c.s.State(ctx, in) } diff --git a/linux/shim/process.go b/linux/shim/process.go index a08bacd6d..183176373 100644 --- a/linux/shim/process.go +++ b/linux/shim/process.go @@ -10,7 +10,16 @@ import ( "github.com/containerd/console" ) +type stdio struct { + stdin string + stdout string + stderr string + terminal bool +} + type process interface { + // ID returns the id for the process + ID() string // Pid returns the pid for the process Pid() int // Resize resizes the process console @@ -23,8 +32,10 @@ type process interface { ExitedAt() time.Time // Delete deletes the process and its resourcess Delete(context.Context) error - // Signal directly signals the process - Signal(int) error // Stdin returns the process STDIN Stdin() io.Closer + // Kill kills the process + Kill(context.Context, uint32, bool) error + // Stdio returns io information for the container + Stdio() stdio } diff --git a/linux/shim/service.go b/linux/shim/service.go index ca20e13fb..a530bd61b 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -6,7 +6,9 @@ import ( "fmt" "os" "sync" - "syscall" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" "github.com/containerd/console" events "github.com/containerd/containerd/api/services/events/v1" @@ -16,7 +18,6 @@ import ( google_protobuf "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" "golang.org/x/net/context" - "golang.org/x/sys/unix" ) const ( @@ -34,7 +35,7 @@ func NewService(path, namespace string) (*Service, error) { } return &Service{ path: path, - processes: make(map[int]process), + processes: make(map[string]process), events: make(chan *events.RuntimeEvent, 4096), namespace: namespace, }, nil @@ -46,34 +47,38 @@ type Service struct { id string bundle string mu sync.Mutex - processes map[int]process + processes map[string]process events chan *events.RuntimeEvent eventsMu sync.Mutex deferredEvent *events.RuntimeEvent - execID int namespace string } func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*shimapi.CreateTaskResponse, error) { + if r.ID == "" { + return nil, grpc.Errorf(codes.InvalidArgument, "task id cannot be empty") + } process, err := newInitProcess(ctx, s.path, s.namespace, r) if err != nil { return nil, err } s.mu.Lock() + // save the main task id and bundle to the shim for additional requests s.id = r.ID s.bundle = r.Bundle s.initProcess = process pid := process.Pid() - s.processes[pid] = process + s.processes[r.ID] = process s.mu.Unlock() cmd := &reaper.Cmd{ ExitCh: make(chan int, 1), } reaper.Default.Register(pid, cmd) s.events <- &events.RuntimeEvent{ - Type: events.RuntimeEvent_CREATE, - ID: r.ID, - Pid: uint32(pid), + Type: events.RuntimeEvent_CREATE, + ID: r.ID, + ContainerID: s.id, + Pid: uint32(pid), } go s.waitExit(process, pid, cmd) return &shimapi.CreateTaskResponse{ @@ -89,9 +94,10 @@ func (s *Service) Start(ctx context.Context, r *google_protobuf.Empty) (*google_ return nil, err } s.events <- &events.RuntimeEvent{ - Type: events.RuntimeEvent_START, - ID: s.id, - Pid: uint32(s.initProcess.Pid()), + Type: events.RuntimeEvent_START, + ID: s.id, + ContainerID: s.id, + Pid: uint32(s.initProcess.Pid()), } return empty, nil } @@ -104,7 +110,7 @@ func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimap // TODO (@crosbymichael): how to handle errors here p.Delete(ctx) s.mu.Lock() - delete(s.processes, p.Pid()) + delete(s.processes, p.ID()) s.mu.Unlock() return &shimapi.DeleteResponse{ ExitStatus: uint32(p.Status()), @@ -117,19 +123,19 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq if s.initProcess == nil { return nil, errors.New(ErrContainerNotCreated) } - if int(r.Pid) == s.initProcess.pid { - return nil, fmt.Errorf("cannot delete init process with DeleteProcess") + if r.ID == s.initProcess.id { + return nil, grpc.Errorf(codes.InvalidArgument, "cannot delete init process with DeleteProcess") } s.mu.Lock() - p, ok := s.processes[int(r.Pid)] + p, ok := s.processes[r.ID] s.mu.Unlock() if !ok { - return nil, fmt.Errorf("process %d not found", r.Pid) + return nil, fmt.Errorf("process %s not found", r.ID) } // TODO (@crosbymichael): how to handle errors here p.Delete(ctx) s.mu.Lock() - delete(s.processes, p.Pid()) + delete(s.processes, p.ID()) s.mu.Unlock() return &shimapi.DeleteResponse{ ExitStatus: uint32(p.Status()), @@ -144,9 +150,8 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi } s.mu.Lock() defer s.mu.Unlock() - s.execID++ - process, err := newExecProcess(ctx, s.path, r, s.initProcess, s.execID) + process, err := newExecProcess(ctx, s.path, r, s.initProcess, r.ID) if err != nil { return nil, err } @@ -155,12 +160,13 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi ExitCh: make(chan int, 1), } reaper.Default.Register(pid, cmd) - s.processes[pid] = process + s.processes[r.ID] = process s.events <- &events.RuntimeEvent{ - Type: events.RuntimeEvent_EXEC_ADDED, - ID: s.id, - Pid: uint32(pid), + Type: events.RuntimeEvent_EXEC_ADDED, + ID: r.ID, + ContainerID: s.id, + Pid: uint32(pid), } go s.waitExit(process, pid, cmd) return &shimapi.ExecProcessResponse{ @@ -169,18 +175,18 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi } func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) { - if r.Pid == 0 { - return nil, errors.Errorf("pid not provided in request") + if r.ID == "" { + return nil, grpc.Errorf(codes.InvalidArgument, "id not provided") } ws := console.WinSize{ Width: uint16(r.Width), Height: uint16(r.Height), } s.mu.Lock() - p, ok := s.processes[int(r.Pid)] + p, ok := s.processes[r.ID] s.mu.Unlock() if !ok { - return nil, errors.Errorf("process does not exist %d", r.Pid) + return nil, errors.Errorf("process does not exist %s", r.ID) } if err := p.Resize(ws); err != nil { return nil, err @@ -212,10 +218,14 @@ func (s *Service) Stream(r *shimapi.StreamEventsRequest, stream shimapi.Shim_Str } } -func (s *Service) State(ctx context.Context, r *google_protobuf.Empty) (*shimapi.StateResponse, error) { +func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) { if s.initProcess == nil { return nil, errors.New(ErrContainerNotCreated) } + p, ok := s.processes[r.ID] + if !ok { + return nil, grpc.Errorf(codes.NotFound, "process id %s not found", r.ID) + } st, err := s.initProcess.ContainerStatus(ctx) if err != nil { return nil, err @@ -231,38 +241,17 @@ func (s *Service) State(ctx context.Context, r *google_protobuf.Empty) (*shimapi case "paused": status = task.StatusPaused } - o := &shimapi.StateResponse{ - ID: s.id, - Bundle: s.bundle, - Pid: uint32(s.initProcess.Pid()), - Status: status, - Processes: []*task.Process{}, - Stdin: s.initProcess.stdinPath, - Stdout: s.initProcess.stdoutPath, - Stderr: s.initProcess.stderrPath, - } - s.mu.Lock() - defer s.mu.Unlock() - for _, p := range s.processes { - status := task.StatusRunning - if err := unix.Kill(p.Pid(), 0); err != nil { - if err != syscall.ESRCH { - return nil, err - } - status = task.StatusStopped - } - pp := &task.Process{ - Pid: uint32(p.Pid()), - Status: status, - } - if ep, ok := p.(*execProcess); ok { - pp.Stdin = ep.stdinPath - pp.Stdout = ep.stdoutPath - pp.Stderr = ep.stderrPath - } - o.Processes = append(o.Processes, pp) - } - return o, nil + sio := p.Stdio() + return &shimapi.StateResponse{ + ID: p.ID(), + Bundle: s.bundle, + Pid: uint32(p.Pid()), + Status: status, + Stdin: sio.stdin, + Stdout: sio.stdout, + Stderr: sio.stderr, + Terminal: sio.terminal, + }, nil } func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { @@ -289,35 +278,19 @@ func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_pro if s.initProcess == nil { return nil, errors.New(ErrContainerNotCreated) } - if r.Pid == 0 { + if r.ID == "" { if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil { return nil, err } return empty, nil } - if int(r.Pid) == s.initProcess.pid { - if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil { - return nil, err - } - return empty, nil + p, ok := s.processes[r.ID] + if !ok { + return nil, grpc.Errorf(codes.NotFound, "process id %s not found", r.ID) } - pids, err := s.getContainerPids(ctx, s.initProcess.id) - if err != nil { + if err := p.Kill(ctx, r.Signal, r.All); err != nil { return nil, err } - valid := false - for _, p := range pids { - if r.Pid == p { - valid = true - break - } - } - if !valid { - return nil, errors.Errorf("process %d does not exist in container", r.Pid) - } - if err := unix.Kill(int(r.Pid), syscall.Signal(r.Signal)); err != nil { - return nil, checkKillError(err) - } return empty, nil } @@ -332,9 +305,9 @@ func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*sh } func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*google_protobuf.Empty, error) { - p, ok := s.processes[int(r.Pid)] + p, ok := s.processes[r.ID] if !ok { - return nil, fmt.Errorf("process does not exist %d", r.Pid) + return nil, grpc.Errorf(codes.NotFound, "process does not exist %s", r.ID) } if err := p.Stdin().Close(); err != nil { return nil, err @@ -374,11 +347,12 @@ func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) { reaper.Default.Delete(pid) s.events <- &events.RuntimeEvent{ - Type: events.RuntimeEvent_EXIT, - ID: s.id, - Pid: uint32(pid), - ExitStatus: uint32(status), - ExitedAt: p.ExitedAt(), + Type: events.RuntimeEvent_EXIT, + ID: p.ID(), + ContainerID: s.id, + Pid: uint32(pid), + ExitStatus: uint32(status), + ExitedAt: p.ExitedAt(), } } @@ -387,11 +361,9 @@ func (s *Service) getContainerPids(ctx context.Context, id string) ([]uint32, er if err != nil { return nil, err } - pids := make([]uint32, 0, len(p)) for _, pid := range p { pids = append(pids, uint32(pid)) } - return pids, nil } diff --git a/linux/shim/v1/shim.pb.go b/linux/shim/v1/shim.pb.go index d2cfa4c20..cf35fef3a 100644 --- a/linux/shim/v1/shim.pb.go +++ b/linux/shim/v1/shim.pb.go @@ -16,6 +16,7 @@ ExecProcessRequest ExecProcessResponse ResizePtyRequest + StateRequest StateResponse KillRequest CloseIORequest @@ -102,7 +103,7 @@ func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{2} } type DeleteProcessRequest struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } @@ -110,11 +111,12 @@ func (*DeleteProcessRequest) ProtoMessage() {} func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{3} } type ExecProcessRequest struct { - Terminal bool `protobuf:"varint,1,opt,name=terminal,proto3" json:"terminal,omitempty"` - Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,4,opt,name=stderr,proto3" json:"stderr,omitempty"` - Spec *google_protobuf.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Terminal bool `protobuf:"varint,2,opt,name=terminal,proto3" json:"terminal,omitempty"` + Stdin string `protobuf:"bytes,3,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,4,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,5,opt,name=stderr,proto3" json:"stderr,omitempty"` + Spec *google_protobuf.Any `protobuf:"bytes,6,opt,name=spec" json:"spec,omitempty"` } func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} } @@ -130,7 +132,7 @@ func (*ExecProcessResponse) ProtoMessage() {} func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{5} } type ResizePtyRequest struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Width uint32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` } @@ -139,40 +141,47 @@ func (m *ResizePtyRequest) Reset() { *m = ResizePtyRequest{} func (*ResizePtyRequest) ProtoMessage() {} func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{6} } +type StateRequest struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *StateRequest) Reset() { *m = StateRequest{} } +func (*StateRequest) ProtoMessage() {} +func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} } + type StateResponse struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - Status containerd_v1_types.Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` - Processes []*containerd_v1_types.Process `protobuf:"bytes,5,rep,name=processes" json:"processes,omitempty"` - Stdin string `protobuf:"bytes,6,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,7,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,8,opt,name=stderr,proto3" json:"stderr,omitempty"` - Terminal bool `protobuf:"varint,9,opt,name=terminal,proto3" json:"terminal,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + Status containerd_v1_types.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 *StateResponse) Reset() { *m = StateResponse{} } func (*StateResponse) ProtoMessage() {} -func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} } +func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{8} } type KillRequest struct { - Signal uint32 `protobuf:"varint,1,opt,name=signal,proto3" json:"signal,omitempty"` - All bool `protobuf:"varint,2,opt,name=all,proto3" json:"all,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Signal uint32 `protobuf:"varint,2,opt,name=signal,proto3" json:"signal,omitempty"` + All bool `protobuf:"varint,3,opt,name=all,proto3" json:"all,omitempty"` } func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} -func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{8} } +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{9} } type CloseIORequest struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Stdin bool `protobuf:"varint,2,opt,name=stdin,proto3" json:"stdin,omitempty"` } func (m *CloseIORequest) Reset() { *m = CloseIORequest{} } func (*CloseIORequest) ProtoMessage() {} -func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{9} } +func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{10} } type ListPidsRequest struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -180,7 +189,7 @@ type ListPidsRequest struct { func (m *ListPidsRequest) Reset() { *m = ListPidsRequest{} } func (*ListPidsRequest) ProtoMessage() {} -func (*ListPidsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{10} } +func (*ListPidsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} } type ListPidsResponse struct { Pids []uint32 `protobuf:"varint,1,rep,packed,name=pids" json:"pids,omitempty"` @@ -188,7 +197,7 @@ type ListPidsResponse struct { func (m *ListPidsResponse) Reset() { *m = ListPidsResponse{} } func (*ListPidsResponse) ProtoMessage() {} -func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} } +func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{12} } type CheckpointTaskRequest struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` @@ -197,7 +206,7 @@ type CheckpointTaskRequest struct { func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } func (*CheckpointTaskRequest) ProtoMessage() {} -func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{12} } +func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{13} } type ShimInfoResponse struct { ShimPid uint32 `protobuf:"varint,1,opt,name=shim_pid,json=shimPid,proto3" json:"shim_pid,omitempty"` @@ -205,14 +214,14 @@ type ShimInfoResponse struct { func (m *ShimInfoResponse) Reset() { *m = ShimInfoResponse{} } func (*ShimInfoResponse) ProtoMessage() {} -func (*ShimInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{13} } +func (*ShimInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} } type StreamEventsRequest struct { } func (m *StreamEventsRequest) Reset() { *m = StreamEventsRequest{} } func (*StreamEventsRequest) ProtoMessage() {} -func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} } +func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } type UpdateTaskRequest struct { Resources *google_protobuf.Any `protobuf:"bytes,1,opt,name=resources" json:"resources,omitempty"` @@ -220,7 +229,7 @@ type UpdateTaskRequest struct { func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} } func (*UpdateTaskRequest) ProtoMessage() {} -func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } +func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} } func init() { proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest") @@ -230,6 +239,7 @@ func init() { proto.RegisterType((*ExecProcessRequest)(nil), "containerd.runtime.linux.shim.v1.ExecProcessRequest") proto.RegisterType((*ExecProcessResponse)(nil), "containerd.runtime.linux.shim.v1.ExecProcessResponse") proto.RegisterType((*ResizePtyRequest)(nil), "containerd.runtime.linux.shim.v1.ResizePtyRequest") + proto.RegisterType((*StateRequest)(nil), "containerd.runtime.linux.shim.v1.StateRequest") proto.RegisterType((*StateResponse)(nil), "containerd.runtime.linux.shim.v1.StateResponse") proto.RegisterType((*KillRequest)(nil), "containerd.runtime.linux.shim.v1.KillRequest") proto.RegisterType((*CloseIORequest)(nil), "containerd.runtime.linux.shim.v1.CloseIORequest") @@ -253,7 +263,7 @@ const _ = grpc.SupportPackageIsVersion4 type ShimClient interface { // State returns shim and task state information. - State(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*StateResponse, error) + State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) Start(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Delete(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*DeleteResponse, error) @@ -280,7 +290,7 @@ func NewShimClient(cc *grpc.ClientConn) ShimClient { return &shimClient{cc} } -func (c *shimClient) State(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*StateResponse, error) { +func (c *shimClient) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) { out := new(StateResponse) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/State", in, out, c.cc, opts...) if err != nil { @@ -451,7 +461,7 @@ func (c *shimClient) Update(ctx context.Context, in *UpdateTaskRequest, opts ... type ShimServer interface { // State returns shim and task state information. - State(context.Context, *google_protobuf1.Empty) (*StateResponse, error) + State(context.Context, *StateRequest) (*StateResponse, error) Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) Start(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) Delete(context.Context, *google_protobuf1.Empty) (*DeleteResponse, error) @@ -475,7 +485,7 @@ func RegisterShimServer(s *grpc.Server, srv ShimServer) { } func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(google_protobuf1.Empty) + in := new(StateRequest) if err := dec(in); err != nil { return nil, err } @@ -487,7 +497,7 @@ func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interfac FullMethod: "/containerd.runtime.linux.shim.v1.Shim/State", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).State(ctx, req.(*google_protobuf1.Empty)) + return srv.(ShimServer).State(ctx, req.(*StateRequest)) } return interceptor(ctx, in, info, handler) } @@ -1012,10 +1022,11 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Pid != 0 { - dAtA[i] = 0x8 + if len(m.ID) > 0 { + dAtA[i] = 0xa i++ - i = encodeVarintShim(dAtA, i, uint64(m.Pid)) + i = encodeVarintShim(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } return i, nil } @@ -1035,8 +1046,14 @@ func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { _ = 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.Terminal { - dAtA[i] = 0x8 + dAtA[i] = 0x10 i++ if m.Terminal { dAtA[i] = 1 @@ -1046,25 +1063,25 @@ func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { i++ } if len(m.Stdin) > 0 { - dAtA[i] = 0x12 + dAtA[i] = 0x1a i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Stdin))) i += copy(dAtA[i:], m.Stdin) } if len(m.Stdout) > 0 { - dAtA[i] = 0x1a + dAtA[i] = 0x22 i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Stdout))) i += copy(dAtA[i:], m.Stdout) } if len(m.Stderr) > 0 { - dAtA[i] = 0x22 + dAtA[i] = 0x2a i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Stderr))) i += copy(dAtA[i:], m.Stderr) } if m.Spec != nil { - dAtA[i] = 0x2a + dAtA[i] = 0x32 i++ i = encodeVarintShim(dAtA, i, uint64(m.Spec.Size())) n3, err := m.Spec.MarshalTo(dAtA[i:]) @@ -1114,10 +1131,11 @@ func (m *ResizePtyRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Pid != 0 { - dAtA[i] = 0x8 + if len(m.ID) > 0 { + dAtA[i] = 0xa i++ - i = encodeVarintShim(dAtA, i, uint64(m.Pid)) + i = encodeVarintShim(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } if m.Width != 0 { dAtA[i] = 0x10 @@ -1132,6 +1150,30 @@ func (m *ResizePtyRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *StateRequest) 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 *StateRequest) 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 *StateResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1169,38 +1211,26 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintShim(dAtA, i, uint64(m.Status)) } - if len(m.Processes) > 0 { - for _, msg := range m.Processes { - dAtA[i] = 0x2a - i++ - i = encodeVarintShim(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } if len(m.Stdin) > 0 { - dAtA[i] = 0x32 + dAtA[i] = 0x2a i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Stdin))) i += copy(dAtA[i:], m.Stdin) } if len(m.Stdout) > 0 { - dAtA[i] = 0x3a + dAtA[i] = 0x32 i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Stdout))) i += copy(dAtA[i:], m.Stdout) } if len(m.Stderr) > 0 { - dAtA[i] = 0x42 + dAtA[i] = 0x3a i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Stderr))) i += copy(dAtA[i:], m.Stderr) } if m.Terminal { - dAtA[i] = 0x48 + dAtA[i] = 0x40 i++ if m.Terminal { dAtA[i] = 1 @@ -1227,13 +1257,19 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { _ = 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.Signal != 0 { - dAtA[i] = 0x8 + dAtA[i] = 0x10 i++ i = encodeVarintShim(dAtA, i, uint64(m.Signal)) } if m.All { - dAtA[i] = 0x10 + dAtA[i] = 0x18 i++ if m.All { dAtA[i] = 1 @@ -1242,11 +1278,6 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { } i++ } - if m.Pid != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintShim(dAtA, i, uint64(m.Pid)) - } return i, nil } @@ -1265,10 +1296,11 @@ func (m *CloseIORequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Pid != 0 { - dAtA[i] = 0x8 + if len(m.ID) > 0 { + dAtA[i] = 0xa i++ - i = encodeVarintShim(dAtA, i, uint64(m.Pid)) + i = encodeVarintShim(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) } if m.Stdin { dAtA[i] = 0x10 @@ -1549,8 +1581,9 @@ func (m *DeleteResponse) Size() (n int) { func (m *DeleteProcessRequest) Size() (n int) { var l int _ = l - if m.Pid != 0 { - n += 1 + sovShim(uint64(m.Pid)) + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) } return n } @@ -1558,6 +1591,10 @@ func (m *DeleteProcessRequest) Size() (n int) { func (m *ExecProcessRequest) Size() (n int) { var l int _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } if m.Terminal { n += 2 } @@ -1592,8 +1629,9 @@ func (m *ExecProcessResponse) Size() (n int) { func (m *ResizePtyRequest) Size() (n int) { var l int _ = l - if m.Pid != 0 { - n += 1 + sovShim(uint64(m.Pid)) + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) } if m.Width != 0 { n += 1 + sovShim(uint64(m.Width)) @@ -1604,6 +1642,16 @@ func (m *ResizePtyRequest) Size() (n int) { return n } +func (m *StateRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } + return n +} + func (m *StateResponse) Size() (n int) { var l int _ = l @@ -1621,12 +1669,6 @@ func (m *StateResponse) Size() (n int) { if m.Status != 0 { n += 1 + sovShim(uint64(m.Status)) } - if len(m.Processes) > 0 { - for _, e := range m.Processes { - l = e.Size() - n += 1 + l + sovShim(uint64(l)) - } - } l = len(m.Stdin) if l > 0 { n += 1 + l + sovShim(uint64(l)) @@ -1648,23 +1690,25 @@ func (m *StateResponse) Size() (n int) { func (m *KillRequest) Size() (n int) { var l int _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } if m.Signal != 0 { n += 1 + sovShim(uint64(m.Signal)) } if m.All { n += 2 } - if m.Pid != 0 { - n += 1 + sovShim(uint64(m.Pid)) - } return n } func (m *CloseIORequest) Size() (n int) { var l int _ = l - if m.Pid != 0 { - n += 1 + sovShim(uint64(m.Pid)) + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) } if m.Stdin { n += 2 @@ -1794,7 +1838,7 @@ func (this *DeleteProcessRequest) String() string { return "nil" } s := strings.Join([]string{`&DeleteProcessRequest{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `}`, }, "") return s @@ -1804,6 +1848,7 @@ func (this *ExecProcessRequest) String() string { return "nil" } s := strings.Join([]string{`&ExecProcessRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, @@ -1828,13 +1873,23 @@ func (this *ResizePtyRequest) String() string { return "nil" } s := strings.Join([]string{`&ResizePtyRequest{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Width:` + fmt.Sprintf("%v", this.Width) + `,`, `Height:` + fmt.Sprintf("%v", this.Height) + `,`, `}`, }, "") return s } +func (this *StateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StateRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `}`, + }, "") + return s +} func (this *StateResponse) String() string { if this == nil { return "nil" @@ -1844,7 +1899,6 @@ func (this *StateResponse) String() string { `Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types.Process", 1) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, @@ -1858,9 +1912,9 @@ func (this *KillRequest) String() string { return "nil" } s := strings.Join([]string{`&KillRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Signal:` + fmt.Sprintf("%v", this.Signal) + `,`, `All:` + fmt.Sprintf("%v", this.All) + `,`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s @@ -1870,7 +1924,7 @@ func (this *CloseIORequest) String() string { return "nil" } s := strings.Join([]string{`&CloseIORequest{`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `}`, }, "") @@ -2527,10 +2581,10 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - m.Pid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowShim @@ -2540,11 +2594,21 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift + 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:]) @@ -2596,6 +2660,35 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { } 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 Terminal", wireType) } @@ -2615,7 +2708,7 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { } } m.Terminal = bool(v != 0) - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) } @@ -2644,7 +2737,7 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { } m.Stdin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) } @@ -2673,7 +2766,7 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { } m.Stdout = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) } @@ -2702,7 +2795,7 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { } m.Stderr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } @@ -2855,10 +2948,10 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - m.Pid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowShim @@ -2868,11 +2961,21 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift + 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 Width", wireType) @@ -2932,6 +3035,85 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *StateRequest) 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: StateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateRequest: 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 *StateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3058,37 +3240,6 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error { } } case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Processes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthShim - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Processes = append(m.Processes, &containerd_v1_types.Process{}) - if err := m.Processes[len(m.Processes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) } @@ -3117,7 +3268,7 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error { } m.Stdin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) } @@ -3146,7 +3297,7 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error { } m.Stdout = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) } @@ -3175,7 +3326,7 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error { } m.Stderr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) } @@ -3246,6 +3397,35 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { } 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 Signal", wireType) } @@ -3264,7 +3444,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { break } } - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) } @@ -3284,25 +3464,6 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { } } m.All = bool(v != 0) - case 3: - 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:]) @@ -3354,10 +3515,10 @@ func (m *CloseIORequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - m.Pid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowShim @@ -3367,11 +3528,21 @@ func (m *CloseIORequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift + 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 Stdin", wireType) @@ -4028,75 +4199,75 @@ func init() { } var fileDescriptorShim = []byte{ - // 1114 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xaf, 0x93, 0xd4, 0x4d, 0x5e, 0x94, 0xd2, 0xce, 0x76, 0x8b, 0x37, 0x8b, 0xd2, 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x03, 0xa9, 0xb6, - 0x16, 0x1f, 0xec, 0xa7, 0xca, 0x16, 0xac, 0xd0, 0x80, 0x13, 0xea, 0x33, 0xa3, 0xda, 0xd4, 0x5a, - 0xd5, 0xf6, 0x86, 0x15, 0x67, 0x8b, 0x95, 0x64, 0x8b, 0xb5, 0xeb, 0x5f, 0x39, 0x89, 0x92, 0xf9, - 0x00, 0x50, 0xd6, 0xdd, 0x2c, 0xa0, 0x3e, 0xc3, 0x68, 0x0d, 0x8a, 0x81, 0x72, 0x78, 0xcd, 0x11, - 0x4b, 0xf3, 0x27, 0x0d, 0x56, 0x5f, 0xe2, 0x01, 0xe6, 0x38, 0x5f, 0x09, 0x6d, 0x41, 0x15, 0x5f, - 0x12, 0x7e, 0xc2, 0xb8, 0xcb, 0x23, 0x26, 0x63, 0x52, 0x73, 0x40, 0x6c, 0x1d, 0xcb, 0x1d, 0xb4, - 0x0b, 0x15, 0x21, 0x61, 0xef, 0xc4, 0xe5, 0x32, 0x32, 0xd5, 0x76, 0x7d, 0x8a, 0xdf, 0xab, 0x24, - 0x9b, 0xf7, 0xca, 0xd7, 0x6f, 0xb7, 0x96, 0x7e, 0xfe, 0x73, 0x4b, 0x73, 0xca, 0x31, 0x6c, 0x97, - 0x9b, 0x2d, 0xd8, 0x88, 0x79, 0x74, 0x42, 0xda, 0xc5, 0x8c, 0x25, 0x29, 0x32, 0x4d, 0xf9, 0x17, - 0x0d, 0xd0, 0xc1, 0x25, 0xee, 0x4e, 0x28, 0x66, 0x03, 0xaa, 0xe5, 0x05, 0xb4, 0x70, 0x7b, 0x40, - 0x8b, 0x39, 0x01, 0x2d, 0x8d, 0x05, 0xb4, 0x05, 0x25, 0x16, 0xe0, 0xae, 0x4c, 0x97, 0xbc, 0x00, - 0x48, 0x0d, 0xf3, 0x43, 0xb8, 0x33, 0xc6, 0x30, 0xd7, 0xfd, 0x0e, 0xac, 0x39, 0x98, 0x91, 0x1f, - 0x70, 0x87, 0x5f, 0xe5, 0x5a, 0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c2, 0xbf, + 0x48, 0x99, 0x3b, 0x0c, 0x95, 0xc2, 0xb3, 0xcc, 0x58, 0xdc, 0x90, 0xd8, 0xec, 0x3a, 0xc4, 0xd4, + 0x1e, 0x06, 0xb1, 0xcf, 0x94, 0xdd, 0x27, 0x0b, 0xd8, 0x31, 0x97, 0x5e, 0x88, 0x3f, 0xca, 0xf6, + 0x20, 0x97, 0x2d, 0xc5, 0xd1, 0x25, 0xe9, 0x62, 0x6a, 0xe3, 0x4b, 0xec, 0x33, 0xca, 0x13, 0x39, + 0xce, 0x98, 0xb8, 0xc6, 0xfc, 0xa7, 0x00, 0x6b, 0xfb, 0x11, 0x76, 0x19, 0x7e, 0xe5, 0xd2, 0x0b, + 0x07, 0xbf, 0x89, 0x31, 0x65, 0x68, 0x03, 0x0a, 0xc4, 0x33, 0xb4, 0x96, 0xd6, 0x5e, 0xde, 0xd3, + 0x47, 0x6f, 0x37, 0x0b, 0x87, 0x2f, 0x9c, 0x02, 0xf1, 0xd0, 0x06, 0xe8, 0x67, 0xb1, 0xef, 0x0d, + 0xb0, 0x51, 0xe0, 0x67, 0x8e, 0x92, 0x90, 0x01, 0x15, 0x75, 0xad, 0x51, 0x14, 0x07, 0x63, 0x11, + 0xd9, 0xa0, 0x47, 0x41, 0xc0, 0xce, 0xa9, 0x51, 0x6a, 0x15, 0xdb, 0xb5, 0xce, 0x7b, 0x56, 0x02, + 0x3c, 0x11, 0x99, 0x75, 0xc4, 0x33, 0xe2, 0x28, 0x35, 0xd4, 0x80, 0x2a, 0xc3, 0xd1, 0x90, 0xf8, + 0xee, 0xc0, 0x28, 0xb7, 0xb4, 0x76, 0xd5, 0xb9, 0x95, 0xd1, 0x3a, 0x94, 0x29, 0xf3, 0x88, 0x6f, + 0xe8, 0xe2, 0x23, 0x52, 0xe0, 0x4e, 0x51, 0xe6, 0x05, 0x31, 0x33, 0x2a, 0xd2, 0x29, 0x29, 0xa9, + 0x7d, 0x1c, 0x45, 0x46, 0xf5, 0x76, 0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0x5c, 0xbf, 0xf3, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x23, 0x98, 0xb4, 0x16, 0x0e, 0x00, 0x00, } diff --git a/linux/shim/v1/shim.proto b/linux/shim/v1/shim.proto index 9626bdcf9..bc8604631 100644 --- a/linux/shim/v1/shim.proto +++ b/linux/shim/v1/shim.proto @@ -18,7 +18,7 @@ option go_package = "github.com/containerd/containerd/linux/shim/v1;shim"; // for the container processes. service Shim { // State returns shim and task state information. - rpc State(google.protobuf.Empty) returns (StateResponse); + rpc State(StateRequest) returns (StateResponse); rpc Create(CreateTaskRequest) returns (CreateTaskResponse); @@ -77,15 +77,16 @@ message DeleteResponse { } message DeleteProcessRequest { - uint32 pid = 1; + string id = 1; } message ExecProcessRequest { - bool terminal = 1; - string stdin = 2; - string stdout = 3; - string stderr = 4; - google.protobuf.Any spec = 5; + string id = 1; + bool terminal = 2; + string stdin = 3; + string stdout = 4; + string stderr = 5; + google.protobuf.Any spec = 6; } message ExecProcessResponse { @@ -93,31 +94,34 @@ message ExecProcessResponse { } message ResizePtyRequest { - uint32 pid = 1; + string id = 1; uint32 width = 2; uint32 height = 3; } +message StateRequest { + string id = 1; +} + message StateResponse { string id = 1; string bundle = 2; uint32 pid = 3; containerd.v1.types.Status status = 4; - repeated containerd.v1.types.Process processes = 5; - string stdin = 6; - string stdout = 7; - string stderr = 8; - bool terminal = 9; + string stdin = 5; + string stdout = 6; + string stderr = 7; + bool terminal = 8; } message KillRequest { - uint32 signal = 1; - bool all = 2; - uint32 pid = 3; + string id = 1; + uint32 signal = 2; + bool all = 3; } message CloseIORequest { - uint32 pid = 1; + string id = 1; bool stdin = 2; } diff --git a/linux/task.go b/linux/task.go index de020854b..feacbcec1 100644 --- a/linux/task.go +++ b/linux/task.go @@ -16,25 +16,28 @@ import ( ) type Task struct { - containerID string - shim *client.Client - namespace string + id string + shim *client.Client + namespace string } func newTask(id, namespace string, shim *client.Client) *Task { return &Task{ - containerID: id, - shim: shim, - namespace: namespace, + id: id, + shim: shim, + namespace: namespace, } } +func (t *Task) ID() string { + return t.id +} + func (t *Task) Info() runtime.TaskInfo { return runtime.TaskInfo{ - ID: t.containerID, - ContainerID: t.containerID, - Runtime: pluginID, - Namespace: t.namespace, + ID: t.id, + Runtime: pluginID, + Namespace: t.namespace, } } @@ -47,7 +50,9 @@ func (t *Task) Start(ctx context.Context) error { } func (t *Task) State(ctx context.Context) (runtime.State, error) { - response, err := t.shim.State(ctx, empty) + response, err := t.shim.State(ctx, &shim.StateRequest{ + ID: t.id, + }) if err != nil { return runtime.State{}, errors.New(grpc.ErrorDesc(err)) } @@ -89,10 +94,10 @@ func (t *Task) Resume(ctx context.Context) error { return err } -func (t *Task) Kill(ctx context.Context, signal uint32, pid uint32, all bool) error { +func (t *Task) Kill(ctx context.Context, signal uint32, all bool) error { _, err := t.shim.Kill(ctx, &shim.KillRequest{ + ID: t.id, Signal: signal, - Pid: pid, All: all, }) if err != nil { @@ -101,28 +106,28 @@ func (t *Task) Kill(ctx context.Context, signal uint32, pid uint32, all bool) er return err } -func (t *Task) Exec(ctx context.Context, opts runtime.ExecOpts) (runtime.Process, error) { +func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) { request := &shim.ExecProcessRequest{ + ID: id, Stdin: opts.IO.Stdin, Stdout: opts.IO.Stdout, Stderr: opts.IO.Stderr, Terminal: opts.IO.Terminal, Spec: opts.Spec, } - resp, err := t.shim.Exec(ctx, request) - if err != nil { + if _, err := t.shim.Exec(ctx, request); err != nil { return nil, errors.New(grpc.ErrorDesc(err)) - } return &Process{ - pid: int(resp.Pid), - t: t, + id: id, + t: t, }, nil } func (t *Task) Pids(ctx context.Context) ([]uint32, error) { resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{ - ID: t.containerID, + // TODO: (@crosbymichael) this id can probably be removed + ID: t.id, }) if err != nil { return nil, errors.New(grpc.ErrorDesc(err)) @@ -130,9 +135,9 @@ func (t *Task) Pids(ctx context.Context) ([]uint32, error) { return resp.Pids, nil } -func (t *Task) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSize) error { +func (t *Task) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { _, err := t.shim.ResizePty(ctx, &shim.ResizePtyRequest{ - Pid: pid, + ID: t.id, Width: size.Width, Height: size.Height, }) @@ -142,9 +147,9 @@ func (t *Task) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSi return err } -func (t *Task) CloseIO(ctx context.Context, pid uint32) error { +func (t *Task) CloseIO(ctx context.Context) error { _, err := t.shim.CloseIO(ctx, &shim.CloseIORequest{ - Pid: pid, + ID: t.id, Stdin: true, }) if err != nil { @@ -164,9 +169,9 @@ func (t *Task) Checkpoint(ctx context.Context, path string, options *types.Any) return nil } -func (t *Task) DeleteProcess(ctx context.Context, pid uint32) (*runtime.Exit, error) { +func (t *Task) DeleteProcess(ctx context.Context, id string) (*runtime.Exit, error) { r, err := t.shim.DeleteProcess(ctx, &shim.DeleteProcessRequest{ - Pid: pid, + ID: id, }) if err != nil { return nil, errors.New(grpc.ErrorDesc(err)) @@ -174,7 +179,7 @@ func (t *Task) DeleteProcess(ctx context.Context, pid uint32) (*runtime.Exit, er return &runtime.Exit{ Status: r.ExitStatus, Timestamp: r.ExitedAt, - Pid: pid, + Pid: r.Pid, }, nil } @@ -185,28 +190,10 @@ func (t *Task) Update(ctx context.Context, resources *types.Any) error { return err } -type Process struct { - pid int - t *Task -} - -func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error { - _, err := p.t.shim.Kill(ctx, &shim.KillRequest{ - Signal: signal, - Pid: uint32(p.pid), - }) - if err != nil { - err = errors.New(grpc.ErrorDesc(err)) - } - return err -} - -func (p *Process) State(ctx context.Context) (runtime.State, error) { - // use the container status for the status of the process - state, err := p.t.State(ctx) - if err != nil { - return state, err - } - state.Pid = uint32(p.pid) - return state, nil +func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) { + // TODO: verify process exists for container + return &Process{ + id: id, + t: t, + }, nil } diff --git a/metrics/cgroups/cgroups.go b/metrics/cgroups/cgroups.go index b57db6d31..373ed079b 100644 --- a/metrics/cgroups/cgroups.go +++ b/metrics/cgroups/cgroups.go @@ -73,8 +73,9 @@ func (m *cgroupsMonitor) Events(events chan<- *events.RuntimeEvent) { func (m *cgroupsMonitor) trigger(id string, cg cgroups.Cgroup) { m.events <- &events.RuntimeEvent{ - Timestamp: time.Now(), - Type: events.RuntimeEvent_OOM, - ID: id, + Timestamp: time.Now(), + Type: events.RuntimeEvent_OOM, + ID: id, + ContainerID: id, } } diff --git a/process.go b/process.go index 97ab94007..9255ff882 100644 --- a/process.go +++ b/process.go @@ -11,20 +11,17 @@ import ( ) type process struct { + id string task *task - - // this is a hack to make a blocking Wait work - // exec does not have a create/start split so if a quick exiting process like `exit 1` - // run, the wait does not have enough time to get the pid catch the event. So we need - // to lock this on process struct create and only unlock it after the pid is set - // this allow the wait to be called before calling process start and not race with the exit event - pidSync chan struct{} - - io *IO pid uint32 + io *IO spec *specs.Process } +func (p *process) ID() string { + return p.id +} + // Pid returns the pid of the process // The pid is not set until start is called and returns func (p *process) Pid() uint32 { @@ -38,7 +35,8 @@ func (p *process) Start(ctx context.Context) error { return err } request := &tasks.ExecProcessRequest{ - ContainerID: p.task.containerID, + ContainerID: p.task.id, + ExecID: p.id, Terminal: p.io.Terminal, Stdin: p.io.Stdin, Stdout: p.io.Stdout, @@ -50,17 +48,14 @@ func (p *process) Start(ctx context.Context) error { return err } p.pid = response.Pid - close(p.pidSync) return nil } func (p *process) Kill(ctx context.Context, s syscall.Signal) error { _, err := p.task.client.TaskService().Kill(ctx, &tasks.KillRequest{ Signal: uint32(s), - ContainerID: p.task.containerID, - PidOrAll: &tasks.KillRequest_Pid{ - Pid: p.pid, - }, + ContainerID: p.task.id, + ExecID: p.id, }) return err } @@ -70,7 +65,6 @@ func (p *process) Wait(ctx context.Context) (uint32, error) { if err != nil { return UnknownExitStatus, err } - <-p.pidSync evloop: for { evt, err := eventstream.Recv() @@ -86,7 +80,7 @@ evloop: if e.Type != eventsapi.RuntimeEvent_EXIT { continue evloop } - if e.ID == p.task.containerID && e.Pid == p.pid { + if e.ID == p.id && e.ContainerID == p.task.id { return e.ExitStatus, nil } } @@ -95,8 +89,8 @@ evloop: func (p *process) CloseIO(ctx context.Context, opts ...IOCloserOpts) error { r := &tasks.CloseIORequest{ - ContainerID: p.task.containerID, - Pid: p.pid, + ContainerID: p.task.id, + ExecID: p.id, } for _, o := range opts { o(r) @@ -111,10 +105,10 @@ func (p *process) IO() *IO { func (p *process) Resize(ctx context.Context, w, h uint32) error { _, err := p.task.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{ - ContainerID: p.task.containerID, + ContainerID: p.task.id, Width: w, Height: h, - Pid: p.pid, + ExecID: p.id, }) return err } @@ -122,8 +116,8 @@ func (p *process) Resize(ctx context.Context, w, h uint32) error { func (p *process) Delete(ctx context.Context) (uint32, error) { cerr := p.io.Close() r, err := p.task.client.TaskService().DeleteProcess(ctx, &tasks.DeleteProcessRequest{ - ContainerID: p.task.containerID, - Pid: p.pid, + ContainerID: p.task.id, + ExecID: p.id, }) if err != nil { return UnknownExitStatus, err diff --git a/runtime/task.go b/runtime/task.go index 0de3d76cd..4b3e47b99 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -7,39 +7,47 @@ import ( ) type TaskInfo struct { - ID string - ContainerID string - Runtime string - Namespace string + ID string + Runtime string + Spec []byte + Namespace string +} + +type Process interface { + ID() string + // State returns the process state + State(context.Context) (State, error) + // Kill signals a container + Kill(context.Context, uint32, bool) error + // Pty resizes the processes pty/console + ResizePty(context.Context, ConsoleSize) error + // CloseStdin closes the processes stdin + CloseIO(context.Context) error } type Task interface { + Process + // Information of the container Info() TaskInfo // Start the container's user defined process Start(context.Context) error - // State returns the container's state - State(context.Context) (State, error) // Pause pauses the container process Pause(context.Context) error // Resume unpauses the container process Resume(context.Context) error - // Kill signals a container - Kill(context.Context, uint32, uint32, bool) error // Exec adds a process into the container - Exec(context.Context, ExecOpts) (Process, error) - // Pids returns all pids for the task + Exec(context.Context, string, ExecOpts) (Process, error) + // Pids returns all pids Pids(context.Context) ([]uint32, error) - // Pty resizes the processes pty/console - ResizePty(context.Context, uint32, ConsoleSize) error - // CloseStdin closes the processes stdin - CloseIO(context.Context, uint32) error // Checkpoint checkpoints a container to an image with live system data Checkpoint(context.Context, string, *types.Any) error // DeleteProcess deletes a specific exec process via the pid - DeleteProcess(context.Context, uint32) (*Exit, error) + DeleteProcess(context.Context, string) (*Exit, error) // Update sets the provided resources to a running task Update(context.Context, *types.Any) error + // Process returns a process within the task for the provided id + Process(context.Context, string) (Process, error) } type ExecOpts struct { @@ -47,13 +55,6 @@ type ExecOpts struct { IO IO } -type Process interface { - // State returns the process state - State(context.Context) (State, error) - // Kill signals a container - Kill(context.Context, uint32, bool) error -} - type ConsoleSize struct { Width uint32 Height uint32 diff --git a/services/containers/service.go b/services/containers/service.go index 7208d14fc..37ad9e042 100644 --- a/services/containers/service.go +++ b/services/containers/service.go @@ -107,8 +107,8 @@ func (s *Service) Create(ctx context.Context, req *api.CreateContainerRequest) ( return &resp, errdefs.ToGRPC(err) } if err := s.emit(ctx, "/containers/create", &eventsapi.ContainerCreate{ - ContainerID: resp.Container.ID, - Image: resp.Container.Image, + ID: resp.Container.ID, + Image: resp.Container.Image, Runtime: &eventsapi.ContainerCreate_Runtime{ Name: resp.Container.Runtime.Name, Options: resp.Container.Runtime.Options, @@ -181,10 +181,10 @@ func (s *Service) Update(ctx context.Context, req *api.UpdateContainerRequest) ( } if err := s.emit(ctx, "/containers/update", &eventsapi.ContainerUpdate{ - ContainerID: resp.Container.ID, - Image: resp.Container.Image, - Labels: resp.Container.Labels, - RootFS: resp.Container.RootFS, + ID: resp.Container.ID, + Image: resp.Container.Image, + Labels: resp.Container.Labels, + RootFS: resp.Container.RootFS, }); err != nil { return &resp, err } @@ -200,7 +200,7 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteContainerRequest) ( } if err := s.emit(ctx, "/containers/delete", &eventsapi.ContainerDelete{ - ContainerID: req.ID, + ID: req.ID, }); err != nil { return &empty.Empty{}, err } diff --git a/services/tasks/service.go b/services/tasks/service.go index 28a49f9e4..63a273872 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -36,9 +36,6 @@ var ( empty = &google_protobuf.Empty{} ) -// TODO(stevvooe): Clean up error mapping to avoid double mapping certain -// errors within helper methods. - func init() { plugin.Register(&plugin.Registration{ Type: plugin.GRPCPlugin, @@ -212,11 +209,12 @@ func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest if err != nil { return nil, err } - exit, err := t.DeleteProcess(ctx, r.Pid) + exit, err := t.DeleteProcess(ctx, r.ExecID) if err != nil { return nil, err } return &api.DeleteResponse{ + ID: r.ExecID, ExitStatus: exit.Status, ExitedAt: exit.Timestamp, Pid: exit.Pid, @@ -228,7 +226,6 @@ func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error) if err != nil { return nil, err } - var status task.Status switch state.Status { case runtime.CreatedStatus: @@ -243,14 +240,13 @@ func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error) log.G(ctx).WithField("status", state.Status).Warn("unknown status") } return &task.Task{ - ID: c.Info().ID, - ContainerID: c.Info().ContainerID, - Pid: state.Pid, - Status: status, - Stdin: state.Stdin, - Stdout: state.Stdout, - Stderr: state.Stderr, - Terminal: state.Terminal, + ID: c.Info().ID, + Pid: state.Pid, + Status: status, + Stdin: state.Stdin, + Stdout: state.Stdout, + Stderr: state.Stderr, + Terminal: state.Terminal, }, nil } @@ -315,18 +311,14 @@ func (s *Service) Kill(ctx context.Context, r *api.KillRequest) (*google_protobu if err != nil { return nil, err } - - switch v := r.PidOrAll.(type) { - case *api.KillRequest_All: - if err := t.Kill(ctx, r.Signal, 0, true); err != nil { + p := runtime.Process(t) + if r.ExecID != "" { + if p, err = t.Process(ctx, r.ExecID); err != nil { return nil, err } - case *api.KillRequest_Pid: - if err := t.Kill(ctx, r.Signal, v.Pid, false); err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("invalid option specified; expected pid or all") + } + if err := p.Kill(ctx, r.Signal, r.All); err != nil { + return nil, err } return empty, nil } @@ -346,11 +338,14 @@ func (s *Service) ListPids(ctx context.Context, r *api.ListPidsRequest) (*api.Li } func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.ExecProcessResponse, error) { + if r.ExecID == "" { + return nil, grpc.Errorf(codes.InvalidArgument, "exec id cannot be empty") + } t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err } - process, err := t.Exec(ctx, runtime.ExecOpts{ + process, err := t.Exec(ctx, r.ExecID, runtime.ExecOpts{ Spec: r.Spec, IO: runtime.IO{ Stdin: r.Stdin, @@ -376,7 +371,13 @@ func (s *Service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*goog if err != nil { return nil, err } - if err := t.ResizePty(ctx, r.Pid, runtime.ConsoleSize{ + p := runtime.Process(t) + if r.ExecID != "" { + if p, err = t.Process(ctx, r.ExecID); err != nil { + return nil, err + } + } + if err := p.ResizePty(ctx, runtime.ConsoleSize{ Width: r.Width, Height: r.Height, }); err != nil { @@ -390,8 +391,14 @@ func (s *Service) CloseIO(ctx context.Context, r *api.CloseIORequest) (*google_p if err != nil { return nil, err } + p := runtime.Process(t) + if r.ExecID != "" { + if p, err = t.Process(ctx, r.ExecID); err != nil { + return nil, err + } + } if r.Stdin { - if err := t.CloseIO(ctx, r.Pid); err != nil { + if err := p.CloseIO(ctx); err != nil { return nil, err } } @@ -505,7 +512,6 @@ func (s *Service) getTaskFromContainer(ctx context.Context, container *container return nil, grpc.Errorf(codes.NotFound, "task %v not found", container.ID) } return t, nil - } func (s *Service) getRuntime(name string) (runtime.Runtime, error) { diff --git a/task.go b/task.go index f55f60fda..bfbaa6453 100644 --- a/task.go +++ b/task.go @@ -51,8 +51,8 @@ type Task interface { Start(context.Context) error Status(context.Context) (TaskStatus, error) Wait(context.Context) (uint32, error) - Exec(context.Context, *specs.Process, IOCreation) (Process, error) - Processes(context.Context) ([]uint32, error) + Exec(context.Context, string, *specs.Process, IOCreation) (Process, error) + Pids(context.Context) ([]uint32, error) CloseIO(context.Context, ...IOCloserOpts) error Resize(ctx context.Context, w, h uint32) error IO() *IO @@ -76,12 +76,11 @@ var _ = (Task)(&task{}) type task struct { client *Client - io *IO - containerID string - pid uint32 + io *IO + id string + pid uint32 deferred *tasks.CreateTaskRequest - pidSync chan struct{} } // Pid returns the pid or process id for the task @@ -97,11 +96,10 @@ func (t *task) Start(ctx context.Context) error { return err } t.pid = response.Pid - close(t.pidSync) return nil } _, err := t.client.TaskService().Start(ctx, &tasks.StartTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, }) return err } @@ -109,10 +107,7 @@ func (t *task) Start(ctx context.Context) error { func (t *task) Kill(ctx context.Context, s syscall.Signal) error { _, err := t.client.TaskService().Kill(ctx, &tasks.KillRequest{ Signal: uint32(s), - ContainerID: t.containerID, - PidOrAll: &tasks.KillRequest_Pid{ - Pid: t.pid, - }, + ContainerID: t.id, }) if err != nil { if strings.Contains(grpc.ErrorDesc(err), runtime.ErrProcessExited.Error()) { @@ -125,21 +120,21 @@ func (t *task) Kill(ctx context.Context, s syscall.Signal) error { func (t *task) Pause(ctx context.Context) error { _, err := t.client.TaskService().Pause(ctx, &tasks.PauseTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, }) return err } func (t *task) Resume(ctx context.Context) error { _, err := t.client.TaskService().Resume(ctx, &tasks.ResumeTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, }) return err } func (t *task) Status(ctx context.Context) (TaskStatus, error) { r, err := t.client.TaskService().Get(ctx, &tasks.GetTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, }) if err != nil { return "", err @@ -153,8 +148,6 @@ func (t *task) Wait(ctx context.Context) (uint32, error) { if err != nil { return UnknownExitStatus, err } - <-t.pidSync - for { evt, err := eventstream.Recv() if err != nil { @@ -169,7 +162,7 @@ func (t *task) Wait(ctx context.Context) (uint32, error) { if e.Type != eventsapi.RuntimeEvent_EXIT { continue } - if e.ID == t.containerID && e.Pid == t.pid { + if e.ID == t.id && e.Pid == t.pid { return e.ExitStatus, nil } } @@ -185,7 +178,7 @@ func (t *task) Delete(ctx context.Context) (uint32, error) { cerr = t.io.Close() } r, err := t.client.TaskService().Delete(ctx, &tasks.DeleteTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, }) if err != nil { return UnknownExitStatus, err @@ -193,22 +186,22 @@ func (t *task) Delete(ctx context.Context) (uint32, error) { return r.ExitStatus, cerr } -func (t *task) Exec(ctx context.Context, spec *specs.Process, ioCreate IOCreation) (Process, error) { +func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate IOCreation) (Process, error) { i, err := ioCreate() if err != nil { return nil, err } return &process{ - task: t, - io: i, - spec: spec, - pidSync: make(chan struct{}), + id: id, + task: t, + io: i, + spec: spec, }, nil } -func (t *task) Processes(ctx context.Context) ([]uint32, error) { +func (t *task) Pids(ctx context.Context) ([]uint32, error) { response, err := t.client.TaskService().ListPids(ctx, &tasks.ListPidsRequest{ - ContainerID: t.containerID, + ContainerID: t.id, }) if err != nil { return nil, err @@ -218,8 +211,7 @@ func (t *task) Processes(ctx context.Context) ([]uint32, error) { func (t *task) CloseIO(ctx context.Context, opts ...IOCloserOpts) error { r := &tasks.CloseIORequest{ - ContainerID: t.containerID, - Pid: t.pid, + ContainerID: t.id, } for _, o := range opts { o(r) @@ -234,17 +226,16 @@ func (t *task) IO() *IO { func (t *task) Resize(ctx context.Context, w, h uint32) error { _, err := t.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{ - ContainerID: t.containerID, + ContainerID: t.id, Width: w, Height: h, - Pid: t.pid, }) return err } func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Descriptor, err error) { request := &tasks.CheckpointTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, } for _, o := range opts { if err := o(request); err != nil { @@ -257,7 +248,7 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Des } defer t.Resume(ctx) cr, err := t.client.ContainerService().Get(ctx, &containers.GetContainerRequest{ - ID: t.containerID, + ID: t.id, }) if err != nil { return d, err @@ -281,7 +272,7 @@ type UpdateTaskOpts func(context.Context, *Client, *tasks.UpdateTaskRequest) err func (t *task) Update(ctx context.Context, opts ...UpdateTaskOpts) error { request := &tasks.UpdateTaskRequest{ - ContainerID: t.containerID, + ContainerID: t.id, } for _, o := range opts { if err := o(ctx, t.client, request); err != nil { @@ -342,7 +333,7 @@ func (t *task) writeIndex(ctx context.Context, index *v1.Index) (v1.Descriptor, if err := json.NewEncoder(buf).Encode(index); err != nil { return v1.Descriptor{}, err } - return writeContent(ctx, t.client.ContentStore(), v1.MediaTypeImageIndex, t.containerID, buf) + return writeContent(ctx, t.client.ContentStore(), v1.MediaTypeImageIndex, t.id, buf) } func writeContent(ctx context.Context, store content.Store, mediaType, ref string, r io.Reader) (d v1.Descriptor, err error) { diff --git a/windows/container.go b/windows/container.go index 6d8b50e72..4f1c1bc5f 100644 --- a/windows/container.go +++ b/windows/container.go @@ -68,6 +68,10 @@ type container struct { sendEvent eventCallback } +func (c *container) ID() string { + return c.ctr.ID() +} + func (c *container) Info() runtime.TaskInfo { return runtime.TaskInfo{ ID: c.ctr.ID(), @@ -122,14 +126,23 @@ func (c *container) State(ctx context.Context) (runtime.State, error) { }, nil } -func (c *container) Kill(ctx context.Context, signal uint32, pid uint32, all bool) error { +func (c *container) Kill(ctx context.Context, signal uint32, all bool) error { if winsys.Signal(signal) == winsys.SIGKILL { return c.ctr.Kill(ctx) } return c.ctr.Stop(ctx) } -func (c *container) Exec(ctx context.Context, opts runtime.ExecOpts) (runtime.Process, error) { +func (c *container) Process(ctx context.Context, id string) (runtime.Process, error) { + for _, p := range c.ctr.Processes() { + if p.ID() == id { + return &process{p}, nil + } + } + return nil, errors.Errorf("process %s not found", id) +} + +func (c *container) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) { if c.ctr.Pid() == 0 { return nil, ErrLoadedContainer } @@ -144,7 +157,7 @@ func (c *container) Exec(ctx context.Context, opts runtime.ExecOpts) (runtime.Pr return nil, errors.Wrap(err, "failed to unmarshal oci spec") } - p, err := c.ctr.AddProcess(ctx, &procSpec, pio) + p, err := c.ctr.AddProcess(ctx, id, &procSpec, pio) if err != nil { return nil, err } @@ -160,12 +173,12 @@ func (c *container) Exec(ctx context.Context, opts runtime.ExecOpts) (runtime.Pr return &process{p}, nil } -func (c *container) CloseIO(ctx context.Context, pid uint32) error { - return c.ctr.CloseIO(ctx, pid) +func (c *container) CloseIO(ctx context.Context) error { + return c.ctr.CloseIO(ctx) } -func (c *container) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSize) error { - return c.ctr.ResizePty(ctx, pid, size) +func (c *container) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { + return c.ctr.ResizePty(ctx, size) } func (c *container) Status() runtime.Status { @@ -192,16 +205,16 @@ func (c *container) Checkpoint(ctx context.Context, _ string, _ *types.Any) erro return fmt.Errorf("Windows containers do not support checkpoint") } -func (c *container) DeleteProcess(ctx context.Context, pid uint32) (*runtime.Exit, error) { +func (c *container) DeleteProcess(ctx context.Context, id string) (*runtime.Exit, error) { var process *hcs.Process for _, p := range c.ctr.Processes() { - if p.Pid() == pid { + if p.ID() == id { process = p break } } if process == nil { - return nil, fmt.Errorf("process %d not found", pid) + return nil, fmt.Errorf("process %s not found", id) } ec, err := process.ExitCode() if err != nil { diff --git a/windows/hcs/hcs.go b/windows/hcs/hcs.go index 55cfb9ae6..38582e326 100644 --- a/windows/hcs/hcs.go +++ b/windows/hcs/hcs.go @@ -172,7 +172,7 @@ func (c *Container) Processes() []*Process { } func (c *Container) Start(ctx context.Context) error { - _, err := c.addProcess(ctx, c.spec.Process, c.io) + _, err := c.addProcess(ctx, c.id, c.spec.Process, c.io) return err } @@ -199,35 +199,35 @@ func (c *Container) Stop(ctx context.Context) error { return nil } -func (c *Container) CloseIO(ctx context.Context, pid uint32) error { +func (c *Container) CloseIO(ctx context.Context) error { var proc *Process c.Lock() for _, p := range c.processes { - if p.Pid() == pid { + if p.id == c.id { proc = p break } } c.Unlock() if proc == nil { - return errors.Errorf("no such process %v", pid) + return errors.Errorf("no such process %s", c.id) } return proc.CloseStdin() } -func (c *Container) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSize) error { +func (c *Container) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { var proc *Process c.Lock() for _, p := range c.processes { - if p.Pid() == pid { + if p.id == c.id { proc = p break } } c.Unlock() if proc == nil { - return errors.Errorf("no such process %v", pid) + return errors.Errorf("no such process %s", c.id) } return proc.ResizeConsole(uint16(size.Width), uint16(size.Height)) @@ -303,15 +303,14 @@ func (c *Container) GetConfiguration() Configuration { return c.conf } -func (c *Container) AddProcess(ctx context.Context, spec *specs.Process, io *IO) (*Process, error) { +func (c *Container) AddProcess(ctx context.Context, id string, spec *specs.Process, io *IO) (*Process, error) { if len(c.processes) == 0 { return nil, errors.New("container not started") } - - return c.addProcess(ctx, spec, io) + return c.addProcess(ctx, id, spec, io) } -func (c *Container) addProcess(ctx context.Context, spec *specs.Process, pio *IO) (*Process, error) { +func (c *Container) addProcess(ctx context.Context, id string, spec *specs.Process, pio *IO) (*Process, error) { // If we don't have a process yet, reused the container pid var pid uint32 if len(c.processes) == 0 { @@ -388,6 +387,7 @@ func (c *Container) addProcess(ctx context.Context, spec *specs.Process, pio *IO } p := &Process{ + id: id, Process: proc, pid: pid, io: pio, diff --git a/windows/hcs/process.go b/windows/hcs/process.go index 463e05930..5b70a261a 100644 --- a/windows/hcs/process.go +++ b/windows/hcs/process.go @@ -14,6 +14,7 @@ import ( type Process struct { hcsshim.Process + id string pid uint32 io *IO ec uint32 @@ -22,6 +23,10 @@ type Process struct { ecSync chan struct{} } +func (p *Process) ID() string { + return p.id +} + func (p *Process) Pid() uint32 { return p.pid } diff --git a/windows/process.go b/windows/process.go index 5c527c830..57c67141b 100644 --- a/windows/process.go +++ b/windows/process.go @@ -32,3 +32,11 @@ func (p *process) Status() runtime.Status { func (p *process) Pid() uint32 { return p.Process.Pid() } + +func (p *process) CloseIO(ctx context.Context) error { + return p.Process.CloseStdin() +} + +func (p *process) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { + return p.Process.ResizeConsole(uint16(size.Width), uint16(size.Height)) +}