Add Exec IDs

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-06-28 12:54:10 -07:00
parent e283b3802d
commit f93bfb6233
36 changed files with 1441 additions and 2055 deletions

View File

@ -65,7 +65,7 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type ContainerCreate struct { type ContainerCreate 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"`
Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,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"` Runtime *ContainerCreate_Runtime `protobuf:"bytes,3,opt,name=runtime" json:"runtime,omitempty"`
} }
@ -86,7 +86,7 @@ func (*ContainerCreate_Runtime) Descriptor() ([]byte, []int) {
} }
type ContainerUpdate struct { type ContainerUpdate 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"`
Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,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"` 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"` RootFS string `protobuf:"bytes,4,opt,name=rootfs,proto3" json:"rootfs,omitempty"`
@ -97,7 +97,7 @@ func (*ContainerUpdate) ProtoMessage() {}
func (*ContainerUpdate) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{1} } func (*ContainerUpdate) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{1} }
type ContainerDelete struct { 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{} } func (m *ContainerDelete) Reset() { *m = ContainerDelete{} }
@ -125,11 +125,11 @@ func (m *ContainerCreate) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if len(m.ID) > 0 {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ID)
} }
if len(m.Image) > 0 { if len(m.Image) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0x12
@ -199,11 +199,11 @@ func (m *ContainerUpdate) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if len(m.ID) > 0 {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ID)
} }
if len(m.Image) > 0 { if len(m.Image) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0x12
@ -252,11 +252,11 @@ func (m *ContainerDelete) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if len(m.ID) > 0 {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ID)
} }
return i, nil return i, nil
} }
@ -291,7 +291,7 @@ func encodeVarintContainer(dAtA []byte, offset int, v uint64) int {
func (m *ContainerCreate) Size() (n int) { func (m *ContainerCreate) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ContainerID) l = len(m.ID)
if l > 0 { if l > 0 {
n += 1 + l + sovContainer(uint64(l)) n += 1 + l + sovContainer(uint64(l))
} }
@ -323,7 +323,7 @@ func (m *ContainerCreate_Runtime) Size() (n int) {
func (m *ContainerUpdate) Size() (n int) { func (m *ContainerUpdate) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ContainerID) l = len(m.ID)
if l > 0 { if l > 0 {
n += 1 + l + sovContainer(uint64(l)) n += 1 + l + sovContainer(uint64(l))
} }
@ -349,7 +349,7 @@ func (m *ContainerUpdate) Size() (n int) {
func (m *ContainerDelete) Size() (n int) { func (m *ContainerDelete) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ContainerID) l = len(m.ID)
if l > 0 { if l > 0 {
n += 1 + l + sovContainer(uint64(l)) n += 1 + l + sovContainer(uint64(l))
} }
@ -374,7 +374,7 @@ func (this *ContainerCreate) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&ContainerCreate{`, s := strings.Join([]string{`&ContainerCreate{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Image:` + fmt.Sprintf("%v", this.Image) + `,`, `Image:` + fmt.Sprintf("%v", this.Image) + `,`,
`Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "ContainerCreate_Runtime", "ContainerCreate_Runtime", 1) + `,`, `Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "ContainerCreate_Runtime", "ContainerCreate_Runtime", 1) + `,`,
`}`, `}`,
@ -407,7 +407,7 @@ func (this *ContainerUpdate) String() string {
} }
mapStringForLabels += "}" mapStringForLabels += "}"
s := strings.Join([]string{`&ContainerUpdate{`, s := strings.Join([]string{`&ContainerUpdate{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Image:` + fmt.Sprintf("%v", this.Image) + `,`, `Image:` + fmt.Sprintf("%v", this.Image) + `,`,
`Labels:` + mapStringForLabels + `,`, `Labels:` + mapStringForLabels + `,`,
`RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, `RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`,
@ -420,7 +420,7 @@ func (this *ContainerDelete) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&ContainerDelete{`, s := strings.Join([]string{`&ContainerDelete{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -464,7 +464,7 @@ func (m *ContainerCreate) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -489,7 +489,7 @@ func (m *ContainerCreate) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -717,7 +717,7 @@ func (m *ContainerUpdate) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -742,7 +742,7 @@ func (m *ContainerUpdate) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -970,7 +970,7 @@ func (m *ContainerDelete) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -995,7 +995,7 @@ func (m *ContainerDelete) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
@ -1128,31 +1128,31 @@ func init() {
} }
var fileDescriptorContainer = []byte{ var fileDescriptorContainer = []byte{
// 413 bytes of a gzipped FileDescriptorProto // 401 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x4d, 0x8b, 0xd5, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x41, 0x8b, 0xd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06, 0xc5, 0x8e,
0xec, 0x7c, 0xf0, 0xf1, 0xf9, 0x8e, 0x3f, 0xe1, 0x99, 0x41, 0xb1, 0xad, 0x1f, 0xf2, 0xd1, 0xef, 0x7e, 0x90, 0x07, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x68, 0xeb, 0xf5, 0x3f, 0xfe, 0x02, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x0b, 0xcd, 0x09, 0x52, 0x03, 0x00, 0x00, 0x00,
} }

View File

@ -8,7 +8,7 @@ import "google/protobuf/any.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events"; option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message ContainerCreate { message ContainerCreate {
string container_id = 1; string id = 1;
string image = 2; string image = 2;
message Runtime { message Runtime {
string name = 1; string name = 1;
@ -18,12 +18,12 @@ message ContainerCreate {
} }
message ContainerUpdate { message ContainerUpdate {
string container_id = 1; string id = 1;
string image = 2; string image = 2;
map<string, string> labels = 3; map<string, string> labels = 3;
string rootfs = 4 [(gogoproto.customname) = "RootFS"]; string rootfs = 4 [(gogoproto.customname) = "RootFS"];
} }
message ContainerDelete { message ContainerDelete {
string container_id = 1; string id = 1;
} }

View File

@ -82,7 +82,7 @@ func (*RuntimeMount) ProtoMessage() {}
func (*RuntimeMount) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{1} } func (*RuntimeMount) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{1} }
type RuntimeCreate struct { type RuntimeCreate struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,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"` Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
RootFS []*RuntimeMount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` RootFS []*RuntimeMount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"`
IO *RuntimeIO `protobuf:"bytes,4,opt,name=io" json:"io,omitempty"` IO *RuntimeIO `protobuf:"bytes,4,opt,name=io" json:"io,omitempty"`
@ -95,11 +95,12 @@ func (*RuntimeCreate) Descriptor() ([]byte, []int) { return fileDescriptorRuntim
type RuntimeEvent struct { type RuntimeEvent struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 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"` 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"` Type RuntimeEvent_EventType `protobuf:"varint,3,opt,name=type,proto3,enum=containerd.services.events.v1.RuntimeEvent_EventType" json:"type,omitempty"`
ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` Pid uint32 `protobuf:"varint,4,opt,name=pid,proto3" json:"pid,omitempty"`
ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` ExitStatus uint32 `protobuf:"varint,5,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,stdtime" json:"timestamp"` 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{} } func (m *RuntimeEvent) Reset() { *m = RuntimeEvent{} }
@ -107,7 +108,7 @@ func (*RuntimeEvent) ProtoMessage() {}
func (*RuntimeEvent) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{3} } func (*RuntimeEvent) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{3} }
type RuntimeDelete struct { type RuntimeDelete struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 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"` 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"` 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"` ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"`
@ -231,11 +232,11 @@ func (m *RuntimeCreate) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if len(m.ContainerID) > 0 {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) i = encodeVarintRuntime(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ID) i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.Bundle) > 0 { if len(m.Bundle) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0x12
@ -295,22 +296,28 @@ func (m *RuntimeEvent) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], 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 { if m.Type != 0 {
dAtA[i] = 0x10 dAtA[i] = 0x18
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(m.Type)) i = encodeVarintRuntime(dAtA, i, uint64(m.Type))
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x18 dAtA[i] = 0x20
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(m.Pid)) i = encodeVarintRuntime(dAtA, i, uint64(m.Pid))
} }
if m.ExitStatus != 0 { if m.ExitStatus != 0 {
dAtA[i] = 0x20 dAtA[i] = 0x28
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(m.ExitStatus)) i = encodeVarintRuntime(dAtA, i, uint64(m.ExitStatus))
} }
dAtA[i] = 0x2a dAtA[i] = 0x32
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) 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:]) 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 return 0, err
} }
i += n2 i += n2
dAtA[i] = 0x32 dAtA[i] = 0x3a
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) 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:]) 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 _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if len(m.ContainerID) > 0 {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) i = encodeVarintRuntime(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ID) i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.Runtime) > 0 { if len(m.Runtime) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0x12
@ -443,7 +450,7 @@ func (m *RuntimeMount) Size() (n int) {
func (m *RuntimeCreate) Size() (n int) { func (m *RuntimeCreate) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ID) l = len(m.ContainerID)
if l > 0 { if l > 0 {
n += 1 + l + sovRuntime(uint64(l)) n += 1 + l + sovRuntime(uint64(l))
} }
@ -475,6 +482,10 @@ func (m *RuntimeEvent) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovRuntime(uint64(l)) n += 1 + l + sovRuntime(uint64(l))
} }
l = len(m.ContainerID)
if l > 0 {
n += 1 + l + sovRuntime(uint64(l))
}
if m.Type != 0 { if m.Type != 0 {
n += 1 + sovRuntime(uint64(m.Type)) n += 1 + sovRuntime(uint64(m.Type))
} }
@ -494,7 +505,7 @@ func (m *RuntimeEvent) Size() (n int) {
func (m *RuntimeDelete) Size() (n int) { func (m *RuntimeDelete) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ID) l = len(m.ContainerID)
if l > 0 { if l > 0 {
n += 1 + l + sovRuntime(uint64(l)) n += 1 + l + sovRuntime(uint64(l))
} }
@ -553,7 +564,7 @@ func (this *RuntimeCreate) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&RuntimeCreate{`, s := strings.Join([]string{`&RuntimeCreate{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`, `Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
`RootFS:` + strings.Replace(fmt.Sprintf("%v", this.RootFS), "RuntimeMount", "RuntimeMount", 1) + `,`, `RootFS:` + strings.Replace(fmt.Sprintf("%v", this.RootFS), "RuntimeMount", "RuntimeMount", 1) + `,`,
`IO:` + strings.Replace(fmt.Sprintf("%v", this.IO), "RuntimeIO", "RuntimeIO", 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{`, s := strings.Join([]string{`&RuntimeEvent{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Type:` + fmt.Sprintf("%v", this.Type) + `,`, `Type:` + fmt.Sprintf("%v", this.Type) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
@ -582,7 +594,7 @@ func (this *RuntimeDelete) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&RuntimeDelete{`, s := strings.Join([]string{`&RuntimeDelete{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`, `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 { switch fieldNum {
case 1: case 1:
if wireType != 2 { 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 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -948,7 +960,7 @@ func (m *RuntimeCreate) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.ID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -1152,6 +1164,35 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error {
m.ID = string(dAtA[iNdEx:postIndex]) m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: 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 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
} }
@ -1170,7 +1211,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error {
break break
} }
} }
case 3: case 4:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
} }
@ -1189,7 +1230,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error {
break break
} }
} }
case 4: case 5:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType)
} }
@ -1208,7 +1249,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error {
break break
} }
} }
case 5: case 6:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType)
} }
@ -1238,7 +1279,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 6: case 7:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
} }
@ -1320,7 +1361,7 @@ func (m *RuntimeDelete) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { 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 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1345,7 +1386,7 @@ func (m *RuntimeDelete) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.ID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -1556,44 +1597,45 @@ func init() {
} }
var fileDescriptorRuntime = []byte{ var fileDescriptorRuntime = []byte{
// 610 bytes of a gzipped FileDescriptorProto // 639 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6b, 0xdb, 0x4c,
0x10, 0xb6, 0x24, 0x5b, 0xb1, 0xc6, 0x7f, 0x82, 0x58, 0xc2, 0x8f, 0x30, 0x54, 0x0e, 0x3e, 0x19, 0x10, 0xb6, 0x24, 0x7f, 0x8e, 0x93, 0xbc, 0x62, 0x09, 0x41, 0x18, 0x5e, 0x29, 0xf8, 0x64, 0x78,
0x0a, 0x12, 0x71, 0xe9, 0xa9, 0x50, 0x6a, 0xc7, 0x2a, 0xf8, 0x10, 0xdc, 0xae, 0x55, 0x08, 0xbd, 0x41, 0x22, 0x7e, 0xe9, 0xa9, 0x50, 0x6a, 0x5b, 0x2a, 0xe8, 0x10, 0xdc, 0xae, 0x55, 0x08, 0xbd,
0x04, 0xd9, 0xda, 0x38, 0x4b, 0x6d, 0xad, 0x58, 0xad, 0x4c, 0x73, 0xeb, 0x23, 0xf4, 0x25, 0xfa, 0x18, 0xd9, 0xda, 0x38, 0x4b, 0x6d, 0xad, 0x90, 0x56, 0xa6, 0xb9, 0xf5, 0x17, 0x94, 0xfe, 0x96,
0x2e, 0x39, 0xf6, 0xd8, 0x53, 0xda, 0xf8, 0x11, 0xfa, 0x00, 0xa5, 0x68, 0x57, 0x56, 0x42, 0xa1, 0xfe, 0x83, 0xde, 0x72, 0xec, 0xb1, 0x27, 0xb7, 0xd1, 0x2f, 0x29, 0x5a, 0xc9, 0x4a, 0x68, 0x21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 0x05, 0x1d, 0x01, 0x38, 0x17,
0x5e, 0xf9, 0x5f, 0x2e, 0x6d, 0xb7, 0x85, 0x7f, 0x9e, 0xcf, 0xd8, 0x7d, 0xbe, 0xfa, 0x63, 0xce, 0xce, 0x64, 0x3e, 0xb2, 0x6d, 0xc7, 0x56, 0xeb, 0x79, 0xd9, 0xeb, 0xd1, 0xdb, 0x99, 0x63, 0xab,
0x37, 0x3c, 0xbb, 0xbe, 0x75, 0x6b, 0xdf, 0x6e, 0xdd, 0xda, 0xa7, 0x8d, 0xab, 0x5d, 0x6f, 0x5c, 0x8d, 0xfe, 0x57, 0xa9, 0xba, 0x62, 0x9b, 0xac, 0xc9, 0x13, 0xaf, 0x58, 0x83, 0x56, 0xf9, 0xdd,
0xed, 0xeb, 0xc6, 0xd5, 0x7e, 0x6c, 0x5c, 0xed, 0xfd, 0xcb, 0x47, 0x7e, 0x99, 0x5e, 0xa8, 0x68, 0x28, 0xcf, 0x78, 0x0f, 0x7f, 0xb7, 0x56, 0x79, 0xd8, 0xda, 0xfa, 0x53, 0xac, 0x1d, 0x5f, 0xdc,
0x66, 0xca, 0x0d, 0x9e, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x39, 0x80, 0x2a, 0xe2, 0x04, 0xdc, 0xea, 0xb5, 0xef, 0xb7, 0x7a, 0xed, 0x63, 0xa6, 0x4b, 0x37, 0x99, 0x2e, 0x7d, 0xcb, 0x74,
0x00, 0x00, 0xe9, 0x67, 0xa6, 0x4b, 0xef, 0x5e, 0x3c, 0xf1, 0x2b, 0xf8, 0xbc, 0x88, 0x16, 0x4d, 0xf1, 0x82,
0xff, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x14, 0xb7, 0x09, 0x4e, 0x05, 0x00, 0x00,
} }

View File

@ -21,7 +21,7 @@ message RuntimeMount {
} }
message RuntimeCreate { message RuntimeCreate {
string id = 1; string container_id = 1;
string bundle = 2; string bundle = 2;
repeated RuntimeMount rootfs = 3 [(gogoproto.customname) = "RootFS"]; repeated RuntimeMount rootfs = 3 [(gogoproto.customname) = "RootFS"];
RuntimeIO io = 4 [(gogoproto.customname) = "IO"]; RuntimeIO io = 4 [(gogoproto.customname) = "IO"];
@ -30,6 +30,7 @@ message RuntimeCreate {
message RuntimeEvent { message RuntimeEvent {
string id = 1; string id = 1;
string container_id = 2;
enum EventType { enum EventType {
EXIT = 0; EXIT = 0;
OOM = 1; OOM = 1;
@ -38,15 +39,15 @@ message RuntimeEvent {
EXEC_ADDED = 4; EXEC_ADDED = 4;
PAUSED = 5; PAUSED = 5;
} }
EventType type = 2; EventType type = 3;
uint32 pid = 3; uint32 pid = 4;
uint32 exit_status = 4; uint32 exit_status = 5;
google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp exited_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp timestamp = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp timestamp = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
} }
message RuntimeDelete { message RuntimeDelete {
string id = 1; string container_id = 1;
string runtime = 2; string runtime = 2;
uint32 exit_status = 3; uint32 exit_status = 3;
google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];

View File

@ -73,12 +73,7 @@ var _ = time.Kitchen
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type CreateTaskRequest struct { type CreateTaskRequest struct {
// ContainerID specifies the container to use for creating this task. ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
//
// 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"`
// RootFS provides the pre-chroot mounts to perform in the shim before // RootFS provides the pre-chroot mounts to perform in the shim before
// executing the container task. // executing the container task.
// //
@ -99,8 +94,8 @@ func (*CreateTaskRequest) ProtoMessage() {}
func (*CreateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{0} } func (*CreateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{0} }
type CreateTaskResponse struct { type CreateTaskResponse struct {
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"`
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"`
} }
func (m *CreateTaskResponse) Reset() { *m = CreateTaskResponse{} } func (m *CreateTaskResponse) Reset() { *m = CreateTaskResponse{} }
@ -124,7 +119,7 @@ func (*DeleteTaskRequest) ProtoMessage() {}
func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} } func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} }
type DeleteResponse struct { type DeleteResponse 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"`
Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,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"` 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"` ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"`
@ -136,7 +131,7 @@ func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks
type DeleteProcessRequest struct { type DeleteProcessRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
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{} } func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} }
@ -177,124 +172,16 @@ func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTa
type KillRequest struct { type KillRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
Signal uint32 `protobuf:"varint,2,opt,name=signal,proto3" json:"signal,omitempty"` ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
// Types that are valid to be assigned to PidOrAll: Signal uint32 `protobuf:"varint,3,opt,name=signal,proto3" json:"signal,omitempty"`
// *KillRequest_All All bool `protobuf:"varint,4,opt,name=all,proto3" json:"all,omitempty"`
// *KillRequest_Pid
PidOrAll isKillRequest_PidOrAll `protobuf_oneof:"pid_or_all"`
} }
func (m *KillRequest) Reset() { *m = KillRequest{} } func (m *KillRequest) Reset() { *m = KillRequest{} }
func (*KillRequest) ProtoMessage() {} func (*KillRequest) ProtoMessage() {}
func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} } 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 { 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"` 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"` Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"`
Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,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. // For runc, this is a process spec, for example.
Spec *google_protobuf1.Any `protobuf:"bytes,6,opt,name=spec" json:"spec,omitempty"` 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{} } func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} }
@ -320,7 +209,7 @@ func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptor
type ResizePtyRequest struct { type ResizePtyRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
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"` Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
Height uint32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,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 { type CloseIORequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
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"` 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 var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if len(m.ContainerID) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0xa
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ContainerID)
@ -1065,13 +954,13 @@ func (m *CreateTaskResponse) MarshalTo(dAtA []byte) (int, error) {
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if len(m.ContainerID) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0xa
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ContainerID)
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x18 dAtA[i] = 0x10
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) i = encodeVarintTasks(dAtA, i, uint64(m.Pid))
} }
@ -1141,11 +1030,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if len(m.ID) > 0 {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ID)
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x10 dAtA[i] = 0x10
@ -1189,10 +1078,11 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ContainerID)
} }
if m.Pid != 0 { if len(m.ExecID) > 0 {
dAtA[i] = 0x10 dAtA[i] = 0x12
i++ 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 return i, nil
} }
@ -1324,24 +1214,19 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], 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 { if m.Signal != 0 {
dAtA[i] = 0x10 dAtA[i] = 0x18
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(m.Signal)) i = encodeVarintTasks(dAtA, i, uint64(m.Signal))
} }
if m.PidOrAll != nil { if m.All {
nn5, err := m.PidOrAll.MarshalTo(dAtA[i:]) dAtA[i] = 0x20
if err != nil {
return 0, err
}
i += nn5
}
return i, nil
}
func (m *KillRequest_All) MarshalTo(dAtA []byte) (int, error) {
i := 0
dAtA[i] = 0x18
i++ i++
if m.All { if m.All {
dAtA[i] = 1 dAtA[i] = 1
@ -1349,15 +1234,10 @@ func (m *KillRequest_All) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i++
}
return i, nil 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) { func (m *ExecProcessRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -1411,11 +1291,17 @@ func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x32 dAtA[i] = 0x32
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(m.Spec.Size())) 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 { if err != nil {
return 0, err 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 return i, nil
} }
@ -1464,10 +1350,11 @@ func (m *ResizePtyRequest) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ContainerID)
} }
if m.Pid != 0 { if len(m.ExecID) > 0 {
dAtA[i] = 0x10 dAtA[i] = 0x12
i++ 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 { if m.Width != 0 {
dAtA[i] = 0x18 dAtA[i] = 0x18
@ -1503,10 +1390,11 @@ func (m *CloseIORequest) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ContainerID)
} }
if m.Pid != 0 { if len(m.ExecID) > 0 {
dAtA[i] = 0x10 dAtA[i] = 0x12
i++ 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 { if m.Stdin {
dAtA[i] = 0x18 dAtA[i] = 0x18
@ -1609,21 +1497,21 @@ func (m *ListPidsResponse) MarshalTo(dAtA []byte) (int, error) {
var l int var l int
_ = l _ = l
if len(m.Pids) > 0 { if len(m.Pids) > 0 {
dAtA8 := make([]byte, len(m.Pids)*10) dAtA7 := make([]byte, len(m.Pids)*10)
var j7 int var j6 int
for _, num := range m.Pids { for _, num := range m.Pids {
for num >= 1<<7 { for num >= 1<<7 {
dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) dAtA7[j6] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7 num >>= 7
j7++ j6++
} }
dAtA8[j7] = uint8(num) dAtA7[j6] = uint8(num)
j7++ j6++
} }
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(j7)) i = encodeVarintTasks(dAtA, i, uint64(j6))
i += copy(dAtA[i:], dAtA8[:j7]) i += copy(dAtA[i:], dAtA7[:j6])
} }
return i, nil return i, nil
} }
@ -1659,11 +1547,11 @@ func (m *CheckpointTaskRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x1a dAtA[i] = 0x1a
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(m.Options.Size())) 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 { if err != nil {
return 0, err return 0, err
} }
i += n9 i += n8
} }
return i, nil return i, nil
} }
@ -1723,11 +1611,11 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ i++
i = encodeVarintTasks(dAtA, i, uint64(m.Resources.Size())) 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 { if err != nil {
return 0, err return 0, err
} }
i += n10 i += n9
} }
return i, nil return i, nil
} }
@ -1834,7 +1722,7 @@ func (m *DeleteTaskRequest) Size() (n int) {
func (m *DeleteResponse) Size() (n int) { func (m *DeleteResponse) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ContainerID) l = len(m.ID)
if l > 0 { if l > 0 {
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
@ -1856,8 +1744,9 @@ func (m *DeleteProcessRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
if m.Pid != 0 { l = len(m.ExecID)
n += 1 + sovTasks(uint64(m.Pid)) if l > 0 {
n += 1 + l + sovTasks(uint64(l))
} }
return n return n
} }
@ -1911,27 +1800,19 @@ func (m *KillRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
l = len(m.ExecID)
if l > 0 {
n += 1 + l + sovTasks(uint64(l))
}
if m.Signal != 0 { if m.Signal != 0 {
n += 1 + sovTasks(uint64(m.Signal)) n += 1 + sovTasks(uint64(m.Signal))
} }
if m.PidOrAll != nil { if m.All {
n += m.PidOrAll.Size() n += 2
} }
return n 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) { func (m *ExecProcessRequest) Size() (n int) {
var l int var l int
_ = l _ = l
@ -1958,6 +1839,10 @@ func (m *ExecProcessRequest) Size() (n int) {
l = m.Spec.Size() l = m.Spec.Size()
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
l = len(m.ExecID)
if l > 0 {
n += 1 + l + sovTasks(uint64(l))
}
return n return n
} }
@ -1977,8 +1862,9 @@ func (m *ResizePtyRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
if m.Pid != 0 { l = len(m.ExecID)
n += 1 + sovTasks(uint64(m.Pid)) if l > 0 {
n += 1 + l + sovTasks(uint64(l))
} }
if m.Width != 0 { if m.Width != 0 {
n += 1 + sovTasks(uint64(m.Width)) n += 1 + sovTasks(uint64(m.Width))
@ -1996,8 +1882,9 @@ func (m *CloseIORequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
if m.Pid != 0 { l = len(m.ExecID)
n += 1 + sovTasks(uint64(m.Pid)) if l > 0 {
n += 1 + l + sovTasks(uint64(l))
} }
if m.Stdin { if m.Stdin {
n += 2 n += 2
@ -2158,7 +2045,7 @@ func (this *DeleteResponse) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&DeleteResponse{`, s := strings.Join([]string{`&DeleteResponse{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf3.Timestamp", 1), `&`, ``, 1) + `,`, `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{`, s := strings.Join([]string{`&DeleteProcessRequest{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -2223,32 +2110,13 @@ func (this *KillRequest) String() string {
} }
s := strings.Join([]string{`&KillRequest{`, s := strings.Join([]string{`&KillRequest{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`Signal:` + fmt.Sprintf("%v", this.Signal) + `,`, `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) + `,`, `All:` + fmt.Sprintf("%v", this.All) + `,`,
`}`, `}`,
}, "") }, "")
return s 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 { func (this *ExecProcessRequest) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
@ -2260,6 +2128,7 @@ func (this *ExecProcessRequest) String() string {
`Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`,
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
`Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`,
`ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -2280,7 +2149,7 @@ func (this *ResizePtyRequest) String() string {
} }
s := strings.Join([]string{`&ResizePtyRequest{`, s := strings.Join([]string{`&ResizePtyRequest{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`Width:` + fmt.Sprintf("%v", this.Width) + `,`, `Width:` + fmt.Sprintf("%v", this.Width) + `,`,
`Height:` + fmt.Sprintf("%v", this.Height) + `,`, `Height:` + fmt.Sprintf("%v", this.Height) + `,`,
`}`, `}`,
@ -2293,7 +2162,7 @@ func (this *CloseIORequest) String() string {
} }
s := strings.Join([]string{`&CloseIORequest{`, s := strings.Join([]string{`&CloseIORequest{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `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) return fmt.Errorf("proto: CreateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 2: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType)
} }
@ -2692,7 +2561,7 @@ func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: CreateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: CreateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 2: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType)
} }
@ -2721,7 +2590,7 @@ func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error {
} }
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 3: case 2:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
} }
@ -2950,7 +2819,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2975,7 +2844,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 { if wireType != 0 {
@ -3125,10 +2994,10 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error {
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType)
} }
m.Pid = 0 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowTasks return ErrIntOverflowTasks
@ -3138,11 +3007,21 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 { if b < 0x80 {
break 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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTasks(dAtA[iNdEx:]) skippy, err := skipTasks(dAtA[iNdEx:])
@ -3545,6 +3424,35 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error {
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: 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 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Signal", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Signal", wireType)
} }
@ -3563,7 +3471,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error {
break break
} }
} }
case 3: case 4:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) return fmt.Errorf("proto: wrong wireType = %d for field All", wireType)
} }
@ -3582,28 +3490,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error {
break break
} }
} }
b := bool(v != 0) m.All = 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}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTasks(dAtA[iNdEx:]) skippy, err := skipTasks(dAtA[iNdEx:])
@ -3823,6 +3710,35 @@ func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex 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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTasks(dAtA[iNdEx:]) skippy, err := skipTasks(dAtA[iNdEx:])
@ -3972,10 +3888,10 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error {
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType)
} }
m.Pid = 0 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowTasks return ErrIntOverflowTasks
@ -3985,11 +3901,21 @@ func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 { if b < 0x80 {
break 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: case 3:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) 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]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType)
} }
m.Pid = 0 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowTasks return ErrIntOverflowTasks
@ -4121,11 +4047,21 @@ func (m *CloseIORequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 { if b < 0x80 {
break 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: case 3:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType)
@ -4960,80 +4896,80 @@ func init() {
} }
var fileDescriptorTasks = []byte{ var fileDescriptorTasks = []byte{
// 1191 bytes of a gzipped FileDescriptorProto // 1200 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6e, 0x1b, 0xc5, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4d, 0x6f, 0x1b, 0xc5,
0x17, 0xcf, 0xc6, 0x1f, 0x75, 0x8e, 0x9b, 0x36, 0x99, 0x7f, 0xfe, 0xc1, 0x5d, 0x2a, 0x3b, 0xda, 0x1b, 0xef, 0xfa, 0x65, 0x63, 0x3f, 0xfe, 0xa7, 0x49, 0xf6, 0x1f, 0x82, 0xbb, 0x54, 0x76, 0xb4,
0x0b, 0x30, 0x15, 0xd9, 0x25, 0x2e, 0xe2, 0x82, 0x56, 0x88, 0x26, 0x0e, 0x21, 0x02, 0x94, 0x74, 0x48, 0x60, 0x2a, 0xb2, 0x4b, 0x5c, 0xc4, 0x81, 0x56, 0x88, 0x24, 0x0e, 0x91, 0x05, 0x28, 0xe9,
0x53, 0x10, 0xaa, 0x90, 0xac, 0x8d, 0x77, 0xe2, 0x8c, 0xb2, 0xde, 0xd9, 0xee, 0x8c, 0xd3, 0x06, 0xa6, 0x20, 0xd4, 0x8b, 0xb5, 0xf1, 0x4e, 0x9c, 0x51, 0xec, 0x9d, 0xed, 0xce, 0x38, 0x4d, 0xe0,
0x6e, 0xb8, 0xe2, 0x16, 0xde, 0x82, 0x77, 0xe0, 0x09, 0x72, 0xc9, 0x05, 0x17, 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e, 0xda, 0xdf, 0xbd, 0x92, 0xf6, 0xec, 0xf1, 0xeb, 0xfd, 0x28, 0xf2, 0x48, 0x2c, 0x0e, 0x74, 0x71,
0x07, 0x52, 0x7c, 0x18, 0x11, 0x00, 0x00, 0xcf, 0xc3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xc3, 0x21, 0xef, 0x5b, 0x11, 0x00, 0x00,
} }

View File

@ -49,14 +49,7 @@ service Tasks {
} }
message CreateTaskRequest { message CreateTaskRequest {
// NOTE: reserve field 1 for task id. string container_id = 1;
// 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;
// RootFS provides the pre-chroot mounts to perform in the shim before // RootFS provides the pre-chroot mounts to perform in the shim before
// executing the container task. // executing the container task.
@ -77,17 +70,8 @@ message CreateTaskRequest {
} }
message CreateTaskResponse { message CreateTaskResponse {
// TODO(stevvooe): We no longer have an id for a task since they are bound string container_id = 1;
// to a single container. Although, we should represent each new task with uint32 pid = 2;
// 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;
} }
message StartTaskRequest { message StartTaskRequest {
@ -99,7 +83,7 @@ message DeleteTaskRequest {
} }
message DeleteResponse { message DeleteResponse {
string container_id = 1; string id = 1;
uint32 pid = 2; uint32 pid = 2;
uint32 exit_status = 3; uint32 exit_status = 3;
google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
@ -107,7 +91,7 @@ message DeleteResponse {
message DeleteProcessRequest { message DeleteProcessRequest {
string container_id = 1; string container_id = 1;
uint32 pid = 2; string exec_id = 2;
} }
message GetTaskRequest { message GetTaskRequest {
@ -128,26 +112,23 @@ message ListTasksResponse {
message KillRequest { message KillRequest {
string container_id = 1; string container_id = 1;
uint32 signal = 2; string exec_id = 2;
oneof pid_or_all { uint32 signal = 3;
bool all = 3; bool all = 4;
uint32 pid = 4;
}
} }
message ExecProcessRequest { message ExecProcessRequest {
// ContainerID specifies the container in which to exec the process.
string container_id = 1; string container_id = 1;
string stdin = 2; string stdin = 2;
string stdout = 3; string stdout = 3;
string stderr = 4; string stderr = 4;
bool terminal = 5; bool terminal = 5;
// Spec for starting a process in the target container. // Spec for starting a process in the target container.
// //
// For runc, this is a process spec, for example. // For runc, this is a process spec, for example.
google.protobuf.Any spec = 6; google.protobuf.Any spec = 6;
// id of the exec process
string exec_id = 7;
} }
message ExecProcessResponse { message ExecProcessResponse {
@ -156,14 +137,14 @@ message ExecProcessResponse {
message ResizePtyRequest { message ResizePtyRequest {
string container_id = 1; string container_id = 1;
uint32 pid = 2; string exec_id = 2;
uint32 width = 3; uint32 width = 3;
uint32 height = 4; uint32 height = 4;
} }
message CloseIORequest { message CloseIORequest {
string container_id = 1; string container_id = 1;
uint32 pid = 2; string exec_id = 2;
bool stdin = 3; bool stdin = 3;
} }

File diff suppressed because it is too large Load Diff

View File

@ -17,33 +17,12 @@ enum Status {
} }
message Task { message Task {
string id = 1; // TODO(stevvooe): For now, this is just the container id. string id = 1;
string container_id = 2; uint32 pid = 2;
uint32 pid = 3; Status status = 3;
Status status = 4; google.protobuf.Any spec = 4;
string stdin = 5; string stdin = 5;
string stdout = 6; string stdout = 6;
string stderr = 7; string stderr = 7;
bool terminal = 8; 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;
}

View File

@ -71,7 +71,10 @@ func main() {
return err return err
} }
server := grpc.NewServer() server := grpc.NewServer()
sv, err := shim.NewService(path, context.GlobalString("namespace")) sv, err := shim.NewService(
path,
context.GlobalString("namespace"),
)
if err != nil { if err != nil {
return err return err
} }

View File

@ -63,7 +63,7 @@ func getEventOutput(env *eventsapi.Envelope) (string, error) {
} }
switch e := v.(type) { switch e := v.(type) {
case *eventsapi.ContainerCreate: 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: case *eventsapi.TaskCreate:
out = "id=" + e.ContainerID out = "id=" + e.ContainerID
case *eventsapi.TaskStart: case *eventsapi.TaskStart:
@ -71,9 +71,9 @@ func getEventOutput(env *eventsapi.Envelope) (string, error) {
case *eventsapi.TaskDelete: case *eventsapi.TaskDelete:
out = fmt.Sprintf("id=%s pid=%d status=%d", e.ContainerID, e.Pid, e.ExitStatus) out = fmt.Sprintf("id=%s pid=%d status=%d", e.ContainerID, e.Pid, e.ExitStatus)
case *eventsapi.ContainerUpdate: case *eventsapi.ContainerUpdate:
out = "id=" + e.ContainerID out = "id=" + e.ID
case *eventsapi.ContainerDelete: case *eventsapi.ContainerDelete:
out = "id=" + e.ContainerID out = "id=" + e.ID
case *eventsapi.SnapshotPrepare: case *eventsapi.SnapshotPrepare:
out = fmt.Sprintf("key=%s parent=%s", e.Key, e.Parent) out = fmt.Sprintf("key=%s parent=%s", e.Key, e.Parent)
case *eventsapi.SnapshotCommit: case *eventsapi.SnapshotCommit:
@ -95,11 +95,11 @@ func getEventOutput(env *eventsapi.Envelope) (string, error) {
for _, m := range e.RootFS { for _, m := range e.RootFS {
mounts = append(mounts, fmt.Sprintf("type=%s:src=%s", m.Type, m.Source)) 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: 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: 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: default:
out = env.Event.TypeUrl out = env.Event.TypeUrl
} }

View File

@ -22,6 +22,10 @@ var execCommand = cli.Command{
Name: "tty,t", Name: "tty,t",
Usage: "allocate a TTY for the container", 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 { Action: func(context *cli.Context) error {
var ( var (
@ -60,7 +64,7 @@ var execCommand = cli.Command{
if tty { if tty {
io = containerd.StdioTerminal io = containerd.StdioTerminal
} }
process, err := task.Exec(ctx, pspec, io) process, err := task.Exec(ctx, context.String("exec-id"), pspec, io)
if err != nil { if err != nil {
return err return err
} }

View File

@ -36,7 +36,7 @@ var psCommand = cli.Command{
if err != nil { if err != nil {
return err return err
} }
processes, err := task.Processes(ctx) processes, err := task.Pids(ctx)
if err != nil { if err != nil {
return err return err
} }

View File

@ -129,7 +129,7 @@ var shimCreateCommand = cli.Command{
return err return err
} }
if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{ if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{
Pid: r.Pid, ID: id,
Width: uint32(size.Width), Width: uint32(size.Width),
Height: uint32(size.Height), Height: uint32(size.Height),
}); err != nil { }); err != nil {
@ -180,7 +180,9 @@ var shimStateCommand = cli.Command{
if err != nil { if err != nil {
return err return err
} }
r, err := service.State(gocontext.Background(), empty) r, err := service.State(gocontext.Background(), &shim.StateRequest{
ID: context.Args().First(),
})
if err != nil { if err != nil {
return err return err
} }
@ -221,10 +223,18 @@ var shimExecCommand = cli.Command{
), ),
Action: func(context *cli.Context) error { Action: func(context *cli.Context) error {
service, err := getShimService(context) service, err := getShimService(context)
ctx := gocontext.Background()
if err != nil { if err != nil {
return err return err
} }
var (
id = context.Args().First()
ctx = gocontext.Background()
)
if id == "" {
return errors.New("exec id must be provided")
}
tty := context.Bool("tty") tty := context.Bool("tty")
wg, err := prepareStdio(context.String("stdin"), context.String("stdout"), context.String("stderr"), tty) wg, err := prepareStdio(context.String("stdin"), context.String("stdout"), context.String("stderr"), tty)
if err != nil { if err != nil {
@ -242,6 +252,7 @@ var shimExecCommand = cli.Command{
} }
rq := &shim.ExecProcessRequest{ rq := &shim.ExecProcessRequest{
ID: id,
Spec: &protobuf.Any{ Spec: &protobuf.Any{
TypeUrl: url, TypeUrl: url,
Value: spec, Value: spec,
@ -269,7 +280,7 @@ var shimExecCommand = cli.Command{
return err return err
} }
if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{ if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{
Pid: r.Pid, ID: id,
Width: uint32(size.Width), Width: uint32(size.Width),
Height: uint32(size.Height), Height: uint32(size.Height),
}); err != nil { }); err != nil {

View File

@ -204,8 +204,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne
t := &task{ t := &task{
client: c.client, client: c.client,
io: i, io: i,
containerID: c.ID(), id: c.ID(),
pidSync: make(chan struct{}),
} }
if request.Checkpoint != nil { if request.Checkpoint != nil {
@ -217,7 +216,6 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne
return nil, err return nil, err
} }
t.pid = response.Pid t.pid = response.Pid
close(t.pidSync)
} }
return t, nil return t, nil
} }
@ -250,16 +248,11 @@ func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, erro
return nil, err 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{ t := &task{
client: c.client, client: c.client,
io: i, io: i,
containerID: response.Task.ContainerID, id: response.Task.ID,
pid: response.Task.Pid, pid: response.Task.Pid,
pidSync: ps,
} }
return t, nil return t, nil
} }

View File

@ -263,8 +263,8 @@ func TestContainerExec(t *testing.T) {
"sh", "-c", "sh", "-c",
"exit 6", "exit 6",
} }
execID := t.Name() + "_exec"
process, err := task.Exec(ctx, processSpec, empty()) process, err := task.Exec(ctx, execID, processSpec, empty())
if err != nil { if err != nil {
t.Error(err) t.Error(err)
return return
@ -354,7 +354,7 @@ func TestContainerProcesses(t *testing.T) {
if pid <= 0 { if pid <= 0 {
t.Errorf("invalid task pid %d", pid) t.Errorf("invalid task pid %d", pid)
} }
processes, err := task.Processes(ctx) processes, err := task.Pids(ctx)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
return return

View File

@ -50,7 +50,7 @@ func (l *taskList) addWithNamespace(namespace string, t *Task) error {
l.mu.Lock() l.mu.Lock()
defer l.mu.Unlock() defer l.mu.Unlock()
id := t.containerID id := t.id
if _, ok := l.tasks[namespace]; !ok { if _, ok := l.tasks[namespace]; !ok {
l.tasks[namespace] = make(map[string]*Task) 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] tasks, ok := l.tasks[namespace]
if ok { if ok {
delete(tasks, t.containerID) delete(tasks, t.id)
} }
} }

86
linux/process.go Normal file
View File

@ -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
}

View File

@ -201,7 +201,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
}) })
} }
if err := r.emit(ctx, "/runtime/create", &eventsapi.RuntimeCreate{ if err := r.emit(ctx, "/runtime/create", &eventsapi.RuntimeCreate{
ID: id, ContainerID: id,
Bundle: bundle.path, Bundle: bundle.path,
RootFS: runtimeMounts, RootFS: runtimeMounts,
IO: &eventsapi.RuntimeIO{ IO: &eventsapi.RuntimeIO{
@ -239,11 +239,11 @@ func (r *Runtime) Delete(ctx context.Context, c runtime.Task) (*runtime.Exit, er
r.tasks.delete(ctx, lc) r.tasks.delete(ctx, lc)
var ( var (
bundle = loadBundle(filepath.Join(r.root, namespace, lc.containerID), namespace) bundle = loadBundle(filepath.Join(r.root, namespace, lc.id), namespace)
i = c.Info() i = c.Info()
) )
if err := r.emit(ctx, "/runtime/delete", &eventsapi.RuntimeDelete{ if err := r.emit(ctx, "/runtime/delete", &eventsapi.RuntimeDelete{
ID: i.ID, ContainerID: i.ID,
Runtime: i.Runtime, Runtime: i.Runtime,
ExitStatus: rsp.ExitStatus, ExitStatus: rsp.ExitStatus,
ExitedAt: rsp.ExitedAt, ExitedAt: rsp.ExitedAt,
@ -324,7 +324,7 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
continue continue
} }
o = append(o, &Task{ o = append(o, &Task{
containerID: id, id: id,
shim: s, shim: s,
namespace: ns, namespace: ns,
}) })

View File

@ -26,7 +26,7 @@ import (
type execProcess struct { type execProcess struct {
sync.WaitGroup sync.WaitGroup
id int id string
console console.Console console console.Console
io runc.IO io runc.IO
status int status int
@ -34,29 +34,27 @@ type execProcess struct {
pid int pid int
closers []io.Closer closers []io.Closer
stdin io.Closer stdin io.Closer
stdio stdio
parent *initProcess 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{ e := &execProcess{
id: id, id: id,
parent: parent, parent: parent,
stdinPath: r.Stdin, stdio: stdio{
stdoutPath: r.Stdout, stdin: r.Stdin,
stderrPath: r.Stderr, stdout: r.Stdout,
stderr: r.Stderr,
terminal: r.Terminal, terminal: r.Terminal,
},
} }
var ( var (
err error err error
socket *runc.Socket socket *runc.Socket
io runc.IO 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 r.Terminal {
if socket, err = runc.NewConsoleSocket(filepath.Join(path, "pty.sock")); err != nil { 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 return e, nil
} }
func (e *execProcess) ID() string {
return e.id
}
func (e *execProcess) Pid() int { func (e *execProcess) Pid() int {
return e.pid return e.pid
} }
@ -155,7 +157,7 @@ func (e *execProcess) Resize(ws console.WinSize) error {
return e.console.Resize(ws) 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 { if err := unix.Kill(e.pid, syscall.Signal(sig)); err != nil {
return checkKillError(err) return checkKillError(err)
} }
@ -165,3 +167,7 @@ func (e *execProcess) Signal(sig int) error {
func (e *execProcess) Stdin() io.Closer { func (e *execProcess) Stdin() io.Closer {
return e.stdin return e.stdin
} }
func (e *execProcess) Stdio() stdio {
return e.stdio
}

View File

@ -48,11 +48,7 @@ type initProcess struct {
pid int pid int
closers []io.Closer closers []io.Closer
stdin io.Closer stdin io.Closer
stdio stdio
stdinPath string
stdoutPath string
stderrPath string
terminal bool
} }
func newInitProcess(context context.Context, path, namespace string, r *shimapi.CreateTaskRequest) (*initProcess, error) { func newInitProcess(context context.Context, path, namespace string, r *shimapi.CreateTaskRequest) (*initProcess, error) {
@ -85,10 +81,12 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi.
id: r.ID, id: r.ID,
bundle: r.Bundle, bundle: r.Bundle,
runtime: runtime, runtime: runtime,
stdinPath: r.Stdin, stdio: stdio{
stdoutPath: r.Stdout, stdin: r.Stdin,
stderrPath: r.Stderr, stdout: r.Stdout,
stderr: r.Stderr,
terminal: r.Terminal, terminal: r.Terminal,
},
} }
var ( var (
err error err error
@ -171,6 +169,10 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi.
return p, nil return p, nil
} }
func (p *initProcess) ID() string {
return p.id
}
func (p *initProcess) Pid() int { func (p *initProcess) Pid() int {
return p.pid return p.pid
} }
@ -257,10 +259,6 @@ func (p *initProcess) killAll(context context.Context) error {
return p.runtimeError(err, "OCI runtime killall failed") 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 { func (p *initProcess) Stdin() io.Closer {
return p.stdin 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) return p.runtime.Update(context, p.id, &resources)
} }
func (p *initProcess) Stdio() stdio {
return p.stdio
}
// TODO(mlaventure): move to runc package? // TODO(mlaventure): move to runc package?
func getLastRuntimeError(r *runc.Runc) (string, error) { func getLastRuntimeError(r *runc.Runc) (string, error) {
if r.Log == "" { if r.Log == "" {

View File

@ -60,7 +60,7 @@ func (c *local) Stream(ctx context.Context, in *shimapi.StreamEventsRequest, opt
}, nil }, 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) return c.s.State(ctx, in)
} }

View File

@ -10,7 +10,16 @@ import (
"github.com/containerd/console" "github.com/containerd/console"
) )
type stdio struct {
stdin string
stdout string
stderr string
terminal bool
}
type process interface { type process interface {
// ID returns the id for the process
ID() string
// Pid returns the pid for the process // Pid returns the pid for the process
Pid() int Pid() int
// Resize resizes the process console // Resize resizes the process console
@ -23,8 +32,10 @@ type process interface {
ExitedAt() time.Time ExitedAt() time.Time
// Delete deletes the process and its resourcess // Delete deletes the process and its resourcess
Delete(context.Context) error Delete(context.Context) error
// Signal directly signals the process
Signal(int) error
// Stdin returns the process STDIN // Stdin returns the process STDIN
Stdin() io.Closer Stdin() io.Closer
// Kill kills the process
Kill(context.Context, uint32, bool) error
// Stdio returns io information for the container
Stdio() stdio
} }

View File

@ -6,7 +6,9 @@ import (
"fmt" "fmt"
"os" "os"
"sync" "sync"
"syscall"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"github.com/containerd/console" "github.com/containerd/console"
events "github.com/containerd/containerd/api/services/events/v1" events "github.com/containerd/containerd/api/services/events/v1"
@ -16,7 +18,6 @@ import (
google_protobuf "github.com/golang/protobuf/ptypes/empty" google_protobuf "github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"
"golang.org/x/sys/unix"
) )
const ( const (
@ -34,7 +35,7 @@ func NewService(path, namespace string) (*Service, error) {
} }
return &Service{ return &Service{
path: path, path: path,
processes: make(map[int]process), processes: make(map[string]process),
events: make(chan *events.RuntimeEvent, 4096), events: make(chan *events.RuntimeEvent, 4096),
namespace: namespace, namespace: namespace,
}, nil }, nil
@ -46,25 +47,28 @@ type Service struct {
id string id string
bundle string bundle string
mu sync.Mutex mu sync.Mutex
processes map[int]process processes map[string]process
events chan *events.RuntimeEvent events chan *events.RuntimeEvent
eventsMu sync.Mutex eventsMu sync.Mutex
deferredEvent *events.RuntimeEvent deferredEvent *events.RuntimeEvent
execID int
namespace string namespace string
} }
func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*shimapi.CreateTaskResponse, error) { 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) process, err := newInitProcess(ctx, s.path, s.namespace, r)
if err != nil { if err != nil {
return nil, err return nil, err
} }
s.mu.Lock() s.mu.Lock()
// save the main task id and bundle to the shim for additional requests
s.id = r.ID s.id = r.ID
s.bundle = r.Bundle s.bundle = r.Bundle
s.initProcess = process s.initProcess = process
pid := process.Pid() pid := process.Pid()
s.processes[pid] = process s.processes[r.ID] = process
s.mu.Unlock() s.mu.Unlock()
cmd := &reaper.Cmd{ cmd := &reaper.Cmd{
ExitCh: make(chan int, 1), ExitCh: make(chan int, 1),
@ -73,6 +77,7 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*sh
s.events <- &events.RuntimeEvent{ s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_CREATE, Type: events.RuntimeEvent_CREATE,
ID: r.ID, ID: r.ID,
ContainerID: s.id,
Pid: uint32(pid), Pid: uint32(pid),
} }
go s.waitExit(process, pid, cmd) go s.waitExit(process, pid, cmd)
@ -91,6 +96,7 @@ func (s *Service) Start(ctx context.Context, r *google_protobuf.Empty) (*google_
s.events <- &events.RuntimeEvent{ s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_START, Type: events.RuntimeEvent_START,
ID: s.id, ID: s.id,
ContainerID: s.id,
Pid: uint32(s.initProcess.Pid()), Pid: uint32(s.initProcess.Pid()),
} }
return empty, nil 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 // TODO (@crosbymichael): how to handle errors here
p.Delete(ctx) p.Delete(ctx)
s.mu.Lock() s.mu.Lock()
delete(s.processes, p.Pid()) delete(s.processes, p.ID())
s.mu.Unlock() s.mu.Unlock()
return &shimapi.DeleteResponse{ return &shimapi.DeleteResponse{
ExitStatus: uint32(p.Status()), ExitStatus: uint32(p.Status()),
@ -117,19 +123,19 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq
if s.initProcess == nil { if s.initProcess == nil {
return nil, errors.New(ErrContainerNotCreated) return nil, errors.New(ErrContainerNotCreated)
} }
if int(r.Pid) == s.initProcess.pid { if r.ID == s.initProcess.id {
return nil, fmt.Errorf("cannot delete init process with DeleteProcess") return nil, grpc.Errorf(codes.InvalidArgument, "cannot delete init process with DeleteProcess")
} }
s.mu.Lock() s.mu.Lock()
p, ok := s.processes[int(r.Pid)] p, ok := s.processes[r.ID]
s.mu.Unlock() s.mu.Unlock()
if !ok { 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 // TODO (@crosbymichael): how to handle errors here
p.Delete(ctx) p.Delete(ctx)
s.mu.Lock() s.mu.Lock()
delete(s.processes, p.Pid()) delete(s.processes, p.ID())
s.mu.Unlock() s.mu.Unlock()
return &shimapi.DeleteResponse{ return &shimapi.DeleteResponse{
ExitStatus: uint32(p.Status()), ExitStatus: uint32(p.Status()),
@ -144,9 +150,8 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi
} }
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() 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 { if err != nil {
return nil, err return nil, err
} }
@ -155,11 +160,12 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi
ExitCh: make(chan int, 1), ExitCh: make(chan int, 1),
} }
reaper.Default.Register(pid, cmd) reaper.Default.Register(pid, cmd)
s.processes[pid] = process s.processes[r.ID] = process
s.events <- &events.RuntimeEvent{ s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_EXEC_ADDED, Type: events.RuntimeEvent_EXEC_ADDED,
ID: s.id, ID: r.ID,
ContainerID: s.id,
Pid: uint32(pid), Pid: uint32(pid),
} }
go s.waitExit(process, pid, cmd) go s.waitExit(process, pid, cmd)
@ -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) { func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) {
if r.Pid == 0 { if r.ID == "" {
return nil, errors.Errorf("pid not provided in request") return nil, grpc.Errorf(codes.InvalidArgument, "id not provided")
} }
ws := console.WinSize{ ws := console.WinSize{
Width: uint16(r.Width), Width: uint16(r.Width),
Height: uint16(r.Height), Height: uint16(r.Height),
} }
s.mu.Lock() s.mu.Lock()
p, ok := s.processes[int(r.Pid)] p, ok := s.processes[r.ID]
s.mu.Unlock() s.mu.Unlock()
if !ok { 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 { if err := p.Resize(ws); err != nil {
return nil, err 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 { if s.initProcess == nil {
return nil, errors.New(ErrContainerNotCreated) 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) st, err := s.initProcess.ContainerStatus(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
@ -231,38 +241,17 @@ func (s *Service) State(ctx context.Context, r *google_protobuf.Empty) (*shimapi
case "paused": case "paused":
status = task.StatusPaused status = task.StatusPaused
} }
o := &shimapi.StateResponse{ sio := p.Stdio()
ID: s.id, return &shimapi.StateResponse{
ID: p.ID(),
Bundle: s.bundle, 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()), Pid: uint32(p.Pid()),
Status: status, Status: status,
} Stdin: sio.stdin,
if ep, ok := p.(*execProcess); ok { Stdout: sio.stdout,
pp.Stdin = ep.stdinPath Stderr: sio.stderr,
pp.Stdout = ep.stdoutPath Terminal: sio.terminal,
pp.Stderr = ep.stderrPath }, nil
}
o.Processes = append(o.Processes, pp)
}
return o, nil
} }
func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) {
@ -289,37 +278,21 @@ func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_pro
if s.initProcess == nil { if s.initProcess == nil {
return nil, errors.New(ErrContainerNotCreated) return nil, errors.New(ErrContainerNotCreated)
} }
if r.Pid == 0 { if r.ID == "" {
if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil { if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil {
return nil, err return nil, err
} }
return empty, nil return empty, nil
} }
if int(r.Pid) == s.initProcess.pid { p, ok := s.processes[r.ID]
if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil { if !ok {
return nil, grpc.Errorf(codes.NotFound, "process id %s not found", r.ID)
}
if err := p.Kill(ctx, r.Signal, r.All); err != nil {
return nil, err return nil, err
} }
return empty, nil return empty, nil
} }
pids, err := s.getContainerPids(ctx, s.initProcess.id)
if 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
}
func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*shimapi.ListPidsResponse, error) { func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*shimapi.ListPidsResponse, error) {
pids, err := s.getContainerPids(ctx, r.ID) pids, err := s.getContainerPids(ctx, r.ID)
@ -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) { 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 { 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 { if err := p.Stdin().Close(); err != nil {
return nil, err return nil, err
@ -375,7 +348,8 @@ func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) {
reaper.Default.Delete(pid) reaper.Default.Delete(pid)
s.events <- &events.RuntimeEvent{ s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_EXIT, Type: events.RuntimeEvent_EXIT,
ID: s.id, ID: p.ID(),
ContainerID: s.id,
Pid: uint32(pid), Pid: uint32(pid),
ExitStatus: uint32(status), ExitStatus: uint32(status),
ExitedAt: p.ExitedAt(), ExitedAt: p.ExitedAt(),
@ -387,11 +361,9 @@ func (s *Service) getContainerPids(ctx context.Context, id string) ([]uint32, er
if err != nil { if err != nil {
return nil, err return nil, err
} }
pids := make([]uint32, 0, len(p)) pids := make([]uint32, 0, len(p))
for _, pid := range p { for _, pid := range p {
pids = append(pids, uint32(pid)) pids = append(pids, uint32(pid))
} }
return pids, nil return pids, nil
} }

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ option go_package = "github.com/containerd/containerd/linux/shim/v1;shim";
// for the container processes. // for the container processes.
service Shim { service Shim {
// State returns shim and task state information. // State returns shim and task state information.
rpc State(google.protobuf.Empty) returns (StateResponse); rpc State(StateRequest) returns (StateResponse);
rpc Create(CreateTaskRequest) returns (CreateTaskResponse); rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
@ -77,15 +77,16 @@ message DeleteResponse {
} }
message DeleteProcessRequest { message DeleteProcessRequest {
uint32 pid = 1; string id = 1;
} }
message ExecProcessRequest { message ExecProcessRequest {
bool terminal = 1; string id = 1;
string stdin = 2; bool terminal = 2;
string stdout = 3; string stdin = 3;
string stderr = 4; string stdout = 4;
google.protobuf.Any spec = 5; string stderr = 5;
google.protobuf.Any spec = 6;
} }
message ExecProcessResponse { message ExecProcessResponse {
@ -93,31 +94,34 @@ message ExecProcessResponse {
} }
message ResizePtyRequest { message ResizePtyRequest {
uint32 pid = 1; string id = 1;
uint32 width = 2; uint32 width = 2;
uint32 height = 3; uint32 height = 3;
} }
message StateRequest {
string id = 1;
}
message StateResponse { message StateResponse {
string id = 1; string id = 1;
string bundle = 2; string bundle = 2;
uint32 pid = 3; uint32 pid = 3;
containerd.v1.types.Status status = 4; containerd.v1.types.Status status = 4;
repeated containerd.v1.types.Process processes = 5; string stdin = 5;
string stdin = 6; string stdout = 6;
string stdout = 7; string stderr = 7;
string stderr = 8; bool terminal = 8;
bool terminal = 9;
} }
message KillRequest { message KillRequest {
uint32 signal = 1; string id = 1;
bool all = 2; uint32 signal = 2;
uint32 pid = 3; bool all = 3;
} }
message CloseIORequest { message CloseIORequest {
uint32 pid = 1; string id = 1;
bool stdin = 2; bool stdin = 2;
} }

View File

@ -16,23 +16,26 @@ import (
) )
type Task struct { type Task struct {
containerID string id string
shim *client.Client shim *client.Client
namespace string namespace string
} }
func newTask(id, namespace string, shim *client.Client) *Task { func newTask(id, namespace string, shim *client.Client) *Task {
return &Task{ return &Task{
containerID: id, id: id,
shim: shim, shim: shim,
namespace: namespace, namespace: namespace,
} }
} }
func (t *Task) ID() string {
return t.id
}
func (t *Task) Info() runtime.TaskInfo { func (t *Task) Info() runtime.TaskInfo {
return runtime.TaskInfo{ return runtime.TaskInfo{
ID: t.containerID, ID: t.id,
ContainerID: t.containerID,
Runtime: pluginID, Runtime: pluginID,
Namespace: t.namespace, 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) { 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 { if err != nil {
return runtime.State{}, errors.New(grpc.ErrorDesc(err)) return runtime.State{}, errors.New(grpc.ErrorDesc(err))
} }
@ -89,10 +94,10 @@ func (t *Task) Resume(ctx context.Context) error {
return err 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{ _, err := t.shim.Kill(ctx, &shim.KillRequest{
ID: t.id,
Signal: signal, Signal: signal,
Pid: pid,
All: all, All: all,
}) })
if err != nil { if err != nil {
@ -101,28 +106,28 @@ func (t *Task) Kill(ctx context.Context, signal uint32, pid uint32, all bool) er
return err 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{ request := &shim.ExecProcessRequest{
ID: id,
Stdin: opts.IO.Stdin, Stdin: opts.IO.Stdin,
Stdout: opts.IO.Stdout, Stdout: opts.IO.Stdout,
Stderr: opts.IO.Stderr, Stderr: opts.IO.Stderr,
Terminal: opts.IO.Terminal, Terminal: opts.IO.Terminal,
Spec: opts.Spec, Spec: opts.Spec,
} }
resp, err := t.shim.Exec(ctx, request) if _, err := t.shim.Exec(ctx, request); err != nil {
if err != nil {
return nil, errors.New(grpc.ErrorDesc(err)) return nil, errors.New(grpc.ErrorDesc(err))
} }
return &Process{ return &Process{
pid: int(resp.Pid), id: id,
t: t, t: t,
}, nil }, nil
} }
func (t *Task) Pids(ctx context.Context) ([]uint32, error) { func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{ 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 { if err != nil {
return nil, errors.New(grpc.ErrorDesc(err)) return nil, errors.New(grpc.ErrorDesc(err))
@ -130,9 +135,9 @@ func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
return resp.Pids, nil 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{ _, err := t.shim.ResizePty(ctx, &shim.ResizePtyRequest{
Pid: pid, ID: t.id,
Width: size.Width, Width: size.Width,
Height: size.Height, Height: size.Height,
}) })
@ -142,9 +147,9 @@ func (t *Task) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSi
return err 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{ _, err := t.shim.CloseIO(ctx, &shim.CloseIORequest{
Pid: pid, ID: t.id,
Stdin: true, Stdin: true,
}) })
if err != nil { if err != nil {
@ -164,9 +169,9 @@ func (t *Task) Checkpoint(ctx context.Context, path string, options *types.Any)
return nil 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{ r, err := t.shim.DeleteProcess(ctx, &shim.DeleteProcessRequest{
Pid: pid, ID: id,
}) })
if err != nil { if err != nil {
return nil, errors.New(grpc.ErrorDesc(err)) 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{ return &runtime.Exit{
Status: r.ExitStatus, Status: r.ExitStatus,
Timestamp: r.ExitedAt, Timestamp: r.ExitedAt,
Pid: pid, Pid: r.Pid,
}, nil }, nil
} }
@ -185,28 +190,10 @@ func (t *Task) Update(ctx context.Context, resources *types.Any) error {
return err return err
} }
type Process struct { func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) {
pid int // TODO: verify process exists for container
t *Task return &Process{
} id: id,
t: t,
func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error { }, nil
_, 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
} }

View File

@ -76,5 +76,6 @@ func (m *cgroupsMonitor) trigger(id string, cg cgroups.Cgroup) {
Timestamp: time.Now(), Timestamp: time.Now(),
Type: events.RuntimeEvent_OOM, Type: events.RuntimeEvent_OOM,
ID: id, ID: id,
ContainerID: id,
} }
} }

View File

@ -11,20 +11,17 @@ import (
) )
type process struct { type process struct {
id string
task *task 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 pid uint32
io *IO
spec *specs.Process spec *specs.Process
} }
func (p *process) ID() string {
return p.id
}
// Pid returns the pid of the process // Pid returns the pid of the process
// The pid is not set until start is called and returns // The pid is not set until start is called and returns
func (p *process) Pid() uint32 { func (p *process) Pid() uint32 {
@ -38,7 +35,8 @@ func (p *process) Start(ctx context.Context) error {
return err return err
} }
request := &tasks.ExecProcessRequest{ request := &tasks.ExecProcessRequest{
ContainerID: p.task.containerID, ContainerID: p.task.id,
ExecID: p.id,
Terminal: p.io.Terminal, Terminal: p.io.Terminal,
Stdin: p.io.Stdin, Stdin: p.io.Stdin,
Stdout: p.io.Stdout, Stdout: p.io.Stdout,
@ -50,17 +48,14 @@ func (p *process) Start(ctx context.Context) error {
return err return err
} }
p.pid = response.Pid p.pid = response.Pid
close(p.pidSync)
return nil return nil
} }
func (p *process) Kill(ctx context.Context, s syscall.Signal) error { func (p *process) Kill(ctx context.Context, s syscall.Signal) error {
_, err := p.task.client.TaskService().Kill(ctx, &tasks.KillRequest{ _, err := p.task.client.TaskService().Kill(ctx, &tasks.KillRequest{
Signal: uint32(s), Signal: uint32(s),
ContainerID: p.task.containerID, ContainerID: p.task.id,
PidOrAll: &tasks.KillRequest_Pid{ ExecID: p.id,
Pid: p.pid,
},
}) })
return err return err
} }
@ -70,7 +65,6 @@ func (p *process) Wait(ctx context.Context) (uint32, error) {
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
<-p.pidSync
evloop: evloop:
for { for {
evt, err := eventstream.Recv() evt, err := eventstream.Recv()
@ -86,7 +80,7 @@ evloop:
if e.Type != eventsapi.RuntimeEvent_EXIT { if e.Type != eventsapi.RuntimeEvent_EXIT {
continue evloop 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 return e.ExitStatus, nil
} }
} }
@ -95,8 +89,8 @@ evloop:
func (p *process) CloseIO(ctx context.Context, opts ...IOCloserOpts) error { func (p *process) CloseIO(ctx context.Context, opts ...IOCloserOpts) error {
r := &tasks.CloseIORequest{ r := &tasks.CloseIORequest{
ContainerID: p.task.containerID, ContainerID: p.task.id,
Pid: p.pid, ExecID: p.id,
} }
for _, o := range opts { for _, o := range opts {
o(r) o(r)
@ -111,10 +105,10 @@ func (p *process) IO() *IO {
func (p *process) Resize(ctx context.Context, w, h uint32) error { func (p *process) Resize(ctx context.Context, w, h uint32) error {
_, err := p.task.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{ _, err := p.task.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{
ContainerID: p.task.containerID, ContainerID: p.task.id,
Width: w, Width: w,
Height: h, Height: h,
Pid: p.pid, ExecID: p.id,
}) })
return err 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) { func (p *process) Delete(ctx context.Context) (uint32, error) {
cerr := p.io.Close() cerr := p.io.Close()
r, err := p.task.client.TaskService().DeleteProcess(ctx, &tasks.DeleteProcessRequest{ r, err := p.task.client.TaskService().DeleteProcess(ctx, &tasks.DeleteProcessRequest{
ContainerID: p.task.containerID, ContainerID: p.task.id,
Pid: p.pid, ExecID: p.id,
}) })
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err

View File

@ -8,38 +8,46 @@ import (
type TaskInfo struct { type TaskInfo struct {
ID string ID string
ContainerID string
Runtime string Runtime string
Spec []byte
Namespace string 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 { type Task interface {
Process
// Information of the container // Information of the container
Info() TaskInfo Info() TaskInfo
// Start the container's user defined process // Start the container's user defined process
Start(context.Context) error Start(context.Context) error
// State returns the container's state
State(context.Context) (State, error)
// Pause pauses the container process // Pause pauses the container process
Pause(context.Context) error Pause(context.Context) error
// Resume unpauses the container process // Resume unpauses the container process
Resume(context.Context) error Resume(context.Context) error
// Kill signals a container
Kill(context.Context, uint32, uint32, bool) error
// Exec adds a process into the container // Exec adds a process into the container
Exec(context.Context, ExecOpts) (Process, error) Exec(context.Context, string, ExecOpts) (Process, error)
// Pids returns all pids for the task // Pids returns all pids
Pids(context.Context) ([]uint32, error) 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 checkpoints a container to an image with live system data
Checkpoint(context.Context, string, *types.Any) error Checkpoint(context.Context, string, *types.Any) error
// DeleteProcess deletes a specific exec process via the pid // 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 sets the provided resources to a running task
Update(context.Context, *types.Any) error 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 { type ExecOpts struct {
@ -47,13 +55,6 @@ type ExecOpts struct {
IO IO 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 { type ConsoleSize struct {
Width uint32 Width uint32
Height uint32 Height uint32

View File

@ -107,7 +107,7 @@ func (s *Service) Create(ctx context.Context, req *api.CreateContainerRequest) (
return &resp, errdefs.ToGRPC(err) return &resp, errdefs.ToGRPC(err)
} }
if err := s.emit(ctx, "/containers/create", &eventsapi.ContainerCreate{ if err := s.emit(ctx, "/containers/create", &eventsapi.ContainerCreate{
ContainerID: resp.Container.ID, ID: resp.Container.ID,
Image: resp.Container.Image, Image: resp.Container.Image,
Runtime: &eventsapi.ContainerCreate_Runtime{ Runtime: &eventsapi.ContainerCreate_Runtime{
Name: resp.Container.Runtime.Name, Name: resp.Container.Runtime.Name,
@ -181,7 +181,7 @@ func (s *Service) Update(ctx context.Context, req *api.UpdateContainerRequest) (
} }
if err := s.emit(ctx, "/containers/update", &eventsapi.ContainerUpdate{ if err := s.emit(ctx, "/containers/update", &eventsapi.ContainerUpdate{
ContainerID: resp.Container.ID, ID: resp.Container.ID,
Image: resp.Container.Image, Image: resp.Container.Image,
Labels: resp.Container.Labels, Labels: resp.Container.Labels,
RootFS: resp.Container.RootFS, RootFS: resp.Container.RootFS,
@ -200,7 +200,7 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteContainerRequest) (
} }
if err := s.emit(ctx, "/containers/delete", &eventsapi.ContainerDelete{ if err := s.emit(ctx, "/containers/delete", &eventsapi.ContainerDelete{
ContainerID: req.ID, ID: req.ID,
}); err != nil { }); err != nil {
return &empty.Empty{}, err return &empty.Empty{}, err
} }

View File

@ -36,9 +36,6 @@ var (
empty = &google_protobuf.Empty{} empty = &google_protobuf.Empty{}
) )
// TODO(stevvooe): Clean up error mapping to avoid double mapping certain
// errors within helper methods.
func init() { func init() {
plugin.Register(&plugin.Registration{ plugin.Register(&plugin.Registration{
Type: plugin.GRPCPlugin, Type: plugin.GRPCPlugin,
@ -212,11 +209,12 @@ func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest
if err != nil { if err != nil {
return nil, err return nil, err
} }
exit, err := t.DeleteProcess(ctx, r.Pid) exit, err := t.DeleteProcess(ctx, r.ExecID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &api.DeleteResponse{ return &api.DeleteResponse{
ID: r.ExecID,
ExitStatus: exit.Status, ExitStatus: exit.Status,
ExitedAt: exit.Timestamp, ExitedAt: exit.Timestamp,
Pid: exit.Pid, Pid: exit.Pid,
@ -228,7 +226,6 @@ func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var status task.Status var status task.Status
switch state.Status { switch state.Status {
case runtime.CreatedStatus: case runtime.CreatedStatus:
@ -244,7 +241,6 @@ func taskFromContainerd(ctx context.Context, c runtime.Task) (*task.Task, error)
} }
return &task.Task{ return &task.Task{
ID: c.Info().ID, ID: c.Info().ID,
ContainerID: c.Info().ContainerID,
Pid: state.Pid, Pid: state.Pid,
Status: status, Status: status,
Stdin: state.Stdin, Stdin: state.Stdin,
@ -315,18 +311,14 @@ func (s *Service) Kill(ctx context.Context, r *api.KillRequest) (*google_protobu
if err != nil { if err != nil {
return nil, err return nil, err
} }
p := runtime.Process(t)
switch v := r.PidOrAll.(type) { if r.ExecID != "" {
case *api.KillRequest_All: if p, err = t.Process(ctx, r.ExecID); err != nil {
if err := t.Kill(ctx, r.Signal, 0, true); err != nil {
return nil, err return nil, err
} }
case *api.KillRequest_Pid:
if err := t.Kill(ctx, r.Signal, v.Pid, false); err != nil {
return nil, err
} }
default: if err := p.Kill(ctx, r.Signal, r.All); err != nil {
return nil, fmt.Errorf("invalid option specified; expected pid or all") return nil, err
} }
return empty, nil 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) { 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
process, err := t.Exec(ctx, runtime.ExecOpts{ process, err := t.Exec(ctx, r.ExecID, runtime.ExecOpts{
Spec: r.Spec, Spec: r.Spec,
IO: runtime.IO{ IO: runtime.IO{
Stdin: r.Stdin, Stdin: r.Stdin,
@ -376,7 +371,13 @@ func (s *Service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*goog
if err != nil { if err != nil {
return nil, err 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, Width: r.Width,
Height: r.Height, Height: r.Height,
}); err != nil { }); err != nil {
@ -390,8 +391,14 @@ func (s *Service) CloseIO(ctx context.Context, r *api.CloseIORequest) (*google_p
if err != nil { if err != nil {
return nil, err 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 r.Stdin {
if err := t.CloseIO(ctx, r.Pid); err != nil { if err := p.CloseIO(ctx); err != nil {
return nil, err 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 nil, grpc.Errorf(codes.NotFound, "task %v not found", container.ID)
} }
return t, nil return t, nil
} }
func (s *Service) getRuntime(name string) (runtime.Runtime, error) { func (s *Service) getRuntime(name string) (runtime.Runtime, error) {

49
task.go
View File

@ -51,8 +51,8 @@ type Task interface {
Start(context.Context) error Start(context.Context) error
Status(context.Context) (TaskStatus, error) Status(context.Context) (TaskStatus, error)
Wait(context.Context) (uint32, error) Wait(context.Context) (uint32, error)
Exec(context.Context, *specs.Process, IOCreation) (Process, error) Exec(context.Context, string, *specs.Process, IOCreation) (Process, error)
Processes(context.Context) ([]uint32, error) Pids(context.Context) ([]uint32, error)
CloseIO(context.Context, ...IOCloserOpts) error CloseIO(context.Context, ...IOCloserOpts) error
Resize(ctx context.Context, w, h uint32) error Resize(ctx context.Context, w, h uint32) error
IO() *IO IO() *IO
@ -77,11 +77,10 @@ type task struct {
client *Client client *Client
io *IO io *IO
containerID string id string
pid uint32 pid uint32
deferred *tasks.CreateTaskRequest deferred *tasks.CreateTaskRequest
pidSync chan struct{}
} }
// Pid returns the pid or process id for the task // Pid returns the pid or process id for the task
@ -97,11 +96,10 @@ func (t *task) Start(ctx context.Context) error {
return err return err
} }
t.pid = response.Pid t.pid = response.Pid
close(t.pidSync)
return nil return nil
} }
_, err := t.client.TaskService().Start(ctx, &tasks.StartTaskRequest{ _, err := t.client.TaskService().Start(ctx, &tasks.StartTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
}) })
return err 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 { func (t *task) Kill(ctx context.Context, s syscall.Signal) error {
_, err := t.client.TaskService().Kill(ctx, &tasks.KillRequest{ _, err := t.client.TaskService().Kill(ctx, &tasks.KillRequest{
Signal: uint32(s), Signal: uint32(s),
ContainerID: t.containerID, ContainerID: t.id,
PidOrAll: &tasks.KillRequest_Pid{
Pid: t.pid,
},
}) })
if err != nil { if err != nil {
if strings.Contains(grpc.ErrorDesc(err), runtime.ErrProcessExited.Error()) { 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 { func (t *task) Pause(ctx context.Context) error {
_, err := t.client.TaskService().Pause(ctx, &tasks.PauseTaskRequest{ _, err := t.client.TaskService().Pause(ctx, &tasks.PauseTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
}) })
return err return err
} }
func (t *task) Resume(ctx context.Context) error { func (t *task) Resume(ctx context.Context) error {
_, err := t.client.TaskService().Resume(ctx, &tasks.ResumeTaskRequest{ _, err := t.client.TaskService().Resume(ctx, &tasks.ResumeTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
}) })
return err return err
} }
func (t *task) Status(ctx context.Context) (TaskStatus, error) { func (t *task) Status(ctx context.Context) (TaskStatus, error) {
r, err := t.client.TaskService().Get(ctx, &tasks.GetTaskRequest{ r, err := t.client.TaskService().Get(ctx, &tasks.GetTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
}) })
if err != nil { if err != nil {
return "", err return "", err
@ -153,8 +148,6 @@ func (t *task) Wait(ctx context.Context) (uint32, error) {
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
<-t.pidSync
for { for {
evt, err := eventstream.Recv() evt, err := eventstream.Recv()
if err != nil { if err != nil {
@ -169,7 +162,7 @@ func (t *task) Wait(ctx context.Context) (uint32, error) {
if e.Type != eventsapi.RuntimeEvent_EXIT { if e.Type != eventsapi.RuntimeEvent_EXIT {
continue continue
} }
if e.ID == t.containerID && e.Pid == t.pid { if e.ID == t.id && e.Pid == t.pid {
return e.ExitStatus, nil return e.ExitStatus, nil
} }
} }
@ -185,7 +178,7 @@ func (t *task) Delete(ctx context.Context) (uint32, error) {
cerr = t.io.Close() cerr = t.io.Close()
} }
r, err := t.client.TaskService().Delete(ctx, &tasks.DeleteTaskRequest{ r, err := t.client.TaskService().Delete(ctx, &tasks.DeleteTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
}) })
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
@ -193,22 +186,22 @@ func (t *task) Delete(ctx context.Context) (uint32, error) {
return r.ExitStatus, cerr 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() i, err := ioCreate()
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &process{ return &process{
id: id,
task: t, task: t,
io: i, io: i,
spec: spec, spec: spec,
pidSync: make(chan struct{}),
}, nil }, 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{ response, err := t.client.TaskService().ListPids(ctx, &tasks.ListPidsRequest{
ContainerID: t.containerID, ContainerID: t.id,
}) })
if err != nil { if err != nil {
return nil, err 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 { func (t *task) CloseIO(ctx context.Context, opts ...IOCloserOpts) error {
r := &tasks.CloseIORequest{ r := &tasks.CloseIORequest{
ContainerID: t.containerID, ContainerID: t.id,
Pid: t.pid,
} }
for _, o := range opts { for _, o := range opts {
o(r) o(r)
@ -234,17 +226,16 @@ func (t *task) IO() *IO {
func (t *task) Resize(ctx context.Context, w, h uint32) error { func (t *task) Resize(ctx context.Context, w, h uint32) error {
_, err := t.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{ _, err := t.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{
ContainerID: t.containerID, ContainerID: t.id,
Width: w, Width: w,
Height: h, Height: h,
Pid: t.pid,
}) })
return err return err
} }
func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Descriptor, err error) { func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Descriptor, err error) {
request := &tasks.CheckpointTaskRequest{ request := &tasks.CheckpointTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
} }
for _, o := range opts { for _, o := range opts {
if err := o(request); err != nil { 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) defer t.Resume(ctx)
cr, err := t.client.ContainerService().Get(ctx, &containers.GetContainerRequest{ cr, err := t.client.ContainerService().Get(ctx, &containers.GetContainerRequest{
ID: t.containerID, ID: t.id,
}) })
if err != nil { if err != nil {
return d, err 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 { func (t *task) Update(ctx context.Context, opts ...UpdateTaskOpts) error {
request := &tasks.UpdateTaskRequest{ request := &tasks.UpdateTaskRequest{
ContainerID: t.containerID, ContainerID: t.id,
} }
for _, o := range opts { for _, o := range opts {
if err := o(ctx, t.client, request); err != nil { 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 { if err := json.NewEncoder(buf).Encode(index); err != nil {
return v1.Descriptor{}, err 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) { func writeContent(ctx context.Context, store content.Store, mediaType, ref string, r io.Reader) (d v1.Descriptor, err error) {

View File

@ -68,6 +68,10 @@ type container struct {
sendEvent eventCallback sendEvent eventCallback
} }
func (c *container) ID() string {
return c.ctr.ID()
}
func (c *container) Info() runtime.TaskInfo { func (c *container) Info() runtime.TaskInfo {
return runtime.TaskInfo{ return runtime.TaskInfo{
ID: c.ctr.ID(), ID: c.ctr.ID(),
@ -122,14 +126,23 @@ func (c *container) State(ctx context.Context) (runtime.State, error) {
}, nil }, 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 { if winsys.Signal(signal) == winsys.SIGKILL {
return c.ctr.Kill(ctx) return c.ctr.Kill(ctx)
} }
return c.ctr.Stop(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 { if c.ctr.Pid() == 0 {
return nil, ErrLoadedContainer 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") 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 { if err != nil {
return nil, err return nil, err
} }
@ -160,12 +173,12 @@ func (c *container) Exec(ctx context.Context, opts runtime.ExecOpts) (runtime.Pr
return &process{p}, nil return &process{p}, nil
} }
func (c *container) CloseIO(ctx context.Context, pid uint32) error { func (c *container) CloseIO(ctx context.Context) error {
return c.ctr.CloseIO(ctx, pid) return c.ctr.CloseIO(ctx)
} }
func (c *container) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSize) error { func (c *container) ResizePty(ctx context.Context, size runtime.ConsoleSize) error {
return c.ctr.ResizePty(ctx, pid, size) return c.ctr.ResizePty(ctx, size)
} }
func (c *container) Status() runtime.Status { 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") 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 var process *hcs.Process
for _, p := range c.ctr.Processes() { for _, p := range c.ctr.Processes() {
if p.Pid() == pid { if p.ID() == id {
process = p process = p
break break
} }
} }
if process == nil { 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() ec, err := process.ExitCode()
if err != nil { if err != nil {

View File

@ -172,7 +172,7 @@ func (c *Container) Processes() []*Process {
} }
func (c *Container) Start(ctx context.Context) error { 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 return err
} }
@ -199,35 +199,35 @@ func (c *Container) Stop(ctx context.Context) error {
return nil return nil
} }
func (c *Container) CloseIO(ctx context.Context, pid uint32) error { func (c *Container) CloseIO(ctx context.Context) error {
var proc *Process var proc *Process
c.Lock() c.Lock()
for _, p := range c.processes { for _, p := range c.processes {
if p.Pid() == pid { if p.id == c.id {
proc = p proc = p
break break
} }
} }
c.Unlock() c.Unlock()
if proc == nil { if proc == nil {
return errors.Errorf("no such process %v", pid) return errors.Errorf("no such process %s", c.id)
} }
return proc.CloseStdin() 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 var proc *Process
c.Lock() c.Lock()
for _, p := range c.processes { for _, p := range c.processes {
if p.Pid() == pid { if p.id == c.id {
proc = p proc = p
break break
} }
} }
c.Unlock() c.Unlock()
if proc == nil { 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)) return proc.ResizeConsole(uint16(size.Width), uint16(size.Height))
@ -303,15 +303,14 @@ func (c *Container) GetConfiguration() Configuration {
return c.conf 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 { if len(c.processes) == 0 {
return nil, errors.New("container not started") return nil, errors.New("container not started")
} }
return c.addProcess(ctx, id, spec, io)
return c.addProcess(ctx, 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 // If we don't have a process yet, reused the container pid
var pid uint32 var pid uint32
if len(c.processes) == 0 { if len(c.processes) == 0 {
@ -388,6 +387,7 @@ func (c *Container) addProcess(ctx context.Context, spec *specs.Process, pio *IO
} }
p := &Process{ p := &Process{
id: id,
Process: proc, Process: proc,
pid: pid, pid: pid,
io: pio, io: pio,

View File

@ -14,6 +14,7 @@ import (
type Process struct { type Process struct {
hcsshim.Process hcsshim.Process
id string
pid uint32 pid uint32
io *IO io *IO
ec uint32 ec uint32
@ -22,6 +23,10 @@ type Process struct {
ecSync chan struct{} ecSync chan struct{}
} }
func (p *Process) ID() string {
return p.id
}
func (p *Process) Pid() uint32 { func (p *Process) Pid() uint32 {
return p.pid return p.pid
} }

View File

@ -32,3 +32,11 @@ func (p *process) Status() runtime.Status {
func (p *process) Pid() uint32 { func (p *process) Pid() uint32 {
return p.Process.Pid() 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))
}