From 990536f2cc15277ced40793769434fbab73b6151 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 22 Jun 2017 14:29:49 -0700 Subject: [PATCH] Move shim protos into linux pkg This moves the shim's API and protos out of the containerd services package and into the linux runtime package. This is because the shim is an implementation detail of the linux runtime that we have and it is not a containerd user facing api. Signed-off-by: Michael Crosby --- api/services/events/v1/namespace.pb.go | 30 +- api/services/events/v1/namespace.proto | 2 - api/services/events/v1/runtime.pb.go | 124 +- api/services/events/v1/runtime.proto | 11 +- api/types/task/task.pb.go | 393 +--- api/types/task/task.proto | 19 - cmd/containerd-shim/main_unix.go | 22 +- cmd/ctr/shim.go | 21 +- linux/bundle.go | 91 + linux/list.go | 75 + linux/runtime.go | 310 ++- linux/shim.go | 90 - linux/shim/client.go | 275 +-- linux/shim/exec.go | 15 +- linux/shim/init.go | 15 +- linux/shim/local.go | 126 ++ linux/shim/service.go | 72 +- {api/services => linux}/shim/v1/shim.pb.go | 2226 +++++++++----------- {api/services => linux}/shim/v1/shim.proto | 125 +- linux/task.go | 32 +- plugin/task.go | 4 +- process.go | 3 +- services/tasks/service.go | 4 +- task.go | 3 +- windows/container.go | 12 +- windows/hcs/hcs.go | 4 +- 26 files changed, 1838 insertions(+), 2266 deletions(-) create mode 100644 linux/bundle.go create mode 100644 linux/list.go delete mode 100644 linux/shim.go create mode 100644 linux/shim/local.go rename {api/services => linux}/shim/v1/shim.pb.go (69%) rename {api/services => linux}/shim/v1/shim.proto (50%) diff --git a/api/services/events/v1/namespace.pb.go b/api/services/events/v1/namespace.pb.go index 479c7dd1b..6418608a3 100644 --- a/api/services/events/v1/namespace.pb.go +++ b/api/services/events/v1/namespace.pb.go @@ -8,8 +8,6 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/gogo/protobuf/types" -import _ "github.com/gogo/protobuf/types" import strings "strings" import reflect "reflect" @@ -884,25 +882,23 @@ func init() { } var fileDescriptorNamespace = []byte{ - // 311 bytes of a gzipped FileDescriptorProto + // 277 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb, 0xa7, 0x96, 0xa5, 0xe6, 0x95, 0x14, 0xeb, 0x97, 0x19, 0xea, 0xe7, 0x25, 0xe6, 0xa6, 0x16, 0x17, 0x24, 0x26, 0xa7, 0xea, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x22, 0xb4, 0xe8, 0xc1, 0x94, 0xeb, 0x41, 0x94, 0xeb, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x55, 0xea, 0x83, - 0x58, 0x10, 0x4d, 0x52, 0xf2, 0xe9, 0xf9, 0xf9, 0xe9, 0x39, 0xa9, 0xfa, 0x60, 0x5e, 0x52, 0x69, - 0x9a, 0x7e, 0x49, 0x66, 0x6e, 0x6a, 0x71, 0x49, 0x62, 0x6e, 0x01, 0x54, 0x81, 0x24, 0xba, 0x82, - 0xc4, 0xbc, 0x4a, 0x88, 0x94, 0xd2, 0x16, 0x46, 0x2e, 0x7e, 0x3f, 0x98, 0x23, 0x9c, 0x8b, 0x52, - 0x13, 0x4b, 0x52, 0x85, 0x84, 0xb8, 0x58, 0x40, 0xee, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, - 0x02, 0xb3, 0x85, 0x82, 0xb8, 0xd8, 0x72, 0x12, 0x93, 0x52, 0x73, 0x8a, 0x25, 0x98, 0x14, 0x98, - 0x35, 0xb8, 0x8d, 0xac, 0xf4, 0xf0, 0xba, 0x54, 0x0f, 0xcd, 0x4c, 0x3d, 0x1f, 0xb0, 0x66, 0xd7, - 0xbc, 0x92, 0xa2, 0xca, 0x20, 0xa8, 0x49, 0x52, 0x96, 0x5c, 0xdc, 0x48, 0xc2, 0x42, 0x02, 0x5c, - 0xcc, 0xd9, 0xa9, 0x95, 0x50, 0x5b, 0x41, 0x4c, 0x21, 0x11, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, - 0x54, 0x09, 0x26, 0xb0, 0x18, 0x84, 0x63, 0xc5, 0x64, 0xc1, 0x88, 0xea, 0xec, 0xd0, 0x82, 0x14, - 0xaa, 0x3b, 0x1b, 0x62, 0x26, 0xb5, 0x9d, 0xad, 0x8a, 0xe4, 0x6a, 0x97, 0xd4, 0x9c, 0x54, 0xec, - 0xae, 0x76, 0x8a, 0x38, 0xf1, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x8c, - 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0x63, 0x94, 0x1d, 0x99, - 0x09, 0xcd, 0x1a, 0xc2, 0x4a, 0x62, 0x03, 0xc7, 0xba, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x78, - 0xf1, 0x6d, 0xaa, 0xb1, 0x02, 0x00, 0x00, + 0x58, 0x10, 0x4d, 0x4a, 0x5b, 0x18, 0xb9, 0xf8, 0xfd, 0x60, 0x06, 0x39, 0x17, 0xa5, 0x26, 0x96, + 0xa4, 0x0a, 0x09, 0x71, 0xb1, 0x80, 0xcc, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, + 0x85, 0x82, 0xb8, 0xd8, 0x72, 0x12, 0x93, 0x52, 0x73, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, + 0x8d, 0xac, 0xf4, 0xf0, 0xda, 0xa6, 0x87, 0x66, 0xa6, 0x9e, 0x0f, 0x58, 0xb3, 0x6b, 0x5e, 0x49, + 0x51, 0x65, 0x10, 0xd4, 0x24, 0x29, 0x4b, 0x2e, 0x6e, 0x24, 0x61, 0x21, 0x01, 0x2e, 0xe6, 0xec, + 0xd4, 0x4a, 0xa8, 0xad, 0x20, 0xa6, 0x90, 0x08, 0x17, 0x6b, 0x59, 0x62, 0x4e, 0x69, 0xaa, 0x04, + 0x13, 0x58, 0x0c, 0xc2, 0xb1, 0x62, 0xb2, 0x60, 0x44, 0x75, 0x76, 0x68, 0x41, 0x0a, 0xd5, 0x9d, + 0x0d, 0x31, 0x93, 0xda, 0xce, 0x56, 0x45, 0x72, 0xb5, 0x4b, 0x6a, 0x4e, 0x2a, 0x76, 0x57, 0x3b, + 0x45, 0x9c, 0x78, 0x28, 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0xca, 0x8e, 0xcc, 0xc4, 0x62, + 0x0d, 0x61, 0x25, 0xb1, 0x81, 0x63, 0xdd, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xbe, 0xf0, 0x68, + 0xa6, 0x75, 0x02, 0x00, 0x00, } diff --git a/api/services/events/v1/namespace.proto b/api/services/events/v1/namespace.proto index fa8ad0a62..e4bebf2e9 100644 --- a/api/services/events/v1/namespace.proto +++ b/api/services/events/v1/namespace.proto @@ -3,8 +3,6 @@ syntax = "proto3"; package containerd.services.events.v1; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/any.proto"; option go_package = "github.com/containerd/containerd/api/services/events/v1;events"; diff --git a/api/services/events/v1/runtime.pb.go b/api/services/events/v1/runtime.pb.go index 294405201..595f4824e 100644 --- a/api/services/events/v1/runtime.pb.go +++ b/api/services/events/v1/runtime.pb.go @@ -9,7 +9,6 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/types" -import containerd_v1_types "github.com/containerd/containerd/api/types/task" import time "time" @@ -26,6 +25,41 @@ var _ = fmt.Errorf var _ = math.Inf var _ = time.Kitchen +type RuntimeEvent_EventType int32 + +const ( + RuntimeEvent_EXIT RuntimeEvent_EventType = 0 + RuntimeEvent_OOM RuntimeEvent_EventType = 1 + RuntimeEvent_CREATE RuntimeEvent_EventType = 2 + RuntimeEvent_START RuntimeEvent_EventType = 3 + RuntimeEvent_EXEC_ADDED RuntimeEvent_EventType = 4 + RuntimeEvent_PAUSED RuntimeEvent_EventType = 5 +) + +var RuntimeEvent_EventType_name = map[int32]string{ + 0: "EXIT", + 1: "OOM", + 2: "CREATE", + 3: "START", + 4: "EXEC_ADDED", + 5: "PAUSED", +} +var RuntimeEvent_EventType_value = map[string]int32{ + "EXIT": 0, + "OOM": 1, + "CREATE": 2, + "START": 3, + "EXEC_ADDED": 4, + "PAUSED": 5, +} + +func (x RuntimeEvent_EventType) String() string { + return proto.EnumName(RuntimeEvent_EventType_name, int32(x)) +} +func (RuntimeEvent_EventType) EnumDescriptor() ([]byte, []int) { + return fileDescriptorRuntime, []int{3, 0} +} + type RuntimeIO struct { Stdin string `protobuf:"bytes,1,opt,name=stdin,proto3" json:"stdin,omitempty"` Stdout string `protobuf:"bytes,2,opt,name=stdout,proto3" json:"stdout,omitempty"` @@ -60,11 +94,11 @@ func (*RuntimeCreate) ProtoMessage() {} func (*RuntimeCreate) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{2} } type RuntimeEvent struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Type containerd_v1_types.Event_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.v1.types.Event_EventType" json:"type,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type RuntimeEvent_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.services.events.v1.RuntimeEvent_EventType" json:"type,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` } func (m *RuntimeEvent) Reset() { *m = RuntimeEvent{} } @@ -88,6 +122,7 @@ func init() { proto.RegisterType((*RuntimeCreate)(nil), "containerd.services.events.v1.RuntimeCreate") proto.RegisterType((*RuntimeEvent)(nil), "containerd.services.events.v1.RuntimeEvent") proto.RegisterType((*RuntimeDelete)(nil), "containerd.services.events.v1.RuntimeDelete") + proto.RegisterEnum("containerd.services.events.v1.RuntimeEvent_EventType", RuntimeEvent_EventType_name, RuntimeEvent_EventType_value) } func (m *RuntimeIO) Marshal() (dAtA []byte, err error) { size := m.Size() @@ -1118,7 +1153,7 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (containerd_v1_types.Event_EventType(b) & 0x7F) << shift + m.Type |= (RuntimeEvent_EventType(b) & 0x7F) << shift if b < 0x80 { break } @@ -1479,40 +1514,43 @@ func init() { } var fileDescriptorRuntime = []byte{ - // 555 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c, - 0x10, 0x8e, 0x64, 0xc7, 0xb1, 0xd7, 0xbf, 0x7f, 0xca, 0x12, 0x8a, 0x30, 0x54, 0x32, 0xa6, 0x07, - 0x43, 0x61, 0x85, 0xdd, 0x4b, 0x69, 0xa1, 0x34, 0x6e, 0x52, 0xf0, 0xa1, 0x18, 0x36, 0x3e, 0x94, - 0x5e, 0x82, 0x2c, 0x6d, 0x9c, 0x25, 0xb6, 0x56, 0xec, 0x8e, 0x4c, 0x73, 0xeb, 0x23, 0xf4, 0x25, - 0xfa, 0x2e, 0x3e, 0xf6, 0x54, 0x7a, 0x72, 0x1b, 0x3d, 0x42, 0x9f, 0xa0, 0x68, 0x77, 0xed, 0x98, - 0x42, 0x4d, 0xc8, 0x65, 0x99, 0x6f, 0x98, 0xf9, 0xf6, 0x9b, 0xfd, 0x46, 0x42, 0x67, 0x33, 0x0e, - 0x57, 0xf9, 0x94, 0xc4, 0x62, 0x11, 0xc6, 0x22, 0x85, 0x88, 0xa7, 0x4c, 0x26, 0xbb, 0x61, 0x94, - 0xf1, 0x50, 0x31, 0xb9, 0xe4, 0x31, 0x53, 0x21, 0x5b, 0xb2, 0x14, 0x54, 0xb8, 0xec, 0x87, 0x32, - 0x4f, 0x81, 0x2f, 0x18, 0xc9, 0xa4, 0x00, 0x81, 0x9f, 0xdc, 0x35, 0x90, 0x4d, 0x31, 0x31, 0xc5, - 0x64, 0xd9, 0x6f, 0x1f, 0xcf, 0xc4, 0x4c, 0xe8, 0xca, 0xb0, 0x8c, 0x4c, 0x53, 0x3b, 0x98, 0x09, - 0x31, 0x9b, 0xb3, 0x50, 0xa3, 0x69, 0x7e, 0x19, 0x96, 0x84, 0x0a, 0xa2, 0x45, 0x66, 0x0b, 0x5e, - 0xde, 0x4b, 0x1c, 0xdc, 0x64, 0x4c, 0x85, 0x10, 0xa9, 0x6b, 0x7d, 0x98, 0xde, 0xee, 0x02, 0x35, - 0xa8, 0x91, 0x38, 0x1a, 0xe3, 0x63, 0x74, 0xa8, 0x20, 0xe1, 0xa9, 0xe7, 0x74, 0x9c, 0x5e, 0x83, - 0x1a, 0x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f, 0x99, 0x5f, 0xd8, 0x37, 0x2e, 0x27, 0xfe, 0x7f, 0xf0, 0x74, - 0x57, 0xcc, 0xb2, 0x4f, 0xf4, 0x5a, 0x10, 0xcd, 0x60, 0xce, 0xc9, 0x4d, 0xc6, 0xac, 0x13, 0x8f, - 0x50, 0x25, 0xe3, 0x89, 0xb6, 0xb7, 0x45, 0xcb, 0x10, 0x07, 0xa8, 0xc9, 0x3e, 0x71, 0xb8, 0x50, - 0x10, 0x41, 0xae, 0xf4, 0x7c, 0x2d, 0x8a, 0xca, 0xd4, 0xb9, 0xce, 0xe0, 0x13, 0xd4, 0x28, 0x11, - 0x4b, 0x2e, 0x22, 0x23, 0xba, 0x39, 0x68, 0x13, 0xb3, 0xc0, 0x64, 0xb3, 0xc0, 0x64, 0xb2, 0x59, - 0xe0, 0x61, 0x7d, 0xb5, 0x0e, 0x0e, 0xbe, 0xfc, 0x0c, 0x1c, 0x5a, 0x37, 0x6d, 0x27, 0xd0, 0xfd, - 0x7a, 0xe7, 0xe6, 0x29, 0x9b, 0xb3, 0x3d, 0x6e, 0x7a, 0xe8, 0xc8, 0x7e, 0x5f, 0xd6, 0xce, 0x0d, - 0xfc, 0x5b, 0x67, 0x65, 0xbf, 0xce, 0xea, 0x43, 0x74, 0x0e, 0x3f, 0xac, 0x6e, 0xfd, 0x83, 0x1f, - 0xb7, 0xfe, 0xc1, 0xe7, 0xc2, 0x77, 0x56, 0x85, 0xef, 0x7c, 0x2b, 0x7c, 0xe7, 0x57, 0xe1, 0x3b, - 0x1f, 0x5f, 0x3f, 0xf0, 0x6f, 0xf1, 0xca, 0x44, 0xd3, 0x9a, 0x56, 0xf0, 0xfc, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xe0, 0x7b, 0x76, 0x39, 0x76, 0x04, 0x00, 0x00, + // 599 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6a, 0xdb, 0x40, + 0x10, 0x86, 0x2d, 0xc9, 0x76, 0xec, 0x71, 0x13, 0xc4, 0x12, 0x8a, 0x30, 0x54, 0x0e, 0x3e, 0x19, + 0x0a, 0x12, 0x71, 0xe9, 0xa9, 0x50, 0x6a, 0xc7, 0x2a, 0xf8, 0x10, 0xdc, 0xae, 0x55, 0x08, 0xbd, + 0x04, 0x59, 0xda, 0x38, 0x4b, 0x6d, 0xad, 0x58, 0xad, 0x4c, 0x73, 0xeb, 0x23, 0xf4, 0x25, 0xfa, + 0x12, 0x7d, 0x82, 0x1c, 0x7b, 0xec, 0x29, 0x6d, 0xf4, 0x08, 0x7d, 0x82, 0xa2, 0x5d, 0x59, 0x09, + 0x85, 0x9a, 0x90, 0x8b, 0x99, 0x7f, 0x98, 0xfd, 0x66, 0xfe, 0xdd, 0xb1, 0xc0, 0x5b, 0x52, 0x71, + 0x99, 0x2d, 0x9c, 0x90, 0xad, 0xdd, 0x90, 0xc5, 0x22, 0xa0, 0x31, 0xe1, 0xd1, 0xfd, 0x30, 0x48, + 0xa8, 0x9b, 0x12, 0xbe, 0xa1, 0x21, 0x49, 0x5d, 0xb2, 0x21, 0xb1, 0x48, 0xdd, 0xcd, 0xb1, 0xcb, + 0xb3, 0x58, 0xd0, 0x35, 0x71, 0x12, 0xce, 0x04, 0x43, 0xcf, 0xee, 0x0e, 0x38, 0xdb, 0x62, 0x47, + 0x15, 0x3b, 0x9b, 0xe3, 0xee, 0xe1, 0x92, 0x2d, 0x99, 0xac, 0x74, 0x8b, 0x48, 0x1d, 0xea, 0xf6, + 0x96, 0x8c, 0x2d, 0x57, 0xc4, 0x95, 0x6a, 0x91, 0x5d, 0xb8, 0x05, 0x30, 0x15, 0xc1, 0x3a, 0x51, + 0x05, 0xfd, 0x35, 0xb4, 0xb1, 0x6a, 0x33, 0x9d, 0xa1, 0x43, 0x68, 0xa4, 0x22, 0xa2, 0xb1, 0xa5, + 0x1d, 0x69, 0x83, 0x36, 0x56, 0x02, 0x3d, 0x85, 0x66, 0x2a, 0x22, 0x96, 0x09, 0x4b, 0x97, 0xe9, + 0x52, 0x95, 0x79, 0xc2, 0xb9, 0x65, 0x54, 0x79, 0xc2, 0x39, 0xea, 0x42, 0x4b, 0x10, 0xbe, 0xa6, + 0x71, 0xb0, 0xb2, 0xea, 0x47, 0xda, 0xa0, 0x85, 0x2b, 0xdd, 0xf7, 0xe1, 0x49, 0xd9, 0xee, 0x94, + 0x65, 0xb1, 0x40, 0x08, 0xea, 0xe2, 0x2a, 0x21, 0x65, 0x43, 0x19, 0x4b, 0x2e, 0xcb, 0x78, 0x48, + 0xaa, 0x7e, 0x52, 0x21, 0x0b, 0xf6, 0x58, 0x22, 0x28, 0x8b, 0x53, 0xcb, 0x38, 0x32, 0x06, 0x6d, + 0xbc, 0x95, 0xfd, 0x3f, 0x1a, 0xec, 0x97, 0xd8, 0x13, 0x4e, 0x02, 0x51, 0x30, 0x74, 0x1a, 0x29, + 0xea, 0xb8, 0x99, 0xdf, 0xf4, 0xf4, 0xe9, 0x04, 0xeb, 0x34, 0x2a, 0xd8, 0x8b, 0x2c, 0x8e, 0x56, + 0x15, 0x5b, 0x29, 0x34, 0x83, 0x26, 0x67, 0x4c, 0x5c, 0x28, 0x74, 0x67, 0xf8, 0xdc, 0xd9, 0x79, + 0xdb, 0xce, 0x7d, 0x13, 0x63, 0xc8, 0x6f, 0x7a, 0x4d, 0xcc, 0x98, 0x78, 0x3b, 0xc7, 0x25, 0x06, + 0xbd, 0x01, 0x9d, 0x32, 0x69, 0xbf, 0x33, 0x1c, 0x3c, 0x0c, 0x36, 0x9d, 0x95, 0xa3, 0xce, 0xb0, + 0x4e, 0x19, 0xb2, 0x01, 0xc2, 0x4b, 0x12, 0x7e, 0x4a, 0x18, 0x8d, 0x85, 0xd5, 0x90, 0xe3, 0xde, + 0xcb, 0xf4, 0xbf, 0xeb, 0xd5, 0x5d, 0x7a, 0x05, 0xea, 0xbf, 0x9e, 0xa7, 0x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, 0xed, 0x3a, 0xb7, 0xb5, 0x1f, 0xb9, 0xad, 0xfd, 0xce, 0x6d, 0xed, 0xe3, 0xeb, 0x47, + 0x7e, 0x55, 0x5e, 0xa9, 0x68, 0xd1, 0x94, 0x13, 0xbc, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xa8, + 0x82, 0x1b, 0x05, 0x9e, 0x04, 0x00, 0x00, } diff --git a/api/services/events/v1/runtime.proto b/api/services/events/v1/runtime.proto index 6034e6483..316b43c81 100644 --- a/api/services/events/v1/runtime.proto +++ b/api/services/events/v1/runtime.proto @@ -4,7 +4,6 @@ package containerd.services.events.v1; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -import "github.com/containerd/containerd/api/types/task/task.proto"; option go_package = "github.com/containerd/containerd/api/services/events/v1;events"; @@ -31,7 +30,15 @@ message RuntimeCreate { message RuntimeEvent { string id = 1; - containerd.v1.types.Event.EventType type = 2; + enum EventType { + EXIT = 0; + OOM = 1; + CREATE = 2; + START = 3; + EXEC_ADDED = 4; + PAUSED = 5; + } + EventType type = 2; uint32 pid = 3; uint32 exit_status = 4; google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; diff --git a/api/types/task/task.pb.go b/api/types/task/task.pb.go index be43ffd57..9379ed190 100644 --- a/api/types/task/task.pb.go +++ b/api/types/task/task.pb.go @@ -12,7 +12,6 @@ Task Process User - Event */ package task @@ -21,11 +20,6 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import google_protobuf1 "github.com/gogo/protobuf/types" -import _ "github.com/gogo/protobuf/types" - -import time "time" - -import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" import strings "strings" import reflect "reflect" @@ -36,7 +30,6 @@ import io "io" var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -74,39 +67,6 @@ func (x Status) String() string { } func (Status) EnumDescriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } -type Event_EventType int32 - -const ( - Event_EXIT Event_EventType = 0 - Event_OOM Event_EventType = 1 - Event_CREATE Event_EventType = 2 - Event_START Event_EventType = 3 - Event_EXEC_ADDED Event_EventType = 4 - Event_PAUSED Event_EventType = 5 -) - -var Event_EventType_name = map[int32]string{ - 0: "EXIT", - 1: "OOM", - 2: "CREATE", - 3: "START", - 4: "EXEC_ADDED", - 5: "PAUSED", -} -var Event_EventType_value = map[string]int32{ - "EXIT": 0, - "OOM": 1, - "CREATE": 2, - "START": 3, - "EXEC_ADDED": 4, - "PAUSED": 5, -} - -func (x Event_EventType) String() string { - return proto.EnumName(Event_EventType_name, int32(x)) -} -func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorTask, []int{3, 0} } - type Task struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -152,25 +112,11 @@ func (m *User) Reset() { *m = User{} } func (*User) ProtoMessage() {} func (*User) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{2} } -type Event struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Type Event_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.v1.types.Event_EventType" json:"type,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` -} - -func (m *Event) Reset() { *m = Event{} } -func (*Event) ProtoMessage() {} -func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{3} } - func init() { proto.RegisterType((*Task)(nil), "containerd.v1.types.Task") proto.RegisterType((*Process)(nil), "containerd.v1.types.Process") proto.RegisterType((*User)(nil), "containerd.v1.types.User") - proto.RegisterType((*Event)(nil), "containerd.v1.types.Event") proto.RegisterEnum("containerd.v1.types.Status", Status_name, Status_value) - proto.RegisterEnum("containerd.v1.types.Event_EventType", Event_EventType_name, Event_EventType_value) } func (m *Task) Marshal() (dAtA []byte, err error) { size := m.Size() @@ -412,53 +358,6 @@ func (m *User) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *Event) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Event) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.ID) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTask(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) - } - if m.Type != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Type)) - } - if m.Pid != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.Pid)) - } - if m.ExitStatus != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) - } - dAtA[i] = 0x2a - i++ - i = encodeVarintTask(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) - n6, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - return i, nil -} - func encodeFixed64Task(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -598,27 +497,6 @@ func (m *User) Size() (n int) { return n } -func (m *Event) Size() (n int) { - var l int - _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovTask(uint64(l)) - } - if m.Type != 0 { - n += 1 + sovTask(uint64(m.Type)) - } - if m.Pid != 0 { - n += 1 + sovTask(uint64(m.Pid)) - } - if m.ExitStatus != 0 { - n += 1 + sovTask(uint64(m.ExitStatus)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) - n += 1 + l + sovTask(uint64(l)) - return n -} - func sovTask(x uint64) (n int) { for { n++ @@ -683,20 +561,6 @@ func (this *User) String() string { }, "") return s } -func (this *Event) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Event{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, - `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, - `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} func valueToStringTask(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -1508,172 +1372,6 @@ func (m *User) Unmarshal(dAtA []byte) error { } return nil } -func (m *Event) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Event: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTask - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= (Event_EventType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) - } - m.Pid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Pid |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) - } - m.ExitStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExitStatus |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTask - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTask(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTask - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTask(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -1784,54 +1482,45 @@ func init() { } var fileDescriptorTask = []byte{ - // 775 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xe3, 0x44, - 0x18, 0x8e, 0x1d, 0xe7, 0x6b, 0xd2, 0x66, 0xcd, 0x50, 0xad, 0xbc, 0x01, 0x39, 0x56, 0x84, 0x44, - 0x84, 0x84, 0x23, 0xb2, 0x07, 0x10, 0xb7, 0xb4, 0xb6, 0x56, 0x11, 0x22, 0x0d, 0x13, 0x47, 0xec, - 0x2d, 0x9a, 0x66, 0x06, 0x33, 0x6a, 0x3b, 0xb6, 0x3c, 0xe3, 0x2e, 0xbd, 0x71, 0x44, 0x7b, 0xe2, - 0x0f, 0xec, 0x85, 0x8f, 0xbf, 0xc0, 0x81, 0x5f, 0xd0, 0x23, 0x47, 0x4e, 0x85, 0xcd, 0x5f, 0xe0, - 0x0f, 0xa0, 0x19, 0xbb, 0x49, 0x76, 0x9b, 0x4a, 0x7b, 0xb1, 0xde, 0x79, 0x9f, 0x67, 0x26, 0xcf, - 0xfb, 0x3c, 0x6f, 0xc0, 0x97, 0x31, 0x93, 0xdf, 0xe7, 0x67, 0xfe, 0x2a, 0xb9, 0x1c, 0xae, 0x12, - 0x2e, 0x31, 0xe3, 0x34, 0x23, 0xbb, 0x25, 0x4e, 0xd9, 0x50, 0x5e, 0x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 0x4f, 0x32, 0x8a, - 0x25, 0x25, 0x0a, 0x47, 0x8b, 0xe9, 0x74, 0x32, 0x7d, 0x66, 0x9b, 0xbb, 0x38, 0xca, 0x39, 0x67, - 0x3c, 0x56, 0xf8, 0x3c, 0x3a, 0x9d, 0xcd, 0xc2, 0xc0, 0xae, 0xee, 0xe2, 0x73, 0x99, 0xa4, 0x29, - 0x25, 0xf0, 0xc3, 0x8d, 0x2c, 0xab, 0x6b, 0xbf, 0x7c, 0xe5, 0x1d, 0x14, 0xf0, 0x0c, 0xe7, 0x82, - 0x92, 0x6e, 0xe7, 0xa7, 0x5f, 0xdd, 0xca, 0x9f, 0xbf, 0xb9, 0xa5, 0xda, 0x63, 0xe7, 0xe6, 0xb5, - 0x5b, 0xf9, 0xfb, 0xb5, 0x5b, 0xf9, 0x71, 0xed, 0x1a, 0x37, 0x6b, 0xd7, 0xf8, 0x6b, 0xed, 0x1a, - 0xff, 0xae, 0x5d, 0xe3, 0xac, 0xae, 0xdd, 0x7c, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, - 0xcc, 0xfd, 0x9a, 0x96, 0x05, 0x00, 0x00, + // 630 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xc1, 0x4e, 0xdb, 0x40, + 0x14, 0x8c, 0x1d, 0xe3, 0x24, 0xeb, 0x04, 0xdc, 0x2d, 0x42, 0x26, 0xad, 0x8c, 0xc5, 0xa5, 0x56, + 0xa5, 0x3a, 0x6a, 0x38, 0x54, 0xea, 0x0d, 0x48, 0x84, 0xa2, 0x4a, 0x21, 0xda, 0x10, 0xf5, 0x18, + 0x2d, 0xd9, 0xad, 0xbb, 0x02, 0xd6, 0x96, 0x77, 0x0d, 0xe5, 0xd6, 0x63, 0xc5, 0x3f, 0x70, 0x6a, + 0xfb, 0x0b, 0x3d, 0xf4, 0x0b, 0x38, 0xf6, 0x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, 0x78, 0x9a, + 0x6f, 0xb5, 0xd7, 0x83, 0xfc, 0x8a, 0xe0, 0xfe, 0x8a, 0x60, 0x97, 0x5f, 0x22, 0xe5, 0x80, 0xeb, + 0x60, 0x45, 0x48, 0xc2, 0xb8, 0x63, 0x66, 0xdb, 0xa1, 0x7c, 0x80, 0x1b, 0xd9, 0x47, 0x49, 0x94, + 0x4a, 0xa7, 0xa2, 0xe8, 0x62, 0x2a, 0x78, 0x9a, 0x24, 0x4e, 0x75, 0xc6, 0xd3, 0x24, 0x81, 0x4d, + 0x50, 0x95, 0x34, 0x39, 0x63, 0x1c, 0x9f, 0x3a, 0x35, 0x4f, 0xf3, 0xab, 0x68, 0x36, 0x6f, 0xff, + 0xd5, 0x41, 0x65, 0x90, 0x44, 0x13, 0x2a, 0xc4, 0xfd, 0x79, 0xda, 0xfc, 0x3c, 0x08, 0x0c, 0x9c, + 0x84, 0xc2, 0xd1, 0xbd, 0xb2, 0x5f, 0x43, 0x0a, 0x67, 0x2e, 0xca, 0xcf, 0x9d, 0xb2, 0xa2, 0x32, + 0x08, 0x5f, 0x01, 0x23, 0x15, 0x34, 0x51, 0x11, 0x58, 0xed, 0xcd, 0xa5, 0x11, 0x8c, 0x04, 0x4d, + 0x90, 0xb2, 0x65, 0x7f, 0x30, 0xb9, 0x20, 0xea, 0xfa, 0x1a, 0xca, 0xe0, 0x83, 0x05, 0xcd, 0x87, + 0x0b, 0xc2, 0x2d, 0x60, 0xd1, 0x4f, 0x4c, 0x8e, 0x8b, 0x98, 0x2b, 0x6a, 0x39, 0x90, 0x51, 0x79, + 0xaa, 0x0b, 0x15, 0x54, 0xff, 0xbf, 0x82, 0x37, 0xa0, 0x9e, 0xa4, 0x5c, 0xb2, 0x33, 0x3a, 0x26, + 0x58, 0x62, 0x15, 0xcb, 0x63, 0x55, 0x58, 0x85, 0xb3, 0x83, 0x25, 0x9e, 0x37, 0x02, 0x96, 0x37, + 0x62, 0x3d, 0xd2, 0x48, 0x7d, 0xb1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x00, 0xff, 0xff, 0xec, 0x58, + 0x26, 0xdd, 0x50, 0x04, 0x00, 0x00, } diff --git a/api/types/task/task.proto b/api/types/task/task.proto index e7563200e..28c6d2971 100644 --- a/api/types/task/task.proto +++ b/api/types/task/task.proto @@ -4,7 +4,6 @@ package containerd.v1.types; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; enum Status { option (gogoproto.goproto_enum_prefix) = false; @@ -49,21 +48,3 @@ message User { uint32 gid = 2; repeated uint32 additional_gids = 3; } - -message Event { - string id = 1; - - enum EventType { - EXIT = 0; - OOM = 1; - CREATE = 2; - START = 3; - EXEC_ADDED = 4; - PAUSED = 5; - } - - EventType type = 2; - uint32 pid = 3; - uint32 exit_status = 4; - google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go index 95c083337..a2b59fb9e 100644 --- a/cmd/containerd-shim/main_unix.go +++ b/cmd/containerd-shim/main_unix.go @@ -6,6 +6,7 @@ import ( "fmt" "net" "os" + "runtime" "strings" "golang.org/x/sys/unix" @@ -13,8 +14,8 @@ import ( "google.golang.org/grpc" "github.com/Sirupsen/logrus" - shimapi "github.com/containerd/containerd/api/services/shim/v1" "github.com/containerd/containerd/linux/shim" + shimapi "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/containerd/reaper" "github.com/containerd/containerd/version" "github.com/urfave/cli" @@ -66,7 +67,7 @@ func main() { return err } server := grpc.NewServer() - sv, err := shim.New(path, context.GlobalString("namespace")) + sv, err := shim.NewService(path, context.GlobalString("namespace")) if err != nil { return err } @@ -114,7 +115,24 @@ func handleSignals(signals chan os.Signal, server *grpc.Server) error { // i.e. machine reboot server.Stop() return nil + case unix.SIGUSR1: + dumpStacks() } } return nil } + +func dumpStacks() { + var ( + buf []byte + stackSize int + ) + bufferLen := 16384 + for stackSize == len(buf) { + buf = make([]byte, bufferLen) + stackSize = runtime.Stack(buf, true) + bufferLen *= 2 + } + buf = buf[:stackSize] + logrus.Infof("=== BEGIN goroutine stack dump ===\n%s\n=== END goroutine stack dump ===", buf) +} diff --git a/cmd/ctr/shim.go b/cmd/ctr/shim.go index 716458747..270295f9b 100644 --- a/cmd/ctr/shim.go +++ b/cmd/ctr/shim.go @@ -19,13 +19,16 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/console" - "github.com/containerd/containerd/api/services/shim/v1" + shim "github.com/containerd/containerd/linux/shim/v1" protobuf "github.com/gogo/protobuf/types" + google_protobuf "github.com/golang/protobuf/ptypes/empty" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/urfave/cli" ) +var empty = &google_protobuf.Empty{} + var fifoFlags = []cli.Flag{ cli.StringFlag{ Name: "stdin", @@ -94,7 +97,7 @@ var shimCreateCommand = cli.Command{ if err != nil { return err } - r, err := service.Create(ctx, &shim.CreateRequest{ + r, err := service.Create(ctx, &shim.CreateTaskRequest{ ID: id, Bundle: context.String("bundle"), Runtime: context.String("runtime"), @@ -118,7 +121,7 @@ var shimCreateCommand = cli.Command{ if err != nil { return err } - if _, err := service.Pty(ctx, &shim.PtyRequest{ + if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{ Pid: r.Pid, Width: uint32(size.Width), Height: uint32(size.Height), @@ -140,7 +143,7 @@ var shimStartCommand = cli.Command{ if err != nil { return err } - _, err = service.Start(gocontext.Background(), &shim.StartRequest{}) + _, err = service.Start(gocontext.Background(), empty) return err }, } @@ -153,7 +156,7 @@ var shimDeleteCommand = cli.Command{ if err != nil { return err } - r, err := service.Delete(gocontext.Background(), &shim.DeleteRequest{}) + r, err := service.Delete(gocontext.Background(), empty) if err != nil { return err } @@ -170,7 +173,7 @@ var shimStateCommand = cli.Command{ if err != nil { return err } - r, err := service.State(gocontext.Background(), &shim.StateRequest{}) + r, err := service.State(gocontext.Background(), empty) if err != nil { return err } @@ -227,7 +230,7 @@ var shimExecCommand = cli.Command{ return err } - rq := &shim.ExecRequest{ + rq := &shim.ExecProcessRequest{ Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: spec, @@ -254,7 +257,7 @@ var shimExecCommand = cli.Command{ if err != nil { return err } - if _, err := service.Pty(ctx, &shim.PtyRequest{ + if _, err := service.ResizePty(ctx, &shim.ResizePtyRequest{ Pid: r.Pid, Width: uint32(size.Width), Height: uint32(size.Height), @@ -276,7 +279,7 @@ var shimEventsCommand = cli.Command{ if err != nil { return err } - events, err := service.Events(gocontext.Background(), &shim.EventsRequest{}) + events, err := service.Stream(gocontext.Background(), &shim.StreamEventsRequest{}) if err != nil { return err } diff --git a/linux/bundle.go b/linux/bundle.go new file mode 100644 index 000000000..78cb4fcd3 --- /dev/null +++ b/linux/bundle.go @@ -0,0 +1,91 @@ +// +build linux + +package linux + +import ( + "bytes" + "context" + "io" + "io/ioutil" + "os" + "path/filepath" + + client "github.com/containerd/containerd/linux/shim" +) + +func loadBundle(path, namespace string) *bundle { + return &bundle{ + path: path, + namespace: namespace, + } +} + +// newBundle creates a new bundle on disk at the provided path for the given id +func newBundle(path, namespace, id string, spec []byte) (b *bundle, err error) { + if err := os.MkdirAll(path, 0700); err != nil { + return nil, err + } + path = filepath.Join(path, id) + defer func() { + if err != nil { + os.RemoveAll(path) + } + }() + if err := os.Mkdir(path, 0700); err != nil { + return nil, err + } + if err := os.Mkdir(filepath.Join(path, "rootfs"), 0700); err != nil { + return nil, err + } + f, err := os.Create(filepath.Join(path, configFilename)) + if err != nil { + return nil, err + } + defer f.Close() + _, err = io.Copy(f, bytes.NewReader(spec)) + return &bundle{ + path: path, + namespace: namespace, + }, err +} + +type bundle struct { + path string + namespace string +} + +// NewShim connects to the shim managing the bundle and tasks +func (b *bundle) NewShim(ctx context.Context, binary string, remote bool) (*client.Client, error) { + opt := client.WithStart(binary) + if !remote { + opt = client.WithLocal + } + return client.New(ctx, client.Config{ + Address: filepath.Join(b.path, "shim.sock"), + Path: b.path, + Namespace: b.namespace, + }, opt) +} + +// Connect reconnects to an existing shim +func (b *bundle) Connect(ctx context.Context, remote bool) (*client.Client, error) { + opt := client.WithConnect + if !remote { + opt = client.WithLocal + } + return client.New(ctx, client.Config{ + Address: filepath.Join(b.path, "shim.sock"), + Path: b.path, + Namespace: b.namespace, + }, opt) +} + +// spec returns the spec written to the bundle +func (b *bundle) Spec() ([]byte, error) { + return ioutil.ReadFile(filepath.Join(b.path, configFilename)) +} + +// Delete deletes the bundle from disk +func (b *bundle) Delete() error { + return os.RemoveAll(b.path) +} diff --git a/linux/list.go b/linux/list.go new file mode 100644 index 000000000..980ad2822 --- /dev/null +++ b/linux/list.go @@ -0,0 +1,75 @@ +// +build linux + +package linux + +import ( + "context" + "sync" + + "github.com/containerd/containerd/namespaces" +) + +func newTaskList() *taskList { + return &taskList{ + tasks: make(map[string]map[string]*Task), + } +} + +type taskList struct { + mu sync.Mutex + tasks map[string]map[string]*Task +} + +func (l *taskList) get(ctx context.Context, id string) (*Task, error) { + l.mu.Lock() + defer l.mu.Unlock() + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return nil, err + } + tasks, ok := l.tasks[namespace] + if !ok { + return nil, ErrTaskNotExists + } + t, ok := tasks[id] + if !ok { + return nil, ErrTaskNotExists + } + return t, nil +} + +func (l *taskList) add(ctx context.Context, t *Task) error { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return err + } + return l.addWithNamespace(namespace, t) +} + +func (l *taskList) addWithNamespace(namespace string, t *Task) error { + l.mu.Lock() + defer l.mu.Unlock() + + id := t.containerID + if _, ok := l.tasks[namespace]; !ok { + l.tasks[namespace] = make(map[string]*Task) + } + if _, ok := l.tasks[namespace][id]; ok { + return ErrTaskAlreadyExists + } + l.tasks[namespace][id] = t + return nil +} + +func (l *taskList) delete(ctx context.Context, t *Task) { + l.mu.Lock() + defer l.mu.Unlock() + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return + } + tasks, ok := l.tasks[namespace] + if ok { + delete(tasks, t.containerID) + } +} diff --git a/linux/runtime.go b/linux/runtime.go index bd1687e2e..dd3c22f9c 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -3,29 +3,29 @@ package linux import ( - "bytes" "context" "fmt" - "io" "io/ioutil" "os" "path/filepath" "strings" - "sync" "time" "google.golang.org/grpc" + "github.com/boltdb/bolt" eventsapi "github.com/containerd/containerd/api/services/events/v1" - "github.com/containerd/containerd/api/services/shim/v1" "github.com/containerd/containerd/api/types" - "github.com/containerd/containerd/api/types/task" + "github.com/containerd/containerd/containers" "github.com/containerd/containerd/events" - shimb "github.com/containerd/containerd/linux/shim" + client "github.com/containerd/containerd/linux/shim" + shim "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/containerd/log" + "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/plugin" runc "github.com/containerd/go-runc" + google_protobuf "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" "golang.org/x/sys/unix" @@ -35,6 +35,7 @@ var ( ErrTaskNotExists = errors.New("task does not exist") ErrTaskAlreadyExists = errors.New("task already exists") pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "linux") + empty = &google_protobuf.Empty{} ) const ( @@ -50,6 +51,7 @@ func init() { Init: New, Requires: []plugin.PluginType{ plugin.TaskMonitorPlugin, + plugin.MetadataPlugin, }, Config: &Config{ Shim: defaultShim, @@ -69,71 +71,6 @@ type Config struct { NoShim bool `toml:"no_shim,omitempty"` } -func newTaskList() *taskList { - return &taskList{ - tasks: make(map[string]map[string]*Task), - } -} - -type taskList struct { - mu sync.Mutex - tasks map[string]map[string]*Task -} - -func (l *taskList) get(ctx context.Context, id string) (*Task, error) { - l.mu.Lock() - defer l.mu.Unlock() - namespace, err := namespaces.NamespaceRequired(ctx) - if err != nil { - return nil, err - } - tasks, ok := l.tasks[namespace] - if !ok { - return nil, ErrTaskNotExists - } - t, ok := tasks[id] - if !ok { - return nil, ErrTaskNotExists - } - return t, nil -} - -func (l *taskList) add(ctx context.Context, t *Task) error { - namespace, err := namespaces.NamespaceRequired(ctx) - if err != nil { - return err - } - return l.addWithNamespace(namespace, t) -} - -func (l *taskList) addWithNamespace(namespace string, t *Task) error { - l.mu.Lock() - defer l.mu.Unlock() - - id := t.containerID - if _, ok := l.tasks[namespace]; !ok { - l.tasks[namespace] = make(map[string]*Task) - } - if _, ok := l.tasks[namespace][id]; ok { - return ErrTaskAlreadyExists - } - l.tasks[namespace][id] = t - return nil -} - -func (l *taskList) delete(ctx context.Context, t *Task) { - l.mu.Lock() - defer l.mu.Unlock() - namespace, err := namespaces.NamespaceRequired(ctx) - if err != nil { - return - } - tasks, ok := l.tasks[namespace] - if ok { - delete(tasks, t.containerID) - } -} - func New(ic *plugin.InitContext) (interface{}, error) { if err := os.MkdirAll(ic.Root, 0700); err != nil { return nil, err @@ -142,6 +79,10 @@ func New(ic *plugin.InitContext) (interface{}, error) { if err != nil { return nil, err } + m, err := ic.Get(plugin.MetadataPlugin) + if err != nil { + return nil, err + } cfg := ic.Config.(*Config) c, cancel := context.WithCancel(ic.Context) r := &Runtime{ @@ -155,10 +96,11 @@ func New(ic *plugin.InitContext) (interface{}, error) { monitor: monitor.(plugin.TaskMonitor), tasks: newTaskList(), emitter: events.GetPoster(ic.Context), + db: m.(*bolt.DB), } // set the events output for a monitor if it generates events r.monitor.Events(r.events) - tasks, err := r.loadAllTasks(ic.Context) + tasks, err := r.restoreTasks(ic.Context) if err != nil { return nil, err } @@ -166,6 +108,9 @@ func New(ic *plugin.InitContext) (interface{}, error) { if err := r.tasks.addWithNamespace(t.namespace, t); err != nil { return nil, err } + if err := r.handleEvents(ic.Context, t.shim); err != nil { + return nil, err + } } return r, nil } @@ -182,39 +127,44 @@ type Runtime struct { monitor plugin.TaskMonitor tasks *taskList emitter events.Poster + db *bolt.DB } func (r *Runtime) ID() string { return pluginID } -func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (t plugin.Task, err error) { +func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (_ plugin.Task, err error) { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } - path, err := r.newBundle(namespace, id, opts.Spec) + bundle, err := newBundle(filepath.Join(r.root, namespace), namespace, id, opts.Spec) if err != nil { return nil, err } - s, err := newShim(ctx, r.shim, path, namespace, r.remote) - if err != nil { - os.RemoveAll(path) - return nil, err - } - // Exit the shim on error defer func() { if err != nil { - s.Exit(context.Background(), &shim.ExitRequest{}) + bundle.Delete() + } + }() + s, err := bundle.NewShim(ctx, r.shim, r.remote) + if err != nil { + return nil, err + } + defer func() { + if err != nil { + if kerr := s.KillShim(ctx); kerr != nil { + log.G(ctx).WithError(err).Error("failed to kill shim") + } } }() if err = r.handleEvents(ctx, s); err != nil { - os.RemoveAll(path) return nil, err } - sopts := &shim.CreateRequest{ + sopts := &shim.CreateTaskRequest{ ID: id, - Bundle: path, + Bundle: bundle.path, Runtime: r.runtime, Stdin: opts.IO.Stdin, Stdout: opts.IO.Stdout, @@ -230,15 +180,14 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) }) } if _, err = s.Create(ctx, sopts); err != nil { - os.RemoveAll(path) return nil, errors.New(grpc.ErrorDesc(err)) } - c := newTask(id, namespace, opts.Spec, s) - if err := r.tasks.add(ctx, c); err != nil { + t := newTask(id, namespace, opts.Spec, s) + if err := r.tasks.add(ctx, t); err != nil { return nil, err } // after the task is created, add it to the monitor - if err = r.monitor.Monitor(c); err != nil { + if err = r.monitor.Monitor(t); err != nil { return nil, err } @@ -252,7 +201,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) } if err := r.emit(ctx, "/runtime/create", &eventsapi.RuntimeCreate{ ID: id, - Bundle: path, + Bundle: bundle.path, RootFS: runtimeMounts, IO: &eventsapi.RuntimeIO{ Stdin: opts.IO.Stdin, @@ -264,8 +213,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) }); err != nil { return nil, err } - - return c, nil + return t, nil } func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, error) { @@ -275,22 +223,25 @@ func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, erro } lc, ok := c.(*Task) if !ok { - return nil, fmt.Errorf("container cannot be cast as *linux.Container") + return nil, fmt.Errorf("task cannot be cast as *linux.Task") } - // remove the container from the monitor if err := r.monitor.Stop(lc); err != nil { - // TODO: log error here return nil, err } - rsp, err := lc.shim.Delete(ctx, &shim.DeleteRequest{}) + rsp, err := lc.shim.Delete(ctx, empty) if err != nil { return nil, errors.New(grpc.ErrorDesc(err)) } - lc.shim.Exit(ctx, &shim.ExitRequest{}) + if err := lc.shim.KillShim(ctx); err != nil { + log.G(ctx).WithError(err).Error("failed to kill shim") + } r.tasks.delete(ctx, lc) - i := c.Info() - if err := r.emit(ctx, "/runtime/delete", &eventsapi.RuntimeDelete{ + var ( + bundle = loadBundle(filepath.Join(r.root, namespace, lc.containerID), namespace) + i = c.Info() + ) + if err := r.emit(ctx, "/runtime/delete", eventsapi.RuntimeDelete{ ID: i.ID, Runtime: i.Runtime, ExitStatus: rsp.ExitStatus, @@ -302,7 +253,7 @@ func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, erro Status: rsp.ExitStatus, Timestamp: rsp.ExitedAt, Pid: rsp.Pid, - }, r.deleteBundle(namespace, lc.containerID) + }, bundle.Delete() } func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) { @@ -321,17 +272,19 @@ func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) { return o, nil } -func (r *Runtime) loadAllTasks(ctx context.Context) ([]*Task, error) { +func (r *Runtime) restoreTasks(ctx context.Context) ([]*Task, error) { dir, err := ioutil.ReadDir(r.root) if err != nil { return nil, err } var o []*Task - for _, fi := range dir { - if !fi.IsDir() { + for _, namespace := range dir { + if !namespace.IsDir() { continue } - tasks, err := r.loadTasks(ctx, fi.Name()) + name := namespace.Name() + log.G(ctx).WithField("namespace", name).Debug("loading tasks in namespace") + tasks, err := r.loadTasks(ctx, name) if err != nil { return nil, err } @@ -350,28 +303,41 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { return nil, err } var o []*Task - for _, fi := range dir { - if !fi.IsDir() { + for _, path := range dir { + if !path.IsDir() { continue } - id := fi.Name() - // TODO: optimize this if it is call frequently to list all containers - // i.e. dont' reconnect to the the shim's ever time - c, err := r.loadTask(ctx, ns, filepath.Join(r.root, ns, id)) + id := path.Name() + bundle := loadBundle(filepath.Join(r.root, ns, id), ns) + + s, err := bundle.Connect(ctx, r.remote) if err != nil { - log.G(ctx).WithError(err).Warnf("failed to load container %s/%s", ns, id) - // if we fail to load the container, connect to the shim, make sure if the shim has - // been killed and cleanup the resources still being held by the container - r.killContainer(ctx, ns, id) + log.G(ctx).WithError(err).Error("connecting to shim") + if err := r.terminate(ctx, bundle, ns, id); err != nil { + log.G(ctx).WithError(err).WithField("bundle", bundle.path).Error("failed to terminate task, leaving bundle for debugging") + continue + } + if err := bundle.Delete(); err != nil { + log.G(ctx).WithError(err).Error("delete bundle") + } continue } - o = append(o, c) + spec, err := bundle.Spec() + if err != nil { + log.G(ctx).WithError(err).Error("load task spec") + } + o = append(o, &Task{ + containerID: id, + shim: s, + spec: spec, + namespace: ns, + }) } return o, nil } -func (r *Runtime) handleEvents(ctx context.Context, s shim.ShimClient) error { - events, err := s.Events(r.eventsContext, &shim.EventsRequest{}) +func (r *Runtime) handleEvents(ctx context.Context, s *client.Client) error { + events, err := s.Stream(r.eventsContext, &shim.StreamEventsRequest{}) if err != nil { return err } @@ -379,7 +345,7 @@ func (r *Runtime) handleEvents(ctx context.Context, s shim.ShimClient) error { return nil } -func (r *Runtime) forward(ctx context.Context, events shim.Shim_EventsClient) { +func (r *Runtime) forward(ctx context.Context, events shim.Shim_StreamClient) { for { e, err := events.Recv() if err != nil { @@ -391,19 +357,19 @@ func (r *Runtime) forward(ctx context.Context, events shim.Shim_EventsClient) { topic := "" var et plugin.EventType switch e.Type { - case task.Event_CREATE: + case shim.Event_CREATE: topic = "task-create" et = plugin.CreateEvent - case task.Event_START: + case shim.Event_START: topic = "task-start" et = plugin.StartEvent - case task.Event_EXEC_ADDED: + case shim.Event_EXEC_ADDED: topic = "task-execadded" et = plugin.ExecAddEvent - case task.Event_OOM: + case shim.Event_OOM: topic = "task-oom" et = plugin.OOMEvent - case task.Event_EXIT: + case shim.Event_EXIT: topic = "task-exit" et = plugin.ExitEvent } @@ -418,7 +384,7 @@ func (r *Runtime) forward(ctx context.Context, events shim.Shim_EventsClient) { } if err := r.emit(ctx, "/runtime/"+topic, &eventsapi.RuntimeEvent{ ID: e.ID, - Type: e.Type, + Type: eventsapi.RuntimeEvent_EventType(e.Type), Pid: e.Pid, ExitStatus: e.ExitStatus, ExitedAt: e.ExitedAt, @@ -428,89 +394,51 @@ func (r *Runtime) forward(ctx context.Context, events shim.Shim_EventsClient) { } } -func (r *Runtime) newBundle(namespace, id string, spec []byte) (string, error) { - path := filepath.Join(r.root, namespace) - if err := os.MkdirAll(path, 0700); err != nil { - return "", err - } - path = filepath.Join(path, id) - if err := os.Mkdir(path, 0700); err != nil { - return "", err - } - if err := os.Mkdir(filepath.Join(path, "rootfs"), 0700); err != nil { - return "", err - } - f, err := os.Create(filepath.Join(path, configFilename)) +func (r *Runtime) terminate(ctx context.Context, bundle *bundle, ns, id string) error { + ctx = namespaces.WithNamespace(ctx, ns) + rt, err := r.getRuntime(ctx, ns, id) if err != nil { - return "", err + return err } - defer f.Close() - _, err = io.Copy(f, bytes.NewReader(spec)) - return path, err -} - -func (r *Runtime) deleteBundle(namespace, id string) error { - return os.RemoveAll(filepath.Join(r.root, namespace, id)) -} - -func (r *Runtime) loadTask(ctx context.Context, namespace, path string) (*Task, error) { - id := filepath.Base(path) - s, err := loadShim(path, namespace, r.remote) - if err != nil { - return nil, err - } - - if err = r.handleEvents(ctx, s); err != nil { - return nil, err - } - data, err := ioutil.ReadFile(filepath.Join(path, configFilename)) - if err != nil { - return nil, err - } - return &Task{ - containerID: id, - shim: s, - spec: data, - namespace: namespace, - }, nil -} - -// killContainer is used whenever the runtime fails to connect to a shim (it died) -// and needs to cleanup the container resources in the underlying runtime (runc, etc...) -func (r *Runtime) killContainer(ctx context.Context, ns, id string) { - log.G(ctx).Debug("terminating container after failed load") - runtime := &runc.Runc{ - // TODO: should we get Command provided for initial container creation? - Command: r.runtime, - LogFormat: runc.JSON, - PdeathSignal: unix.SIGKILL, - Root: filepath.Join(shimb.RuncRoot, ns), - } - if err := runtime.Kill(ctx, id, int(unix.SIGKILL), &runc.KillOpts{ - All: true, - }); err != nil { + if err := rt.Kill(ctx, id, int(unix.SIGKILL), &runc.KillOpts{All: true}); err != nil { log.G(ctx).WithError(err).Warnf("kill all processes for %s", id) } // it can take a while for the container to be killed so poll for the container's status // until it is in a stopped state status := "running" for status != "stopped" { - c, err := runtime.State(ctx, id) + c, err := rt.State(ctx, id) if err != nil { break } status = c.Status - time.Sleep(10 * time.Millisecond) + time.Sleep(50 * time.Millisecond) } - if err := runtime.Delete(ctx, id); err != nil { - log.G(ctx).WithError(err).Warnf("delete container %s", id) + if err := rt.Delete(ctx, id); err != nil { + log.G(ctx).WithError(err).Warnf("delete runtime state %s", id) } - // try to unmount the rootfs in case it was not owned by an external mount namespace - unix.Unmount(filepath.Join(r.root, ns, id, "rootfs"), 0) - // remove container bundle - if err := r.deleteBundle(ns, id); err != nil { - log.G(ctx).WithError(err).Warnf("delete container bundle %s", id) + if err := unix.Unmount(filepath.Join(bundle.path, "rootfs"), 0); err != nil { + log.G(ctx).WithError(err).Warnf("unmount task rootfs %s", id) } + return nil +} + +func (r *Runtime) getRuntime(ctx context.Context, ns, id string) (*runc.Runc, error) { + var c containers.Container + if err := r.db.View(func(tx *bolt.Tx) error { + store := metadata.NewContainerStore(tx) + var err error + c, err = store.Get(ctx, id) + return err + }); err != nil { + return nil, err + } + return &runc.Runc{ + Command: c.Runtime.Name, + LogFormat: runc.JSON, + PdeathSignal: unix.SIGKILL, + Root: filepath.Join(client.RuncRoot, ns), + }, nil } func (r *Runtime) emit(ctx context.Context, topic string, evt interface{}) error { diff --git a/linux/shim.go b/linux/shim.go deleted file mode 100644 index 90efac51f..000000000 --- a/linux/shim.go +++ /dev/null @@ -1,90 +0,0 @@ -// +build linux - -package linux - -import ( - "context" - "fmt" - "net" - "os/exec" - "path/filepath" - "syscall" - "time" - - "google.golang.org/grpc" - - "github.com/containerd/containerd/api/services/shim/v1" - localShim "github.com/containerd/containerd/linux/shim" - "github.com/containerd/containerd/log" - "github.com/containerd/containerd/reaper" - "github.com/containerd/containerd/sys" - "github.com/pkg/errors" -) - -func newShim(ctx context.Context, shimName string, path, namespace string, remote bool) (shim.ShimClient, error) { - if !remote { - return localShim.Client(path, namespace) - } - socket := filepath.Join(path, "shim.sock") - l, err := sys.CreateUnixSocket(socket) - if err != nil { - return nil, err - } - cmd := exec.Command(shimName, "--namespace", namespace) - cmd.Dir = path - f, err := l.(*net.UnixListener).File() - if err != nil { - return nil, err - } - // close our side of the socket, do not close the listener as it will - // remove the socket from disk - defer f.Close() - cmd.ExtraFiles = append(cmd.ExtraFiles, f) - // make sure the shim can be re-parented to system init - // and is cloned in a new mount namespace because the overlay/filesystems - // will be mounted by the shim - cmd.SysProcAttr = &syscall.SysProcAttr{ - Cloneflags: syscall.CLONE_NEWNS, - Setpgid: true, - } - if err := reaper.Default.Start(cmd); err != nil { - return nil, errors.Wrapf(err, "failed to start shim") - } - defer func() { - if err != nil { - cmd.Process.Kill() - reaper.Default.Wait(cmd) - } else { - log.G(ctx).WithField("socket", socket).Infof("new shim started") - } - }() - if err = sys.SetOOMScore(cmd.Process.Pid, sys.OOMScoreMaxKillable); err != nil { - return nil, errors.Wrap(err, "failed to set OOM Score on shim") - } - return connectShim(socket) -} - -func loadShim(path, namespace string, remote bool) (shim.ShimClient, error) { - if !remote { - return localShim.Client(path, namespace) - } - socket := filepath.Join(path, "shim.sock") - return connectShim(socket) -} - -func connectShim(socket string) (shim.ShimClient, error) { - // reset the logger for grpc to log to dev/null so that it does not mess with our stdio - dialOpts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithTimeout(100 * time.Second)} - dialOpts = append(dialOpts, - grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { - return net.DialTimeout("unix", socket, timeout) - }), - grpc.WithBlock(), - grpc.WithTimeout(2*time.Second), - ) - conn, err := grpc.Dial(fmt.Sprintf("unix://%s", socket), dialOpts...) - if err != nil { - return nil, errors.Wrapf(err, "failed to connect to shim via \"%s\"", fmt.Sprintf("unix://%s", socket)) - } - return shim.NewShimClient(conn), nil -} diff --git a/linux/shim/client.go b/linux/shim/client.go index ee0321f10..2abaf6010 100644 --- a/linux/shim/client.go +++ b/linux/shim/client.go @@ -1,150 +1,181 @@ -// +build !windows +// +build linux package shim import ( - "path/filepath" + "context" + "fmt" + "io" + "net" + "os" + "os/exec" + "strings" "syscall" + "time" - shimapi "github.com/containerd/containerd/api/services/shim/v1" - "github.com/containerd/containerd/api/types/task" - runc "github.com/containerd/go-runc" - google_protobuf "github.com/golang/protobuf/ptypes/empty" - "golang.org/x/net/context" "golang.org/x/sys/unix" + + "github.com/Sirupsen/logrus" + "github.com/pkg/errors" + + shim "github.com/containerd/containerd/linux/shim/v1" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/reaper" + "github.com/containerd/containerd/sys" "google.golang.org/grpc" - "google.golang.org/grpc/metadata" ) -func Client(path, namespace string) (shimapi.ShimClient, error) { - pid, err := runc.ReadPidFile(filepath.Join(path, "init.pid")) +type ClientOpt func(context.Context, Config) (shim.ShimClient, io.Closer, error) + +// WithStart executes a new shim process +func WithStart(binary string) ClientOpt { + return func(ctx context.Context, config Config) (shim.ShimClient, io.Closer, error) { + socket, err := newSocket(config) + if err != nil { + return nil, nil, err + } + // close our side of the socket, do not close the listener as it will + // remove the socket from disk + defer socket.Close() + + cmd := newCommand(binary, config, socket) + if err := reaper.Default.Start(cmd); err != nil { + return nil, nil, errors.Wrapf(err, "failed to start shim") + } + log.G(ctx).WithFields(logrus.Fields{ + "pid": cmd.Process.Pid, + "address": config.Address, + }).Infof("shim %s started", binary) + if err = sys.SetOOMScore(cmd.Process.Pid, sys.OOMScoreMaxKillable); err != nil { + return nil, nil, errors.Wrap(err, "failed to set OOM Score on shim") + } + return WithConnect(ctx, config) + } +} + +func newCommand(binary string, config Config, socket *os.File) *exec.Cmd { + args := []string{ + "--namespace", config.Namespace, + } + if config.Debug { + args = append(args, "--debug") + } + cmd := exec.Command(binary, args...) + cmd.Dir = config.Path + // make sure the shim can be re-parented to system init + // and is cloned in a new mount namespace because the overlay/filesystems + // will be mounted by the shim + cmd.SysProcAttr = &syscall.SysProcAttr{ + Cloneflags: syscall.CLONE_NEWNS, + Setpgid: true, + } + cmd.ExtraFiles = append(cmd.ExtraFiles, socket) + return cmd +} + +func newSocket(config Config) (*os.File, error) { + l, err := sys.CreateUnixSocket(config.Address) if err != nil { return nil, err } + return l.(*net.UnixListener).File() +} - s, err := New(path, namespace) +func connect(address string) (*grpc.ClientConn, error) { + gopts := []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithInsecure(), + grpc.WithTimeout(100 * time.Second), + grpc.WithDialer(dialer), + grpc.FailOnNonTempDialError(true), + } + conn, err := grpc.Dial(dialAddress(address), gopts...) + if err != nil { + return nil, errors.Wrapf(err, "failed to dial %q", address) + } + return conn, nil +} + +func dialer(address string, timeout time.Duration) (net.Conn, error) { + address = strings.TrimPrefix(address, "unix://") + return net.DialTimeout("unix", address, timeout) +} + +func dialAddress(address string) string { + return fmt.Sprintf("unix://%s", address) +} + +// WithConnect connects to an existing shim +func WithConnect(ctx context.Context, config Config) (shim.ShimClient, io.Closer, error) { + conn, err := connect(config.Address) + if err != nil { + return nil, nil, err + } + return shim.NewShimClient(conn), conn, nil +} + +// WithLocal uses an in process shim +func WithLocal(ctx context.Context, config Config) (shim.ShimClient, io.Closer, error) { + service, err := NewService(config.Path, config.Namespace) + if err != nil { + return nil, nil, err + } + return NewLocal(service), nil, nil +} + +type Config struct { + Address string + Path string + Namespace string + Debug bool +} + +// New returns a new shim client +func New(ctx context.Context, config Config, opt ClientOpt) (*Client, error) { + s, c, err := opt(ctx, config) if err != nil { return nil, err } - cl := &client{ - s: s, - } - // used when quering container status and info - cl.s.initProcess = &initProcess{ - id: filepath.Base(path), - pid: pid, - runc: &runc.Runc{ - Log: filepath.Join(path, "log.json"), - LogFormat: runc.JSON, - PdeathSignal: syscall.SIGKILL, - Root: filepath.Join(RuncRoot, namespace), - }, - } - return cl, nil -} - -type client struct { - s *Service -} - -func (c *client) Create(ctx context.Context, in *shimapi.CreateRequest, opts ...grpc.CallOption) (*shimapi.CreateResponse, error) { - return c.s.Create(ctx, in) -} - -func (c *client) Start(ctx context.Context, in *shimapi.StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.Start(ctx, in) -} - -func (c *client) Delete(ctx context.Context, in *shimapi.DeleteRequest, opts ...grpc.CallOption) (*shimapi.DeleteResponse, error) { - return c.s.Delete(ctx, in) -} - -func (c *client) DeleteProcess(ctx context.Context, in *shimapi.DeleteProcessRequest, opts ...grpc.CallOption) (*shimapi.DeleteResponse, error) { - return c.s.DeleteProcess(ctx, in) -} - -func (c *client) Exec(ctx context.Context, in *shimapi.ExecRequest, opts ...grpc.CallOption) (*shimapi.ExecResponse, error) { - return c.s.Exec(ctx, in) -} - -func (c *client) Pty(ctx context.Context, in *shimapi.PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.Pty(ctx, in) -} - -func (c *client) Events(ctx context.Context, in *shimapi.EventsRequest, opts ...grpc.CallOption) (shimapi.Shim_EventsClient, error) { - return &events{ - c: c.s.events, - ctx: ctx, + return &Client{ + ShimClient: s, + c: c, }, nil } -func (c *client) State(ctx context.Context, in *shimapi.StateRequest, opts ...grpc.CallOption) (*shimapi.StateResponse, error) { - return c.s.State(ctx, in) +type Client struct { + shim.ShimClient + + c io.Closer } -func (c *client) Pause(ctx context.Context, in *shimapi.PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.Pause(ctx, in) -} - -func (c *client) Resume(ctx context.Context, in *shimapi.ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.Resume(ctx, in) -} - -func (c *client) Kill(ctx context.Context, in *shimapi.KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.Kill(ctx, in) -} - -func (c *client) Processes(ctx context.Context, in *shimapi.ProcessesRequest, opts ...grpc.CallOption) (*shimapi.ProcessesResponse, error) { - return c.s.Processes(ctx, in) -} - -func (c *client) Exit(ctx context.Context, in *shimapi.ExitRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - // don't exit the calling process for the client - // but make sure we unmount the containers rootfs for this client - if err := unix.Unmount(filepath.Join(c.s.path, "rootfs"), 0); err != nil { - return nil, err +func (c *Client) IsAlive(ctx context.Context) (bool, error) { + _, err := c.ShimInfo(ctx, empty) + if err != nil { + if err != grpc.ErrServerStopped { + return false, err + } + return false, nil } - return empty, nil + return true, nil } -func (c *client) CloseStdin(ctx context.Context, in *shimapi.CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.CloseStdin(ctx, in) +// KillShim kills the shim forcefully +func (c *Client) KillShim(ctx context.Context) error { + info, err := c.ShimInfo(ctx, empty) + if err != nil { + return err + } + pid := int(info.ShimPid) + // make sure we don't kill ourselves if we are running a local shim + if os.Getpid() == pid { + return nil + } + return unix.Kill(pid, unix.SIGKILL) } -func (c *client) Checkpoint(ctx context.Context, in *shimapi.CheckpointRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { - return c.s.Checkpoint(ctx, in) -} - -type events struct { - c chan *task.Event - ctx context.Context -} - -func (e *events) Recv() (*task.Event, error) { - ev := <-e.c - return ev, nil -} - -func (e *events) Header() (metadata.MD, error) { - return nil, nil -} - -func (e *events) Trailer() metadata.MD { - return nil -} - -func (e *events) CloseSend() error { - return nil -} - -func (e *events) Context() context.Context { - return e.ctx -} - -func (e *events) SendMsg(m interface{}) error { - return nil -} - -func (e *events) RecvMsg(m interface{}) error { - return nil +func (c *Client) Close() error { + if c.c == nil { + return nil + } + return c.c.Close() } diff --git a/linux/shim/exec.go b/linux/shim/exec.go index cc55b21bd..e4c251fa5 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -16,7 +16,7 @@ import ( "golang.org/x/sys/unix" "github.com/containerd/console" - shimapi "github.com/containerd/containerd/api/services/shim/v1" + shimapi "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/fifo" runc "github.com/containerd/go-runc" specs "github.com/opencontainers/runtime-spec/specs-go" @@ -43,7 +43,7 @@ type execProcess struct { terminal bool } -func newExecProcess(context context.Context, path string, r *shimapi.ExecRequest, parent *initProcess, id int) (process, error) { +func newExecProcess(context context.Context, path string, r *shimapi.ExecProcessRequest, parent *initProcess, id int) (process, error) { e := &execProcess{ id: id, parent: parent, @@ -120,17 +120,6 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecRequest return e, nil } -func rlimits(rr []*shimapi.Rlimit) (o []specs.LinuxRlimit) { - for _, r := range rr { - o = append(o, specs.LinuxRlimit{ - Type: r.Type, - Hard: r.Hard, - Soft: r.Soft, - }) - } - return o -} - func (e *execProcess) Pid() int { return e.pid } diff --git a/linux/shim/init.go b/linux/shim/init.go index 47ef38cb2..b1897e8b9 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -17,7 +17,7 @@ import ( "golang.org/x/sys/unix" "github.com/containerd/console" - shimapi "github.com/containerd/containerd/api/services/shim/v1" + shimapi "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/containerd/log" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/plugin" @@ -52,7 +52,7 @@ type initProcess struct { terminal bool } -func newInitProcess(context context.Context, path, namespace string, r *shimapi.CreateRequest) (*initProcess, error) { +func newInitProcess(context context.Context, path, namespace string, r *shimapi.CreateTaskRequest) (*initProcess, error) { for _, rm := range r.Rootfs { m := &mount.Mount{ Type: rm.Type, @@ -104,9 +104,10 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi. WorkDir: filepath.Join(r.Bundle, "work"), ParentPath: r.ParentCheckpoint, }, - PidFile: pidFile, - IO: io, - NoPivot: r.NoPivot, + PidFile: pidFile, + IO: io, + // TODO: implement runtime options + //NoPivot: r.NoPivot, Detach: true, NoSubreaper: true, } @@ -117,7 +118,7 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi. opts := &runc.CreateOpts{ PidFile: pidFile, IO: io, - NoPivot: r.NoPivot, + // NoPivot: r.NoPivot, } if socket != nil { opts.ConsoleSocket = socket @@ -253,7 +254,7 @@ func (p *initProcess) Stdin() io.Closer { return p.stdin } -func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointRequest) error { +func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointTaskRequest) error { var actions []runc.CheckpointAction /* if !r.Exit { diff --git a/linux/shim/local.go b/linux/shim/local.go new file mode 100644 index 000000000..c26be7b11 --- /dev/null +++ b/linux/shim/local.go @@ -0,0 +1,126 @@ +// +build !windows + +package shim + +import ( + "path/filepath" + + shimapi "github.com/containerd/containerd/linux/shim/v1" + google_protobuf "github.com/golang/protobuf/ptypes/empty" + "golang.org/x/net/context" + "golang.org/x/sys/unix" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// NewLocal returns a shim client implementation for issue commands to a shim +func NewLocal(s *Service) shimapi.ShimClient { + return &local{ + s: s, + } +} + +type local struct { + s *Service +} + +func (c *local) Create(ctx context.Context, in *shimapi.CreateTaskRequest, opts ...grpc.CallOption) (*shimapi.CreateTaskResponse, error) { + return c.s.Create(ctx, in) +} + +func (c *local) Start(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.Start(ctx, in) +} + +func (c *local) Delete(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*shimapi.DeleteResponse, error) { + // make sure we unmount the containers rootfs for this local + if err := unix.Unmount(filepath.Join(c.s.path, "rootfs"), 0); err != nil { + return nil, err + } + return c.s.Delete(ctx, in) +} + +func (c *local) DeleteProcess(ctx context.Context, in *shimapi.DeleteProcessRequest, opts ...grpc.CallOption) (*shimapi.DeleteResponse, error) { + return c.s.DeleteProcess(ctx, in) +} + +func (c *local) Exec(ctx context.Context, in *shimapi.ExecProcessRequest, opts ...grpc.CallOption) (*shimapi.ExecProcessResponse, error) { + return c.s.Exec(ctx, in) +} + +func (c *local) ResizePty(ctx context.Context, in *shimapi.ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.ResizePty(ctx, in) +} + +func (c *local) Stream(ctx context.Context, in *shimapi.StreamEventsRequest, opts ...grpc.CallOption) (shimapi.Shim_StreamClient, error) { + return &events{ + c: c.s.events, + ctx: ctx, + }, nil +} + +func (c *local) State(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*shimapi.StateResponse, error) { + return c.s.State(ctx, in) +} + +func (c *local) Pause(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.Pause(ctx, in) +} + +func (c *local) Resume(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.Resume(ctx, in) +} + +func (c *local) Kill(ctx context.Context, in *shimapi.KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.Kill(ctx, in) +} + +func (c *local) ListProcesses(ctx context.Context, in *shimapi.ListProcessesRequest, opts ...grpc.CallOption) (*shimapi.ListProcessesResponse, error) { + return c.s.ListProcesses(ctx, in) +} + +func (c *local) CloseIO(ctx context.Context, in *shimapi.CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.CloseIO(ctx, in) +} + +func (c *local) Checkpoint(ctx context.Context, in *shimapi.CheckpointTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.Checkpoint(ctx, in) +} + +func (c *local) ShimInfo(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*shimapi.ShimInfoResponse, error) { + return c.s.ShimInfo(ctx, in) +} + +type events struct { + c chan *shimapi.Event + ctx context.Context +} + +func (e *events) Recv() (*shimapi.Event, error) { + ev := <-e.c + return ev, nil +} + +func (e *events) Header() (metadata.MD, error) { + return nil, nil +} + +func (e *events) Trailer() metadata.MD { + return nil +} + +func (e *events) CloseSend() error { + return nil +} + +func (e *events) Context() context.Context { + return e.ctx +} + +func (e *events) SendMsg(m interface{}) error { + return nil +} + +func (e *events) RecvMsg(m interface{}) error { + return nil +} diff --git a/linux/shim/service.go b/linux/shim/service.go index e4a8f89bb..9a9baf3bd 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -9,8 +9,8 @@ import ( "syscall" "github.com/containerd/console" - shimapi "github.com/containerd/containerd/api/services/shim/v1" "github.com/containerd/containerd/api/types/task" + shimapi "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/containerd/reaper" google_protobuf "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" @@ -22,15 +22,15 @@ var empty = &google_protobuf.Empty{} const RuncRoot = "/run/containerd/runc" -// New returns a new shim service that can be used via GRPC -func New(path, namespace string) (*Service, error) { +// NewService returns a new shim service that can be used via GRPC +func NewService(path, namespace string) (*Service, error) { if namespace == "" { return nil, fmt.Errorf("shim namespace cannot be empty") } return &Service{ path: path, processes: make(map[int]process), - events: make(chan *task.Event, 4096), + events: make(chan *shimapi.Event, 4096), namespace: namespace, }, nil } @@ -42,14 +42,14 @@ type Service struct { bundle string mu sync.Mutex processes map[int]process - events chan *task.Event + events chan *shimapi.Event eventsMu sync.Mutex - deferredEvent *task.Event + deferredEvent *shimapi.Event execID int namespace string } -func (s *Service) Create(ctx context.Context, r *shimapi.CreateRequest) (*shimapi.CreateResponse, error) { +func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*shimapi.CreateTaskResponse, error) { process, err := newInitProcess(ctx, s.path, s.namespace, r) if err != nil { return nil, err @@ -65,30 +65,30 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateRequest) (*shimap ExitCh: make(chan int, 1), } reaper.Default.Register(pid, cmd) - s.events <- &task.Event{ - Type: task.Event_CREATE, + s.events <- &shimapi.Event{ + Type: shimapi.Event_CREATE, ID: r.ID, Pid: uint32(pid), } go s.waitExit(process, pid, cmd) - return &shimapi.CreateResponse{ + return &shimapi.CreateTaskResponse{ Pid: uint32(pid), }, nil } -func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*google_protobuf.Empty, error) { +func (s *Service) Start(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { if err := s.initProcess.Start(ctx); err != nil { return nil, err } - s.events <- &task.Event{ - Type: task.Event_START, + s.events <- &shimapi.Event{ + Type: shimapi.Event_START, ID: s.id, Pid: uint32(s.initProcess.Pid()), } return empty, nil } -func (s *Service) Delete(ctx context.Context, r *shimapi.DeleteRequest) (*shimapi.DeleteResponse, error) { +func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimapi.DeleteResponse, error) { p := s.initProcess // TODO (@crosbymichael): how to handle errors here p.Delete(ctx) @@ -124,7 +124,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq }, nil } -func (s *Service) Exec(ctx context.Context, r *shimapi.ExecRequest) (*shimapi.ExecResponse, error) { +func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shimapi.ExecProcessResponse, error) { s.mu.Lock() defer s.mu.Unlock() s.execID++ @@ -140,18 +140,18 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecRequest) (*shimapi.Ex reaper.Default.Register(pid, cmd) s.processes[pid] = process - s.events <- &task.Event{ - Type: task.Event_EXEC_ADDED, + s.events <- &shimapi.Event{ + Type: shimapi.Event_EXEC_ADDED, ID: s.id, Pid: uint32(pid), } go s.waitExit(process, pid, cmd) - return &shimapi.ExecResponse{ + return &shimapi.ExecProcessResponse{ Pid: uint32(pid), }, nil } -func (s *Service) Pty(ctx context.Context, r *shimapi.PtyRequest) (*google_protobuf.Empty, error) { +func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) { if r.Pid == 0 { return nil, errors.Errorf("pid not provided in request") } @@ -171,7 +171,7 @@ func (s *Service) Pty(ctx context.Context, r *shimapi.PtyRequest) (*google_proto return empty, nil } -func (s *Service) Events(r *shimapi.EventsRequest, stream shimapi.Shim_EventsServer) error { +func (s *Service) Stream(r *shimapi.StreamEventsRequest, stream shimapi.Shim_StreamServer) error { s.eventsMu.Lock() defer s.eventsMu.Unlock() @@ -195,7 +195,7 @@ func (s *Service) Events(r *shimapi.EventsRequest, stream shimapi.Shim_EventsSer } } -func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) { +func (s *Service) State(ctx context.Context, r *google_protobuf.Empty) (*shimapi.StateResponse, error) { st, err := s.initProcess.ContainerStatus(ctx) if err != nil { return nil, err @@ -245,28 +245,20 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi. return o, nil } -func (s *Service) Pause(ctx context.Context, r *shimapi.PauseRequest) (*google_protobuf.Empty, error) { +func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { if err := s.initProcess.Pause(ctx); err != nil { return nil, err } return empty, nil } -func (s *Service) Resume(ctx context.Context, r *shimapi.ResumeRequest) (*google_protobuf.Empty, error) { +func (s *Service) Resume(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { if err := s.initProcess.Resume(ctx); err != nil { return nil, err } return empty, nil } -func (s *Service) Exit(ctx context.Context, r *shimapi.ExitRequest) (*google_protobuf.Empty, error) { - // signal ourself to exit - if err := unix.Kill(os.Getpid(), syscall.SIGTERM); err != nil { - return nil, err - } - return empty, nil -} - func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_protobuf.Empty, error) { if r.Pid == 0 { if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil { @@ -300,7 +292,7 @@ func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_pro return empty, nil } -func (s *Service) Processes(ctx context.Context, r *shimapi.ProcessesRequest) (*shimapi.ProcessesResponse, error) { +func (s *Service) ListProcesses(ctx context.Context, r *shimapi.ListProcessesRequest) (*shimapi.ListProcessesResponse, error) { pids, err := s.getContainerPids(ctx, r.ID) if err != nil { return nil, err @@ -311,13 +303,13 @@ func (s *Service) Processes(ctx context.Context, r *shimapi.ProcessesRequest) (* Pid: pid, }) } - resp := &shimapi.ProcessesResponse{ + resp := &shimapi.ListProcessesResponse{ Processes: ps, } return resp, nil } -func (s *Service) CloseStdin(ctx context.Context, r *shimapi.CloseStdinRequest) (*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)] if !ok { return nil, fmt.Errorf("process does not exist %d", r.Pid) @@ -328,20 +320,26 @@ func (s *Service) CloseStdin(ctx context.Context, r *shimapi.CloseStdinRequest) return empty, nil } -func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointRequest) (*google_protobuf.Empty, error) { +func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointTaskRequest) (*google_protobuf.Empty, error) { if err := s.initProcess.Checkpoint(ctx, r); err != nil { return nil, err } return empty, nil } +func (s *Service) ShimInfo(ctx context.Context, r *google_protobuf.Empty) (*shimapi.ShimInfoResponse, error) { + return &shimapi.ShimInfoResponse{ + ShimPid: uint32(os.Getpid()), + }, nil +} + func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) { status := <-cmd.ExitCh p.Exited(status) reaper.Default.Delete(pid) - s.events <- &task.Event{ - Type: task.Event_EXIT, + s.events <- &shimapi.Event{ + Type: shimapi.Event_EXIT, ID: s.id, Pid: uint32(pid), ExitStatus: uint32(status), diff --git a/api/services/shim/v1/shim.pb.go b/linux/shim/v1/shim.pb.go similarity index 69% rename from api/services/shim/v1/shim.pb.go rename to linux/shim/v1/shim.pb.go index c6bbc7c2e..cdde478c6 100644 --- a/api/services/shim/v1/shim.pb.go +++ b/linux/shim/v1/shim.pb.go @@ -1,35 +1,30 @@ // Code generated by protoc-gen-gogo. -// source: github.com/containerd/containerd/api/services/shim/v1/shim.proto +// source: github.com/containerd/containerd/linux/shim/v1/shim.proto // DO NOT EDIT! /* Package shim is a generated protocol buffer package. It is generated from these files: - github.com/containerd/containerd/api/services/shim/v1/shim.proto + github.com/containerd/containerd/linux/shim/v1/shim.proto It has these top-level messages: - CreateRequest - CreateResponse - StartRequest - DeleteRequest + CreateTaskRequest + CreateTaskResponse DeleteResponse DeleteProcessRequest - ExecRequest - Rlimit - ExecResponse - PtyRequest - EventsRequest - StateRequest + ExecProcessRequest + ExecProcessResponse + ResizePtyRequest StateResponse - PauseRequest - ResumeRequest - ExitRequest KillRequest - CloseStdinRequest - ProcessesRequest - ProcessesResponse - CheckpointRequest + CloseIORequest + ListProcessesRequest + ListProcessesResponse + CheckpointTaskRequest + ShimInfoResponse + StreamEventsRequest + Event */ package shim @@ -39,9 +34,9 @@ import math "math" import google_protobuf "github.com/gogo/protobuf/types" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/gogo/protobuf/types" import containerd_types "github.com/containerd/containerd/api/types" import containerd_v1_types "github.com/containerd/containerd/api/types/task" -import _ "github.com/gogo/protobuf/types" import time "time" @@ -70,45 +65,63 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package -type CreateRequest struct { +type Event_EventType int32 + +const ( + Event_EXIT Event_EventType = 0 + Event_OOM Event_EventType = 1 + Event_CREATE Event_EventType = 2 + Event_START Event_EventType = 3 + Event_EXEC_ADDED Event_EventType = 4 + Event_PAUSED Event_EventType = 5 +) + +var Event_EventType_name = map[int32]string{ + 0: "EXIT", + 1: "OOM", + 2: "CREATE", + 3: "START", + 4: "EXEC_ADDED", + 5: "PAUSED", +} +var Event_EventType_value = map[string]int32{ + "EXIT": 0, + "OOM": 1, + "CREATE": 2, + "START": 3, + "EXEC_ADDED": 4, + "PAUSED": 5, +} + +func (x Event_EventType) String() string { + return proto.EnumName(Event_EventType_name, int32(x)) +} +func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorShim, []int{15, 0} } + +type CreateTaskRequest struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` Runtime string `protobuf:"bytes,3,opt,name=runtime,proto3" json:"runtime,omitempty"` - NoPivot bool `protobuf:"varint,4,opt,name=no_pivot,json=noPivot,proto3" json:"no_pivot,omitempty"` + Rootfs []*containerd_types.Mount `protobuf:"bytes,4,rep,name=rootfs" json:"rootfs,omitempty"` Terminal bool `protobuf:"varint,5,opt,name=terminal,proto3" json:"terminal,omitempty"` Stdin string `protobuf:"bytes,6,opt,name=stdin,proto3" json:"stdin,omitempty"` Stdout string `protobuf:"bytes,7,opt,name=stdout,proto3" json:"stdout,omitempty"` Stderr string `protobuf:"bytes,8,opt,name=stderr,proto3" json:"stderr,omitempty"` - Rootfs []*containerd_types.Mount `protobuf:"bytes,9,rep,name=rootfs" json:"rootfs,omitempty"` - Checkpoint string `protobuf:"bytes,10,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` - ParentCheckpoint string `protobuf:"bytes,11,opt,name=parent_checkpoint,json=parentCheckpoint,proto3" json:"parent_checkpoint,omitempty"` + Checkpoint string `protobuf:"bytes,9,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` + ParentCheckpoint string `protobuf:"bytes,10,opt,name=parent_checkpoint,json=parentCheckpoint,proto3" json:"parent_checkpoint,omitempty"` } -func (m *CreateRequest) Reset() { *m = CreateRequest{} } -func (*CreateRequest) ProtoMessage() {} -func (*CreateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{0} } +func (m *CreateTaskRequest) Reset() { *m = CreateTaskRequest{} } +func (*CreateTaskRequest) ProtoMessage() {} +func (*CreateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{0} } -type CreateResponse struct { +type CreateTaskResponse struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` } -func (m *CreateResponse) Reset() { *m = CreateResponse{} } -func (*CreateResponse) ProtoMessage() {} -func (*CreateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{1} } - -type StartRequest struct { -} - -func (m *StartRequest) Reset() { *m = StartRequest{} } -func (*StartRequest) ProtoMessage() {} -func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{2} } - -type DeleteRequest struct { -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{3} } +func (m *CreateTaskResponse) Reset() { *m = CreateTaskResponse{} } +func (*CreateTaskResponse) ProtoMessage() {} +func (*CreateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{1} } type DeleteResponse struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` @@ -118,7 +131,7 @@ type DeleteResponse struct { func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{4} } +func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{2} } type DeleteProcessRequest struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` @@ -126,9 +139,9 @@ type DeleteProcessRequest struct { func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } func (*DeleteProcessRequest) ProtoMessage() {} -func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{5} } +func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{3} } -type ExecRequest struct { +type ExecProcessRequest struct { Terminal bool `protobuf:"varint,1,opt,name=terminal,proto3" json:"terminal,omitempty"` Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"` Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"` @@ -136,51 +149,27 @@ type ExecRequest struct { Spec *google_protobuf.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"` } -func (m *ExecRequest) Reset() { *m = ExecRequest{} } -func (*ExecRequest) ProtoMessage() {} -func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{6} } +func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} } +func (*ExecProcessRequest) ProtoMessage() {} +func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{4} } -type Rlimit struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Hard uint64 `protobuf:"varint,2,opt,name=hard,proto3" json:"hard,omitempty"` - Soft uint64 `protobuf:"varint,3,opt,name=soft,proto3" json:"soft,omitempty"` -} - -func (m *Rlimit) Reset() { *m = Rlimit{} } -func (*Rlimit) ProtoMessage() {} -func (*Rlimit) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} } - -type ExecResponse struct { +type ExecProcessResponse struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` } -func (m *ExecResponse) Reset() { *m = ExecResponse{} } -func (*ExecResponse) ProtoMessage() {} -func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{8} } +func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} } +func (*ExecProcessResponse) ProtoMessage() {} +func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{5} } -type PtyRequest struct { +type ResizePtyRequest struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` Width uint32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` } -func (m *PtyRequest) Reset() { *m = PtyRequest{} } -func (*PtyRequest) ProtoMessage() {} -func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{9} } - -type EventsRequest struct { -} - -func (m *EventsRequest) Reset() { *m = EventsRequest{} } -func (*EventsRequest) ProtoMessage() {} -func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{10} } - -type StateRequest struct { -} - -func (m *StateRequest) Reset() { *m = StateRequest{} } -func (*StateRequest) ProtoMessage() {} -func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} } +func (m *ResizePtyRequest) Reset() { *m = ResizePtyRequest{} } +func (*ResizePtyRequest) ProtoMessage() {} +func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{6} } type StateResponse struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -196,28 +185,7 @@ type StateResponse struct { func (m *StateResponse) Reset() { *m = StateResponse{} } func (*StateResponse) ProtoMessage() {} -func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{12} } - -type PauseRequest struct { -} - -func (m *PauseRequest) Reset() { *m = PauseRequest{} } -func (*PauseRequest) ProtoMessage() {} -func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{13} } - -type ResumeRequest struct { -} - -func (m *ResumeRequest) Reset() { *m = ResumeRequest{} } -func (*ResumeRequest) ProtoMessage() {} -func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} } - -type ExitRequest struct { -} - -func (m *ExitRequest) Reset() { *m = ExitRequest{} } -func (*ExitRequest) ProtoMessage() {} -func (*ExitRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } +func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} } type KillRequest struct { Signal uint32 `protobuf:"varint,1,opt,name=signal,proto3" json:"signal,omitempty"` @@ -227,63 +195,87 @@ type KillRequest struct { func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} -func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} } +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{8} } -type CloseStdinRequest struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` +type CloseIORequest struct { + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + Stdin bool `protobuf:"varint,2,opt,name=stdin,proto3" json:"stdin,omitempty"` } -func (m *CloseStdinRequest) Reset() { *m = CloseStdinRequest{} } -func (*CloseStdinRequest) ProtoMessage() {} -func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{17} } +func (m *CloseIORequest) Reset() { *m = CloseIORequest{} } +func (*CloseIORequest) ProtoMessage() {} +func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{9} } -type ProcessesRequest struct { +type ListProcessesRequest struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } -func (m *ProcessesRequest) Reset() { *m = ProcessesRequest{} } -func (*ProcessesRequest) ProtoMessage() {} -func (*ProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{18} } +func (m *ListProcessesRequest) Reset() { *m = ListProcessesRequest{} } +func (*ListProcessesRequest) ProtoMessage() {} +func (*ListProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{10} } -type ProcessesResponse struct { +type ListProcessesResponse struct { Processes []*containerd_v1_types.Process `protobuf:"bytes,1,rep,name=processes" json:"processes,omitempty"` } -func (m *ProcessesResponse) Reset() { *m = ProcessesResponse{} } -func (*ProcessesResponse) ProtoMessage() {} -func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{19} } +func (m *ListProcessesResponse) Reset() { *m = ListProcessesResponse{} } +func (*ListProcessesResponse) ProtoMessage() {} +func (*ListProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} } -type CheckpointRequest struct { +type CheckpointTaskRequest struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Options map[string]string `protobuf:"bytes,2,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *CheckpointRequest) Reset() { *m = CheckpointRequest{} } -func (*CheckpointRequest) ProtoMessage() {} -func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{20} } +func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } +func (*CheckpointTaskRequest) ProtoMessage() {} +func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{12} } + +type ShimInfoResponse struct { + ShimPid uint32 `protobuf:"varint,1,opt,name=shim_pid,json=shimPid,proto3" json:"shim_pid,omitempty"` +} + +func (m *ShimInfoResponse) Reset() { *m = ShimInfoResponse{} } +func (*ShimInfoResponse) ProtoMessage() {} +func (*ShimInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{13} } + +type StreamEventsRequest struct { +} + +func (m *StreamEventsRequest) Reset() { *m = StreamEventsRequest{} } +func (*StreamEventsRequest) ProtoMessage() {} +func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} } + +type Event struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type Event_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.runtime.linux.shim.v1.Event_EventType" json:"type,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` +} + +func (m *Event) Reset() { *m = Event{} } +func (*Event) ProtoMessage() {} +func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } func init() { - proto.RegisterType((*CreateRequest)(nil), "containerd.runtime.linux.shim.v1.CreateRequest") - proto.RegisterType((*CreateResponse)(nil), "containerd.runtime.linux.shim.v1.CreateResponse") - proto.RegisterType((*StartRequest)(nil), "containerd.runtime.linux.shim.v1.StartRequest") - proto.RegisterType((*DeleteRequest)(nil), "containerd.runtime.linux.shim.v1.DeleteRequest") + proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest") + proto.RegisterType((*CreateTaskResponse)(nil), "containerd.runtime.linux.shim.v1.CreateTaskResponse") proto.RegisterType((*DeleteResponse)(nil), "containerd.runtime.linux.shim.v1.DeleteResponse") proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.runtime.linux.shim.v1.DeleteProcessRequest") - proto.RegisterType((*ExecRequest)(nil), "containerd.runtime.linux.shim.v1.ExecRequest") - proto.RegisterType((*Rlimit)(nil), "containerd.runtime.linux.shim.v1.Rlimit") - proto.RegisterType((*ExecResponse)(nil), "containerd.runtime.linux.shim.v1.ExecResponse") - proto.RegisterType((*PtyRequest)(nil), "containerd.runtime.linux.shim.v1.PtyRequest") - proto.RegisterType((*EventsRequest)(nil), "containerd.runtime.linux.shim.v1.EventsRequest") - proto.RegisterType((*StateRequest)(nil), "containerd.runtime.linux.shim.v1.StateRequest") + proto.RegisterType((*ExecProcessRequest)(nil), "containerd.runtime.linux.shim.v1.ExecProcessRequest") + proto.RegisterType((*ExecProcessResponse)(nil), "containerd.runtime.linux.shim.v1.ExecProcessResponse") + proto.RegisterType((*ResizePtyRequest)(nil), "containerd.runtime.linux.shim.v1.ResizePtyRequest") proto.RegisterType((*StateResponse)(nil), "containerd.runtime.linux.shim.v1.StateResponse") - proto.RegisterType((*PauseRequest)(nil), "containerd.runtime.linux.shim.v1.PauseRequest") - proto.RegisterType((*ResumeRequest)(nil), "containerd.runtime.linux.shim.v1.ResumeRequest") - proto.RegisterType((*ExitRequest)(nil), "containerd.runtime.linux.shim.v1.ExitRequest") proto.RegisterType((*KillRequest)(nil), "containerd.runtime.linux.shim.v1.KillRequest") - proto.RegisterType((*CloseStdinRequest)(nil), "containerd.runtime.linux.shim.v1.CloseStdinRequest") - proto.RegisterType((*ProcessesRequest)(nil), "containerd.runtime.linux.shim.v1.ProcessesRequest") - proto.RegisterType((*ProcessesResponse)(nil), "containerd.runtime.linux.shim.v1.ProcessesResponse") - proto.RegisterType((*CheckpointRequest)(nil), "containerd.runtime.linux.shim.v1.CheckpointRequest") + proto.RegisterType((*CloseIORequest)(nil), "containerd.runtime.linux.shim.v1.CloseIORequest") + proto.RegisterType((*ListProcessesRequest)(nil), "containerd.runtime.linux.shim.v1.ListProcessesRequest") + proto.RegisterType((*ListProcessesResponse)(nil), "containerd.runtime.linux.shim.v1.ListProcessesResponse") + proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CheckpointTaskRequest") + proto.RegisterType((*ShimInfoResponse)(nil), "containerd.runtime.linux.shim.v1.ShimInfoResponse") + proto.RegisterType((*StreamEventsRequest)(nil), "containerd.runtime.linux.shim.v1.StreamEventsRequest") + proto.RegisterType((*Event)(nil), "containerd.runtime.linux.shim.v1.Event") + proto.RegisterEnum("containerd.runtime.linux.shim.v1.Event_EventType", Event_EventType_name, Event_EventType_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -297,21 +289,23 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Shim service type ShimClient interface { - Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) - Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // State returns shim and task state information. + State(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*StateResponse, error) + Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) + Start(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Delete(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*DeleteResponse, error) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) - Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) - Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Exit(ctx context.Context, in *ExitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) + ListProcesses(ctx context.Context, in *ListProcessesRequest, opts ...grpc.CallOption) (*ListProcessesResponse, error) + Pause(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Resume(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Stream(ctx context.Context, in *StreamEventsRequest, opts ...grpc.CallOption) (Shim_StreamClient, error) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) - Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) + ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // ShimInfo returns information about the shim. + ShimInfo(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*ShimInfoResponse, error) } type shimClient struct { @@ -322,8 +316,17 @@ func NewShimClient(cc *grpc.ClientConn) ShimClient { return &shimClient{cc} } -func (c *shimClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { - out := new(CreateResponse) +func (c *shimClient) State(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*StateResponse, error) { + out := new(StateResponse) + err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/State", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *shimClient) Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) { + out := new(CreateTaskResponse) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Create", in, out, c.cc, opts...) if err != nil { return nil, err @@ -331,7 +334,7 @@ func (c *shimClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc return out, nil } -func (c *shimClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *shimClient) Start(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Start", in, out, c.cc, opts...) if err != nil { @@ -340,7 +343,7 @@ func (c *shimClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.C return out, nil } -func (c *shimClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *shimClient) Delete(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Delete", in, out, c.cc, opts...) if err != nil { @@ -358,25 +361,16 @@ func (c *shimClient) DeleteProcess(ctx context.Context, in *DeleteProcessRequest return out, nil } -func (c *shimClient) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) { - out := new(StateResponse) - err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/State", in, out, c.cc, opts...) +func (c *shimClient) ListProcesses(ctx context.Context, in *ListProcessesRequest, opts ...grpc.CallOption) (*ListProcessesResponse, error) { + out := new(ListProcessesResponse) + err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/ListProcesses", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *shimClient) Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) { - out := new(ProcessesResponse) - err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Processes", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *shimClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *shimClient) Pause(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Pause", in, out, c.cc, opts...) if err != nil { @@ -385,7 +379,7 @@ func (c *shimClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.C return out, nil } -func (c *shimClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *shimClient) Resume(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Resume", in, out, c.cc, opts...) if err != nil { @@ -394,7 +388,7 @@ func (c *shimClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc return out, nil } -func (c *shimClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *shimClient) Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Checkpoint", in, out, c.cc, opts...) if err != nil { @@ -403,21 +397,12 @@ func (c *shimClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opts return out, nil } -func (c *shimClient) Exit(ctx context.Context, in *ExitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { - out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Exit", in, out, c.cc, opts...) +func (c *shimClient) Stream(ctx context.Context, in *StreamEventsRequest, opts ...grpc.CallOption) (Shim_StreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Shim_serviceDesc.Streams[0], c.cc, "/containerd.runtime.linux.shim.v1.Shim/Stream", opts...) if err != nil { return nil, err } - return out, nil -} - -func (c *shimClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Shim_serviceDesc.Streams[0], c.cc, "/containerd.runtime.linux.shim.v1.Shim/Events", opts...) - if err != nil { - return nil, err - } - x := &shimEventsClient{stream} + x := &shimStreamClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -427,17 +412,17 @@ func (c *shimClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc return x, nil } -type Shim_EventsClient interface { - Recv() (*containerd_v1_types.Event, error) +type Shim_StreamClient interface { + Recv() (*Event, error) grpc.ClientStream } -type shimEventsClient struct { +type shimStreamClient struct { grpc.ClientStream } -func (x *shimEventsClient) Recv() (*containerd_v1_types.Event, error) { - m := new(containerd_v1_types.Event) +func (x *shimStreamClient) Recv() (*Event, error) { + m := new(Event) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -453,8 +438,8 @@ func (c *shimClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.Cal return out, nil } -func (c *shimClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) { - out := new(ExecResponse) +func (c *shimClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) { + out := new(ExecProcessResponse) err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Exec", in, out, c.cc, opts...) if err != nil { return nil, err @@ -462,18 +447,27 @@ func (c *shimClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.Cal return out, nil } -func (c *shimClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *shimClient) ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Pty", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/ResizePty", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *shimClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *shimClient) CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/CloseStdin", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/CloseIO", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *shimClient) ShimInfo(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*ShimInfoResponse, error) { + out := new(ShimInfoResponse) + err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/ShimInfo", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -483,29 +477,49 @@ func (c *shimClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts // Server API for Shim service type ShimServer interface { - Create(context.Context, *CreateRequest) (*CreateResponse, error) - Start(context.Context, *StartRequest) (*google_protobuf1.Empty, error) - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // State returns shim and task state information. + State(context.Context, *google_protobuf1.Empty) (*StateResponse, error) + Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) + Start(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) + Delete(context.Context, *google_protobuf1.Empty) (*DeleteResponse, error) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) - State(context.Context, *StateRequest) (*StateResponse, error) - Processes(context.Context, *ProcessesRequest) (*ProcessesResponse, error) - Pause(context.Context, *PauseRequest) (*google_protobuf1.Empty, error) - Resume(context.Context, *ResumeRequest) (*google_protobuf1.Empty, error) - Checkpoint(context.Context, *CheckpointRequest) (*google_protobuf1.Empty, error) - Exit(context.Context, *ExitRequest) (*google_protobuf1.Empty, error) - Events(*EventsRequest, Shim_EventsServer) error + ListProcesses(context.Context, *ListProcessesRequest) (*ListProcessesResponse, error) + Pause(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) + Resume(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) + Checkpoint(context.Context, *CheckpointTaskRequest) (*google_protobuf1.Empty, error) + Stream(*StreamEventsRequest, Shim_StreamServer) error Kill(context.Context, *KillRequest) (*google_protobuf1.Empty, error) - Exec(context.Context, *ExecRequest) (*ExecResponse, error) - Pty(context.Context, *PtyRequest) (*google_protobuf1.Empty, error) - CloseStdin(context.Context, *CloseStdinRequest) (*google_protobuf1.Empty, error) + Exec(context.Context, *ExecProcessRequest) (*ExecProcessResponse, error) + ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf1.Empty, error) + CloseIO(context.Context, *CloseIORequest) (*google_protobuf1.Empty, error) + // ShimInfo returns information about the shim. + ShimInfo(context.Context, *google_protobuf1.Empty) (*ShimInfoResponse, error) } func RegisterShimServer(s *grpc.Server, srv ShimServer) { s.RegisterService(&_Shim_serviceDesc, srv) } +func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).State(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.runtime.linux.shim.v1.Shim/State", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).State(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _Shim_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateRequest) + in := new(CreateTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -517,13 +531,13 @@ func _Shim_Create_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Create(ctx, req.(*CreateRequest)) + return srv.(ShimServer).Create(ctx, req.(*CreateTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Shim_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartRequest) + in := new(google_protobuf1.Empty) if err := dec(in); err != nil { return nil, err } @@ -535,13 +549,13 @@ func _Shim_Start_Handler(srv interface{}, ctx context.Context, dec func(interfac FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Start", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Start(ctx, req.(*StartRequest)) + return srv.(ShimServer).Start(ctx, req.(*google_protobuf1.Empty)) } return interceptor(ctx, in, info, handler) } func _Shim_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) + in := new(google_protobuf1.Empty) if err := dec(in); err != nil { return nil, err } @@ -553,7 +567,7 @@ func _Shim_Delete_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Delete(ctx, req.(*DeleteRequest)) + return srv.(ShimServer).Delete(ctx, req.(*google_protobuf1.Empty)) } return interceptor(ctx, in, info, handler) } @@ -576,44 +590,26 @@ func _Shim_DeleteProcess_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StateRequest) +func _Shim_ListProcesses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListProcessesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ShimServer).State(ctx, in) + return srv.(ShimServer).ListProcesses(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.runtime.linux.shim.v1.Shim/State", + FullMethod: "/containerd.runtime.linux.shim.v1.Shim/ListProcesses", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).State(ctx, req.(*StateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Shim_Processes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ProcessesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ShimServer).Processes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Processes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Processes(ctx, req.(*ProcessesRequest)) + return srv.(ShimServer).ListProcesses(ctx, req.(*ListProcessesRequest)) } return interceptor(ctx, in, info, handler) } func _Shim_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PauseRequest) + in := new(google_protobuf1.Empty) if err := dec(in); err != nil { return nil, err } @@ -625,13 +621,13 @@ func _Shim_Pause_Handler(srv interface{}, ctx context.Context, dec func(interfac FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Pause", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Pause(ctx, req.(*PauseRequest)) + return srv.(ShimServer).Pause(ctx, req.(*google_protobuf1.Empty)) } return interceptor(ctx, in, info, handler) } func _Shim_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResumeRequest) + in := new(google_protobuf1.Empty) if err := dec(in); err != nil { return nil, err } @@ -643,13 +639,13 @@ func _Shim_Resume_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Resume", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Resume(ctx, req.(*ResumeRequest)) + return srv.(ShimServer).Resume(ctx, req.(*google_protobuf1.Empty)) } return interceptor(ctx, in, info, handler) } func _Shim_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CheckpointRequest) + in := new(CheckpointTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -661,47 +657,29 @@ func _Shim_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(int FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Checkpoint", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Checkpoint(ctx, req.(*CheckpointRequest)) + return srv.(ShimServer).Checkpoint(ctx, req.(*CheckpointTaskRequest)) } return interceptor(ctx, in, info, handler) } -func _Shim_Exit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExitRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ShimServer).Exit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Exit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Exit(ctx, req.(*ExitRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Shim_Events_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(EventsRequest) +func _Shim_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(StreamEventsRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ShimServer).Events(m, &shimEventsServer{stream}) + return srv.(ShimServer).Stream(m, &shimStreamServer{stream}) } -type Shim_EventsServer interface { - Send(*containerd_v1_types.Event) error +type Shim_StreamServer interface { + Send(*Event) error grpc.ServerStream } -type shimEventsServer struct { +type shimStreamServer struct { grpc.ServerStream } -func (x *shimEventsServer) Send(m *containerd_v1_types.Event) error { +func (x *shimStreamServer) Send(m *Event) error { return x.ServerStream.SendMsg(m) } @@ -724,7 +702,7 @@ func _Shim_Kill_Handler(srv interface{}, ctx context.Context, dec func(interface } func _Shim_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExecRequest) + in := new(ExecProcessRequest) if err := dec(in); err != nil { return nil, err } @@ -736,43 +714,61 @@ func _Shim_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Exec", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Exec(ctx, req.(*ExecRequest)) + return srv.(ShimServer).Exec(ctx, req.(*ExecProcessRequest)) } return interceptor(ctx, in, info, handler) } -func _Shim_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PtyRequest) +func _Shim_ResizePty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResizePtyRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ShimServer).Pty(ctx, in) + return srv.(ShimServer).ResizePty(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Pty", + FullMethod: "/containerd.runtime.linux.shim.v1.Shim/ResizePty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Pty(ctx, req.(*PtyRequest)) + return srv.(ShimServer).ResizePty(ctx, req.(*ResizePtyRequest)) } return interceptor(ctx, in, info, handler) } -func _Shim_CloseStdin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStdinRequest) +func _Shim_CloseIO_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseIORequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ShimServer).CloseStdin(ctx, in) + return srv.(ShimServer).CloseIO(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.runtime.linux.shim.v1.Shim/CloseStdin", + FullMethod: "/containerd.runtime.linux.shim.v1.Shim/CloseIO", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).CloseStdin(ctx, req.(*CloseStdinRequest)) + return srv.(ShimServer).CloseIO(ctx, req.(*CloseIORequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Shim_ShimInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).ShimInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.runtime.linux.shim.v1.Shim/ShimInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).ShimInfo(ctx, req.(*google_protobuf1.Empty)) } return interceptor(ctx, in, info, handler) } @@ -781,6 +777,10 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ ServiceName: "containerd.runtime.linux.shim.v1.Shim", HandlerType: (*ShimServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "State", + Handler: _Shim_State_Handler, + }, { MethodName: "Create", Handler: _Shim_Create_Handler, @@ -798,12 +798,8 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ Handler: _Shim_DeleteProcess_Handler, }, { - MethodName: "State", - Handler: _Shim_State_Handler, - }, - { - MethodName: "Processes", - Handler: _Shim_Processes_Handler, + MethodName: "ListProcesses", + Handler: _Shim_ListProcesses_Handler, }, { MethodName: "Pause", @@ -817,10 +813,6 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ MethodName: "Checkpoint", Handler: _Shim_Checkpoint_Handler, }, - { - MethodName: "Exit", - Handler: _Shim_Exit_Handler, - }, { MethodName: "Kill", Handler: _Shim_Kill_Handler, @@ -830,25 +822,29 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ Handler: _Shim_Exec_Handler, }, { - MethodName: "Pty", - Handler: _Shim_Pty_Handler, + MethodName: "ResizePty", + Handler: _Shim_ResizePty_Handler, }, { - MethodName: "CloseStdin", - Handler: _Shim_CloseStdin_Handler, + MethodName: "CloseIO", + Handler: _Shim_CloseIO_Handler, + }, + { + MethodName: "ShimInfo", + Handler: _Shim_ShimInfo_Handler, }, }, Streams: []grpc.StreamDesc{ { - StreamName: "Events", - Handler: _Shim_Events_Handler, + StreamName: "Stream", + Handler: _Shim_Stream_Handler, ServerStreams: true, }, }, - Metadata: "github.com/containerd/containerd/api/services/shim/v1/shim.proto", + Metadata: "github.com/containerd/containerd/linux/shim/v1/shim.proto", } -func (m *CreateRequest) Marshal() (dAtA []byte, err error) { +func (m *CreateTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -858,7 +854,7 @@ func (m *CreateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CreateTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -881,15 +877,17 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintShim(dAtA, i, uint64(len(m.Runtime))) i += copy(dAtA[i:], m.Runtime) } - if m.NoPivot { - dAtA[i] = 0x20 - i++ - if m.NoPivot { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.Rootfs) > 0 { + for _, msg := range m.Rootfs { + dAtA[i] = 0x22 + i++ + i = encodeVarintShim(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n } - i++ } if m.Terminal { dAtA[i] = 0x28 @@ -919,26 +917,14 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintShim(dAtA, i, uint64(len(m.Stderr))) i += copy(dAtA[i:], m.Stderr) } - if len(m.Rootfs) > 0 { - for _, msg := range m.Rootfs { - dAtA[i] = 0x4a - i++ - i = encodeVarintShim(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } if len(m.Checkpoint) > 0 { - dAtA[i] = 0x52 + dAtA[i] = 0x4a i++ i = encodeVarintShim(dAtA, i, uint64(len(m.Checkpoint))) i += copy(dAtA[i:], m.Checkpoint) } if len(m.ParentCheckpoint) > 0 { - dAtA[i] = 0x5a + dAtA[i] = 0x52 i++ i = encodeVarintShim(dAtA, i, uint64(len(m.ParentCheckpoint))) i += copy(dAtA[i:], m.ParentCheckpoint) @@ -946,7 +932,7 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *CreateResponse) Marshal() (dAtA []byte, err error) { +func (m *CreateTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -956,7 +942,7 @@ func (m *CreateResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *CreateTaskResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -969,42 +955,6 @@ func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *StartRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1064,7 +1014,7 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ExecRequest) Marshal() (dAtA []byte, err error) { +func (m *ExecProcessRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1074,7 +1024,7 @@ func (m *ExecRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1120,7 +1070,7 @@ func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *Rlimit) Marshal() (dAtA []byte, err error) { +func (m *ExecProcessResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1130,41 +1080,7 @@ func (m *Rlimit) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Rlimit) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintShim(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) - } - if m.Hard != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintShim(dAtA, i, uint64(m.Hard)) - } - if m.Soft != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintShim(dAtA, i, uint64(m.Soft)) - } - return i, nil -} - -func (m *ExecResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExecResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ExecProcessResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1177,7 +1093,7 @@ func (m *ExecResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *PtyRequest) Marshal() (dAtA []byte, err error) { +func (m *ResizePtyRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1187,7 +1103,7 @@ func (m *PtyRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PtyRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ResizePtyRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1210,42 +1126,6 @@ func (m *PtyRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *EventsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *StateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StateRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - func (m *StateResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1326,60 +1206,6 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *PauseRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PauseRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *ResumeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResumeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *ExitRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExitRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - func (m *KillRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1418,7 +1244,7 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *CloseStdinRequest) Marshal() (dAtA []byte, err error) { +func (m *CloseIORequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1428,7 +1254,7 @@ func (m *CloseStdinRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CloseIORequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1438,10 +1264,20 @@ func (m *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintShim(dAtA, i, uint64(m.Pid)) } + if m.Stdin { + dAtA[i] = 0x10 + i++ + if m.Stdin { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } return i, nil } -func (m *ProcessesRequest) Marshal() (dAtA []byte, err error) { +func (m *ListProcessesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1451,7 +1287,7 @@ func (m *ProcessesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProcessesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ListProcessesRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1465,7 +1301,7 @@ func (m *ProcessesRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ProcessesResponse) Marshal() (dAtA []byte, err error) { +func (m *ListProcessesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1475,7 +1311,7 @@ func (m *ProcessesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ListProcessesResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1495,7 +1331,7 @@ func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *CheckpointRequest) Marshal() (dAtA []byte, err error) { +func (m *CheckpointTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1505,7 +1341,7 @@ func (m *CheckpointRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CheckpointTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1536,6 +1372,94 @@ func (m *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *ShimInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ShimInfoResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ShimPid != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.ShimPid)) + } + return i, nil +} + +func (m *StreamEventsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StreamEventsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *Event) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Event) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintShim(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.Type != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.Type)) + } + if m.Pid != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.Pid)) + } + if m.ExitStatus != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.ExitStatus)) + } + dAtA[i] = 0x2a + i++ + i = encodeVarintShim(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) + n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + return i, nil +} + func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1563,7 +1487,7 @@ func encodeVarintShim(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } -func (m *CreateRequest) Size() (n int) { +func (m *CreateTaskRequest) Size() (n int) { var l int _ = l l = len(m.ID) @@ -1578,8 +1502,11 @@ func (m *CreateRequest) Size() (n int) { if l > 0 { n += 1 + l + sovShim(uint64(l)) } - if m.NoPivot { - n += 2 + if len(m.Rootfs) > 0 { + for _, e := range m.Rootfs { + l = e.Size() + n += 1 + l + sovShim(uint64(l)) + } } if m.Terminal { n += 2 @@ -1596,12 +1523,6 @@ func (m *CreateRequest) Size() (n int) { if l > 0 { n += 1 + l + sovShim(uint64(l)) } - if len(m.Rootfs) > 0 { - for _, e := range m.Rootfs { - l = e.Size() - n += 1 + l + sovShim(uint64(l)) - } - } l = len(m.Checkpoint) if l > 0 { n += 1 + l + sovShim(uint64(l)) @@ -1613,7 +1534,7 @@ func (m *CreateRequest) Size() (n int) { return n } -func (m *CreateResponse) Size() (n int) { +func (m *CreateTaskResponse) Size() (n int) { var l int _ = l if m.Pid != 0 { @@ -1622,18 +1543,6 @@ func (m *CreateResponse) Size() (n int) { return n } -func (m *StartRequest) Size() (n int) { - var l int - _ = l - return n -} - -func (m *DeleteRequest) Size() (n int) { - var l int - _ = l - return n -} - func (m *DeleteResponse) Size() (n int) { var l int _ = l @@ -1657,7 +1566,7 @@ func (m *DeleteProcessRequest) Size() (n int) { return n } -func (m *ExecRequest) Size() (n int) { +func (m *ExecProcessRequest) Size() (n int) { var l int _ = l if m.Terminal { @@ -1682,23 +1591,7 @@ func (m *ExecRequest) Size() (n int) { return n } -func (m *Rlimit) Size() (n int) { - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovShim(uint64(l)) - } - if m.Hard != 0 { - n += 1 + sovShim(uint64(m.Hard)) - } - if m.Soft != 0 { - n += 1 + sovShim(uint64(m.Soft)) - } - return n -} - -func (m *ExecResponse) Size() (n int) { +func (m *ExecProcessResponse) Size() (n int) { var l int _ = l if m.Pid != 0 { @@ -1707,7 +1600,7 @@ func (m *ExecResponse) Size() (n int) { return n } -func (m *PtyRequest) Size() (n int) { +func (m *ResizePtyRequest) Size() (n int) { var l int _ = l if m.Pid != 0 { @@ -1722,18 +1615,6 @@ func (m *PtyRequest) Size() (n int) { return n } -func (m *EventsRequest) Size() (n int) { - var l int - _ = l - return n -} - -func (m *StateRequest) Size() (n int) { - var l int - _ = l - return n -} - func (m *StateResponse) Size() (n int) { var l int _ = l @@ -1775,24 +1656,6 @@ func (m *StateResponse) Size() (n int) { return n } -func (m *PauseRequest) Size() (n int) { - var l int - _ = l - return n -} - -func (m *ResumeRequest) Size() (n int) { - var l int - _ = l - return n -} - -func (m *ExitRequest) Size() (n int) { - var l int - _ = l - return n -} - func (m *KillRequest) Size() (n int) { var l int _ = l @@ -1808,16 +1671,19 @@ func (m *KillRequest) Size() (n int) { return n } -func (m *CloseStdinRequest) Size() (n int) { +func (m *CloseIORequest) Size() (n int) { var l int _ = l if m.Pid != 0 { n += 1 + sovShim(uint64(m.Pid)) } + if m.Stdin { + n += 2 + } return n } -func (m *ProcessesRequest) Size() (n int) { +func (m *ListProcessesRequest) Size() (n int) { var l int _ = l l = len(m.ID) @@ -1827,7 +1693,7 @@ func (m *ProcessesRequest) Size() (n int) { return n } -func (m *ProcessesResponse) Size() (n int) { +func (m *ListProcessesResponse) Size() (n int) { var l int _ = l if len(m.Processes) > 0 { @@ -1839,7 +1705,7 @@ func (m *ProcessesResponse) Size() (n int) { return n } -func (m *CheckpointRequest) Size() (n int) { +func (m *CheckpointTaskRequest) Size() (n int) { var l int _ = l l = len(m.Path) @@ -1857,6 +1723,42 @@ func (m *CheckpointRequest) Size() (n int) { return n } +func (m *ShimInfoResponse) Size() (n int) { + var l int + _ = l + if m.ShimPid != 0 { + n += 1 + sovShim(uint64(m.ShimPid)) + } + return n +} + +func (m *StreamEventsRequest) Size() (n int) { + var l int + _ = l + return n +} + +func (m *Event) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } + if m.Type != 0 { + n += 1 + sovShim(uint64(m.Type)) + } + if m.Pid != 0 { + n += 1 + sovShim(uint64(m.Pid)) + } + if m.ExitStatus != 0 { + n += 1 + sovShim(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovShim(uint64(l)) + return n +} + func sovShim(x uint64) (n int) { for { n++ @@ -1870,54 +1772,35 @@ func sovShim(x uint64) (n int) { func sozShim(x uint64) (n int) { return sovShim(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *CreateRequest) String() string { +func (this *CreateTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CreateRequest{`, + s := strings.Join([]string{`&CreateTaskRequest{`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`, `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, - `NoPivot:` + fmt.Sprintf("%v", this.NoPivot) + `,`, + `Rootfs:` + strings.Replace(fmt.Sprintf("%v", this.Rootfs), "Mount", "containerd_types.Mount", 1) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, - `Rootfs:` + strings.Replace(fmt.Sprintf("%v", this.Rootfs), "Mount", "containerd_types.Mount", 1) + `,`, `Checkpoint:` + fmt.Sprintf("%v", this.Checkpoint) + `,`, `ParentCheckpoint:` + fmt.Sprintf("%v", this.ParentCheckpoint) + `,`, `}`, }, "") return s } -func (this *CreateResponse) String() string { +func (this *CreateTaskResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CreateResponse{`, + s := strings.Join([]string{`&CreateTaskResponse{`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s } -func (this *StartRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&StartRequest{`, - `}`, - }, "") - return s -} -func (this *DeleteRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&DeleteRequest{`, - `}`, - }, "") - return s -} func (this *DeleteResponse) String() string { if this == nil { return "nil" @@ -1940,11 +1823,11 @@ func (this *DeleteProcessRequest) String() string { }, "") return s } -func (this *ExecRequest) String() string { +func (this *ExecProcessRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ExecRequest{`, + s := strings.Join([]string{`&ExecProcessRequest{`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, @@ -1954,33 +1837,21 @@ func (this *ExecRequest) String() string { }, "") return s } -func (this *Rlimit) String() string { +func (this *ExecProcessResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Rlimit{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Hard:` + fmt.Sprintf("%v", this.Hard) + `,`, - `Soft:` + fmt.Sprintf("%v", this.Soft) + `,`, - `}`, - }, "") - return s -} -func (this *ExecResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExecResponse{`, + s := strings.Join([]string{`&ExecProcessResponse{`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s } -func (this *PtyRequest) String() string { +func (this *ResizePtyRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PtyRequest{`, + s := strings.Join([]string{`&ResizePtyRequest{`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Width:` + fmt.Sprintf("%v", this.Width) + `,`, `Height:` + fmt.Sprintf("%v", this.Height) + `,`, @@ -1988,24 +1859,6 @@ func (this *PtyRequest) String() string { }, "") return s } -func (this *EventsRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EventsRequest{`, - `}`, - }, "") - return s -} -func (this *StateRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&StateRequest{`, - `}`, - }, "") - return s -} func (this *StateResponse) String() string { if this == nil { return "nil" @@ -2024,33 +1877,6 @@ func (this *StateResponse) String() string { }, "") return s } -func (this *PauseRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PauseRequest{`, - `}`, - }, "") - return s -} -func (this *ResumeRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ResumeRequest{`, - `}`, - }, "") - return s -} -func (this *ExitRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExitRequest{`, - `}`, - }, "") - return s -} func (this *KillRequest) String() string { if this == nil { return "nil" @@ -2063,37 +1889,38 @@ func (this *KillRequest) String() string { }, "") return s } -func (this *CloseStdinRequest) String() string { +func (this *CloseIORequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CloseStdinRequest{`, + s := strings.Join([]string{`&CloseIORequest{`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `}`, }, "") return s } -func (this *ProcessesRequest) String() string { +func (this *ListProcessesRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ProcessesRequest{`, + s := strings.Join([]string{`&ListProcessesRequest{`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `}`, }, "") return s } -func (this *ProcessesResponse) String() string { +func (this *ListProcessesResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ProcessesResponse{`, + s := strings.Join([]string{`&ListProcessesResponse{`, `Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types.Process", 1) + `,`, `}`, }, "") return s } -func (this *CheckpointRequest) String() string { +func (this *CheckpointTaskRequest) String() string { if this == nil { return "nil" } @@ -2107,13 +1934,46 @@ func (this *CheckpointRequest) String() string { mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k]) } mapStringForOptions += "}" - s := strings.Join([]string{`&CheckpointRequest{`, + s := strings.Join([]string{`&CheckpointTaskRequest{`, `Path:` + fmt.Sprintf("%v", this.Path) + `,`, `Options:` + mapStringForOptions + `,`, `}`, }, "") return s } +func (this *ShimInfoResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ShimInfoResponse{`, + `ShimPid:` + fmt.Sprintf("%v", this.ShimPid) + `,`, + `}`, + }, "") + return s +} +func (this *StreamEventsRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StreamEventsRequest{`, + `}`, + }, "") + return s +} +func (this *Event) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Event{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf3.Timestamp", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} func valueToStringShim(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2122,7 +1982,7 @@ func valueToStringShim(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *CreateRequest) Unmarshal(dAtA []byte) error { +func (m *CreateTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2145,10 +2005,10 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CreateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CreateTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CreateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2239,10 +2099,10 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { m.Runtime = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NoPivot", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rootfs", wireType) } - var v int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowShim @@ -2252,12 +2112,23 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - m.NoPivot = bool(v != 0) + if msglen < 0 { + return ErrInvalidLengthShim + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rootfs = append(m.Rootfs, &containerd_types.Mount{}) + if err := m.Rootfs[len(m.Rootfs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) @@ -2366,37 +2237,6 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { m.Stderr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rootfs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthShim - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Rootfs = append(m.Rootfs, &containerd_types.Mount{}) - if err := m.Rootfs[len(m.Rootfs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", wireType) } @@ -2425,7 +2265,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } m.Checkpoint = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 11: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ParentCheckpoint", wireType) } @@ -2475,7 +2315,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CreateResponse) Unmarshal(dAtA []byte) error { +func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2498,10 +2338,10 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CreateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CreateTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CreateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2544,106 +2384,6 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *StartRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StartRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StartRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *DeleteResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2831,7 +2571,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExecRequest) Unmarshal(dAtA []byte) error { +func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2854,10 +2594,10 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExecRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ExecProcessRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExecRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExecProcessRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3021,7 +2761,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *Rlimit) Unmarshal(dAtA []byte) error { +func (m *ExecProcessResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3044,127 +2784,10 @@ func (m *Rlimit) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Rlimit: wiretype end group for non-group") + return fmt.Errorf("proto: ExecProcessResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Rlimit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthShim - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hard", wireType) - } - m.Hard = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hard |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Soft", wireType) - } - m.Soft = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Soft |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExecResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExecResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExecResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3207,7 +2830,7 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *PtyRequest) Unmarshal(dAtA []byte) error { +func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3230,10 +2853,10 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PtyRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ResizePtyRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PtyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResizePtyRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3314,106 +2937,6 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *StateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3698,156 +3221,6 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *PauseRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PauseRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PauseRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResumeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResumeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResumeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExitRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExitRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExitRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipShim(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthShim - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *KillRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3956,7 +3329,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { +func (m *CloseIORequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3979,10 +3352,10 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CloseStdinRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CloseIORequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CloseStdinRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CloseIORequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4004,6 +3377,26 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { break } } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Stdin = bool(v != 0) default: iNdEx = preIndex skippy, err := skipShim(dAtA[iNdEx:]) @@ -4025,7 +3418,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { +func (m *ListProcessesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4048,10 +3441,10 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProcessesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ListProcessesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProcessesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListProcessesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4104,7 +3497,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { +func (m *ListProcessesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4127,10 +3520,10 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProcessesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ListProcessesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProcessesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListProcessesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4185,7 +3578,7 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { +func (m *CheckpointTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4208,10 +3601,10 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CheckpointRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CheckpointTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CheckpointTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4380,6 +3773,291 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *ShimInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShimInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShimInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ShimPid", wireType) + } + m.ShimPid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ShimPid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipShim(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthShim + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StreamEventsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StreamEventsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StreamEventsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipShim(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthShim + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Event) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Event: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthShim + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= (Event_EventType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthShim + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipShim(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthShim + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipShim(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -4486,80 +4164,84 @@ var ( ) func init() { - proto.RegisterFile("github.com/containerd/containerd/api/services/shim/v1/shim.proto", fileDescriptorShim) + proto.RegisterFile("github.com/containerd/containerd/linux/shim/v1/shim.proto", fileDescriptorShim) } var fileDescriptorShim = []byte{ - // 1129 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x4f, 0xe3, 0x46, - 0x14, 0xc7, 0x49, 0x08, 0xc9, 0x0b, 0xa1, 0x30, 0x42, 0xd4, 0xeb, 0xad, 0x02, 0xb2, 0x54, 0x09, - 0xf5, 0xc3, 0x5e, 0x82, 0xb4, 0xaa, 0xe8, 0x65, 0xf9, 0x3a, 0xac, 0xb6, 0x2b, 0x52, 0xb3, 0x52, - 0xd5, 0xbd, 0x20, 0x93, 0x0c, 0xc9, 0x08, 0xc7, 0xe3, 0x7a, 0xc6, 0x29, 0xb9, 0xf5, 0xd4, 0x73, - 0x7b, 0xec, 0xbd, 0xff, 0x47, 0xaf, 0x1c, 0x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70, 0x80, 0x27, 0x95, 0xb0, 0x7f, 0x36, 0x60, 0x25, 0xe5, 0xe4, 0x59, 0x41, - 0x9b, 0xd0, 0xc0, 0x57, 0x84, 0x9f, 0x31, 0xee, 0xf3, 0x84, 0xc9, 0xda, 0x34, 0x3d, 0x10, 0xac, - 0x53, 0xc9, 0x41, 0xfb, 0x50, 0x17, 0x14, 0xee, 0x9d, 0xf9, 0x5c, 0x56, 0xa8, 0xd1, 0xb6, 0x1c, - 0x05, 0x0b, 0x27, 0x85, 0x85, 0xf3, 0x26, 0x85, 0xc5, 0x41, 0xed, 0xfa, 0xdd, 0xe6, 0xc2, 0x2f, - 0xff, 0x6c, 0x1a, 0x5e, 0x4d, 0xa9, 0xed, 0x73, 0x7b, 0x1b, 0xd6, 0x95, 0x1f, 0x9d, 0x98, 0x76, - 0x31, 0x63, 0x29, 0x54, 0xee, 0xc6, 0xf4, 0x9b, 0x01, 0x8d, 0xe3, 0x2b, 0xdc, 0x4d, 0x25, 0xb2, - 0x75, 0x36, 0xf2, 0xea, 0x5c, 0xba, 0xbf, 0xce, 0xe5, 0x9c, 0x3a, 0x57, 0x66, 0xea, 0xbc, 0x0d, - 0x15, 0x16, 0xe1, 0xae, 0x44, 0x51, 0xa3, 0xbd, 0x7e, 0x27, 0xb2, 0xfd, 0x70, 0xec, 0x49, 0x09, - 0xfb, 0x08, 0xaa, 0x5e, 0x40, 0x86, 0x84, 0x23, 0x04, 0x15, 0x81, 0x00, 0x05, 0x72, 0x4f, 0x9e, - 0x05, 0x6f, 0xe0, 0xc7, 0x3d, 0xe9, 0x4c, 0xc5, 0x93, 0x67, 0xc1, 0x63, 0xf4, 0x42, 0x79, 0x52, - 0xf1, 0xe4, 0xd9, 0xde, 0x82, 0x65, 0x15, 0x60, 0x6e, 0x5d, 0xbf, 0x01, 0xe8, 0xf0, 0x71, 0x6e, - 0x8e, 0x44, 0xdc, 0x3f, 0x92, 0x1e, 0x1f, 0xe8, 0x5a, 0x29, 0x42, 0xc4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b4, 0x33, 0xd1, 0xee, 0x23, 0xfa, 0x38, - 0xd7, 0xf4, 0x6b, 0xa8, 0x88, 0x69, 0x8a, 0xbe, 0x9c, 0x6f, 0x34, 0x33, 0x75, 0x73, 0xcd, 0x7d, - 0x07, 0x55, 0xb5, 0x05, 0x8b, 0x04, 0x3f, 0xb3, 0x2f, 0x2d, 0xeb, 0xde, 0x11, 0x28, 0x65, 0x9e, - 0x19, 0xc2, 0x4f, 0x31, 0xe6, 0x8b, 0xf8, 0x99, 0x59, 0x07, 0xb9, 0x7e, 0x62, 0x11, 0x36, 0xee, - 0x16, 0x0b, 0x7b, 0xf2, 0x99, 0x64, 0x39, 0x45, 0xc5, 0x35, 0xb8, 0x5e, 0x41, 0xb9, 0xc3, 0xc7, - 0xe8, 0x8b, 0x02, 0xd0, 0x9a, 0x7c, 0x89, 0xfc, 0x2f, 0x0a, 0x26, 0xeb, 0xa9, 0x10, 0x0a, 0x6e, - 0x2f, 0xb3, 0x3c, 0xd3, 0x07, 0x6f, 0xae, 0xdf, 0xb7, 0x16, 0xfe, 0x7e, 0xdf, 0x5a, 0xf8, 0xe9, - 0xa6, 0x65, 0x5c, 0xdf, 0xb4, 0x8c, 0x3f, 0x6f, 0x5a, 0xc6, 0xbf, 0x37, 0x2d, 0xe3, 0xed, 0xde, - 0xa3, 0xfe, 0x7d, 0xfb, 0x5a, 0xfc, 0x9e, 0x57, 0xe5, 0x2b, 0xbb, 0xff, 0x05, 0x00, 0x00, 0xff, - 0xff, 0x0b, 0x95, 0x7e, 0x52, 0x03, 0x0e, 0x00, 0x00, + // 1186 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x73, 0xdb, 0xc4, + 0x17, 0x8f, 0xfc, 0x43, 0xb6, 0x5f, 0xbe, 0xce, 0xb8, 0xdb, 0x34, 0x5f, 0xd5, 0x65, 0x9c, 0x8c, + 0x0e, 0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3b, 0x58, 0xc2, 0x8e, 0x19, 0xf4, 0x52, 0xfc, 0x04, + 0xb6, 0xea, 0x1f, 0x29, 0x78, 0x70, 0xe4, 0x11, 0x83, 0x91, 0xb6, 0x41, 0x2f, 0x31, 0xf9, 0xc1, + 0x27, 0x94, 0xa1, 0x0d, 0x48, 0x99, 0x5d, 0x45, 0xda, 0x92, 0xb6, 0x0b, 0x87, 0xf2, 0xed, 0x9b, + 0xcd, 0xd4, 0x71, 0x03, 0xa7, 0xcc, 0x2e, 0xda, 0x00, 0xf9, 0xdc, 0xb7, 0xbb, 0x16, 0x51, 0x52, + 0x7c, 0x0d, 0x87, 0x12, 0x52, 0x20, 0x17, 0x32, 0xa8, 0xa4, 0xc5, 0x42, 0x24, 0xa2, 0x2a, 0xc8, + 0x9e, 0xe3, 0xb0, 0x0b, 0xaa, 0x64, 0xb6, 0xd2, 0xdb, 0xab, 0xb5, 0xff, 0x6b, 0x31, 0xd6, 0x05, + 0x24, 0xed, 0x84, 0x5f, 0x05, 0x87, 0x6a, 0xa8, 0x0c, 0x79, 0x46, 0xbc, 0x81, 0x69, 0x1b, 0x96, + 0x92, 0xdd, 0x92, 0xb6, 0xf3, 0x78, 0x24, 0xa3, 0x75, 0xc8, 0x52, 0xd6, 0x35, 0x6d, 0x45, 0x16, + 0x87, 0x04, 0x02, 0x07, 0x45, 0x59, 0xd7, 0xf1, 0x99, 0x92, 0x0b, 0x40, 0x05, 0x52, 0x38, 0x4f, + 0x3c, 0x4f, 0xc9, 0x8f, 0xe6, 0x89, 0xe7, 0xa1, 0x0a, 0x40, 0xa7, 0x4f, 0x3a, 0x97, 0xae, 0x63, + 0xda, 0x4c, 0x29, 0x88, 0xb5, 0xd8, 0x0c, 0xfa, 0x08, 0x1e, 0xb8, 0x86, 0x47, 0x6c, 0x76, 0x16, + 0x53, 0x03, 0xa1, 0x56, 0x0a, 0x16, 0x8e, 0x46, 0xf3, 0xea, 0x87, 0x80, 0xe2, 0xf4, 0x51, 0xd7, + 0xb1, 0x29, 0x41, 0x25, 0x48, 0xbb, 0x21, 0x81, 0x45, 0xcc, 0x87, 0xea, 0xcf, 0x12, 0xac, 0x35, + 0x88, 0x45, 0x18, 0x49, 0x56, 0x42, 0x9b, 0xb0, 0x4a, 0xae, 0x4d, 0x76, 0x46, 0x99, 0xc1, 0x7c, + 0x2a, 0x38, 0x2e, 0x62, 0xe0, 0x53, 0x2d, 0x31, 0x83, 0xea, 0x50, 0xe0, 0x12, 0xe9, 0x9e, 0x19, + 0x4c, 0x30, 0xbd, 0x5a, 0x2b, 0x6b, 0x41, 0x58, 0x69, 0x51, 0x58, 0x69, 0xed, 0x28, 0xac, 0x0e, + 0xf3, 0x37, 0x6f, 0x36, 0x57, 0x7e, 0xf9, 0x67, 0x53, 0xc2, 0xf9, 0xc0, 0xac, 0xce, 0xd4, 0x6d, + 0x58, 0x0f, 0x70, 0x34, 0x3d, 0xa7, 0x43, 0x28, 0x8d, 0x5c, 0x3e, 0x0b, 0xf9, 0x57, 0x09, 0x90, + 0x7e, 0x4d, 0x3a, 0x53, 0x8a, 0x71, 0x07, 0x49, 0x49, 0x0e, 0x4a, 0xdd, 0xed, 0xa0, 0x74, 0x82, + 0x83, 0x32, 0x13, 0x0e, 0xda, 0x86, 0x0c, 0x75, 0x49, 0x47, 0xb8, 0x7f, 0xb5, 0xb6, 0x3e, 0x73, + 0xc1, 0xba, 0x3d, 0xc4, 0x42, 0x43, 0x7d, 0x0a, 0x0f, 0x27, 0x10, 0x26, 0xd2, 0x8f, 0xa1, 0x84, + 0x09, 0x35, 0x7f, 0x22, 0x4d, 0x36, 0x4c, 0xbc, 0x31, 0x87, 0xff, 0xa3, 0xd9, 0x65, 0xfd, 0x90, + 0xf9, 0x40, 0xe0, 0x30, 0xfb, 0xc4, 0xec, 0xf5, 0x03, 0xf8, 0x45, 0x1c, 0x4a, 0xea, 0x6f, 0x29, + 0x28, 0x72, 0xbf, 0x8c, 0x3d, 0xba, 0x6c, 0xda, 0x84, 0x08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 0xd8, 0xe1, 0xc9, + 0xcd, 0xbb, 0xca, 0xca, 0xdf, 0xef, 0x2a, 0x2b, 0xaf, 0x6f, 0x2b, 0xd2, 0xcd, 0x6d, 0x45, 0xfa, + 0xeb, 0xb6, 0x22, 0xbd, 0xbd, 0xad, 0x48, 0xdf, 0xec, 0x2e, 0xf7, 0x57, 0xf3, 0x53, 0xfe, 0x3d, + 0x97, 0x05, 0xa4, 0xdd, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x26, 0xd4, 0xa9, 0x94, 0xa8, 0x0e, + 0x00, 0x00, } diff --git a/api/services/shim/v1/shim.proto b/linux/shim/v1/shim.proto similarity index 50% rename from api/services/shim/v1/shim.proto rename to linux/shim/v1/shim.proto index fcc34a496..0ff594b31 100644 --- a/api/services/shim/v1/shim.proto +++ b/linux/shim/v1/shim.proto @@ -5,59 +5,67 @@ package containerd.runtime.linux.shim.v1; import "google/protobuf/any.proto"; import "google/protobuf/empty.proto"; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; import "github.com/containerd/containerd/api/types/mount.proto"; import "github.com/containerd/containerd/api/types/task/task.proto"; -import "google/protobuf/timestamp.proto"; -option go_package = "github.com/containerd/containerd/api/services/shim/v1;shim"; +option go_package = "github.com/containerd/containerd/linux/shim/v1;shim"; // Shim service is launched for each container and is responsible for owning the IO // for the container and its additional processes. The shim is also the parent of // each container and allows reattaching to the IO and receiving the exit status // for the container processes. service Shim { - rpc Create(CreateRequest) returns (CreateResponse); - rpc Start(StartRequest) returns (google.protobuf.Empty); - rpc Delete(DeleteRequest) returns (DeleteResponse); - rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse); - rpc State(StateRequest) returns (StateResponse); - rpc Processes(ProcessesRequest) returns (ProcessesResponse); - rpc Pause(PauseRequest) returns (google.protobuf.Empty); - rpc Resume(ResumeRequest) returns (google.protobuf.Empty); - rpc Checkpoint(CheckpointRequest) returns (google.protobuf.Empty); + // State returns shim and task state information. + rpc State(google.protobuf.Empty) returns (StateResponse); + + rpc Create(CreateTaskRequest) returns (CreateTaskResponse); + + rpc Start(google.protobuf.Empty) returns (google.protobuf.Empty); + + rpc Delete(google.protobuf.Empty) returns (DeleteResponse); + + rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse); + + rpc ListProcesses(ListProcessesRequest) returns (ListProcessesResponse); + + rpc Pause(google.protobuf.Empty) returns (google.protobuf.Empty); + + rpc Resume(google.protobuf.Empty) returns (google.protobuf.Empty); + + rpc Checkpoint(CheckpointTaskRequest) returns (google.protobuf.Empty); + + rpc Stream(StreamEventsRequest) returns (stream Event); - rpc Exit(ExitRequest) returns (google.protobuf.Empty); - rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); rpc Kill(KillRequest) returns (google.protobuf.Empty); - rpc Exec(ExecRequest) returns (ExecResponse); - rpc Pty(PtyRequest) returns (google.protobuf.Empty); - rpc CloseStdin(CloseStdinRequest) returns (google.protobuf.Empty); + + rpc Exec(ExecProcessRequest) returns (ExecProcessResponse); + + rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty); + + rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty); + + // ShimInfo returns information about the shim. + rpc ShimInfo(google.protobuf.Empty) returns (ShimInfoResponse); } -message CreateRequest { +message CreateTaskRequest { string id = 1; string bundle = 2; string runtime = 3; - bool no_pivot = 4; + repeated containerd.types.Mount rootfs = 4; bool terminal = 5; string stdin = 6; string stdout = 7; string stderr = 8; - repeated containerd.types.Mount rootfs = 9; - string checkpoint = 10; - string parent_checkpoint = 11; + string checkpoint = 9; + string parent_checkpoint = 10; } -message CreateResponse { +message CreateTaskResponse { uint32 pid = 1; } -message StartRequest { -} - -message DeleteRequest { -} - message DeleteResponse { uint32 pid = 1; uint32 exit_status = 2; @@ -68,7 +76,7 @@ message DeleteProcessRequest { uint32 pid = 1; } -message ExecRequest { +message ExecProcessRequest { bool terminal = 1; string stdin = 2; string stdout = 3; @@ -76,28 +84,16 @@ message ExecRequest { google.protobuf.Any spec = 5; } -message Rlimit { - string type = 1; - uint64 hard = 2; - uint64 soft = 3; -} - -message ExecResponse { +message ExecProcessResponse { uint32 pid = 1; } -message PtyRequest { +message ResizePtyRequest { uint32 pid = 1; uint32 width = 2; uint32 height = 3; } -message EventsRequest { -} - -message StateRequest { -} - message StateResponse { string id = 1; string bundle = 2; @@ -110,34 +106,51 @@ message StateResponse { bool terminal = 9; } -message PauseRequest { -} - -message ResumeRequest { -} - -message ExitRequest { -} - message KillRequest { uint32 signal = 1; bool all = 2; uint32 pid = 3; } -message CloseStdinRequest { +message CloseIORequest { uint32 pid = 1; + bool stdin = 2; } -message ProcessesRequest { +message ListProcessesRequest { string id = 1; } -message ProcessesResponse{ +message ListProcessesResponse{ repeated containerd.v1.types.Process processes = 1; } -message CheckpointRequest { +message CheckpointTaskRequest { string path = 1; map options = 2; } + +message ShimInfoResponse { + uint32 shim_pid = 1; +} + +message StreamEventsRequest { +} + +message Event { + string id = 1; + + enum EventType { + EXIT = 0; + OOM = 1; + CREATE = 2; + START = 3; + EXEC_ADDED = 4; + PAUSED = 5; + } + + EventType type = 2; + uint32 pid = 3; + uint32 exit_status = 4; + google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} diff --git a/linux/task.go b/linux/task.go index a14816f4e..31bea16da 100644 --- a/linux/task.go +++ b/linux/task.go @@ -7,8 +7,9 @@ import ( "google.golang.org/grpc" - "github.com/containerd/containerd/api/services/shim/v1" "github.com/containerd/containerd/api/types/task" + client "github.com/containerd/containerd/linux/shim" + shim "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/containerd/plugin" protobuf "github.com/gogo/protobuf/types" specs "github.com/opencontainers/runtime-spec/specs-go" @@ -18,11 +19,11 @@ import ( type Task struct { containerID string spec []byte - shim shim.ShimClient + shim *client.Client namespace string } -func newTask(id, namespace string, spec []byte, shim shim.ShimClient) *Task { +func newTask(id, namespace string, spec []byte, shim *client.Client) *Task { return &Task{ containerID: id, shim: shim, @@ -42,7 +43,7 @@ func (t *Task) Info() plugin.TaskInfo { } func (t *Task) Start(ctx context.Context) error { - _, err := t.shim.Start(ctx, &shim.StartRequest{}) + _, err := t.shim.Start(ctx, empty) if err != nil { err = errors.New(grpc.ErrorDesc(err)) } @@ -50,7 +51,7 @@ func (t *Task) Start(ctx context.Context) error { } func (t *Task) State(ctx context.Context) (plugin.State, error) { - response, err := t.shim.State(ctx, &shim.StateRequest{}) + response, err := t.shim.State(ctx, empty) if err != nil { return plugin.State{}, errors.New(grpc.ErrorDesc(err)) } @@ -77,7 +78,7 @@ func (t *Task) State(ctx context.Context) (plugin.State, error) { } func (t *Task) Pause(ctx context.Context) error { - _, err := t.shim.Pause(ctx, &shim.PauseRequest{}) + _, err := t.shim.Pause(ctx, empty) if err != nil { err = errors.New(grpc.ErrorDesc(err)) } @@ -85,7 +86,7 @@ func (t *Task) Pause(ctx context.Context) error { } func (t *Task) Resume(ctx context.Context) error { - _, err := t.shim.Resume(ctx, &shim.ResumeRequest{}) + _, err := t.shim.Resume(ctx, empty) if err != nil { err = errors.New(grpc.ErrorDesc(err)) } @@ -105,7 +106,7 @@ func (t *Task) Kill(ctx context.Context, signal uint32, pid uint32, all bool) er } func (t *Task) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Process, error) { - request := &shim.ExecRequest{ + request := &shim.ExecProcessRequest{ Stdin: opts.IO.Stdin, Stdout: opts.IO.Stdout, Stderr: opts.IO.Stderr, @@ -127,7 +128,7 @@ func (t *Task) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Process, } func (t *Task) Processes(ctx context.Context) ([]uint32, error) { - resp, err := t.shim.Processes(ctx, &shim.ProcessesRequest{ + resp, err := t.shim.ListProcesses(ctx, &shim.ListProcessesRequest{ ID: t.containerID, }) if err != nil { @@ -143,8 +144,8 @@ func (t *Task) Processes(ctx context.Context) ([]uint32, error) { return pids, nil } -func (t *Task) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { - _, err := t.shim.Pty(ctx, &shim.PtyRequest{ +func (t *Task) ResizePty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { + _, err := t.shim.ResizePty(ctx, &shim.ResizePtyRequest{ Pid: pid, Width: size.Width, Height: size.Height, @@ -155,9 +156,10 @@ func (t *Task) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) err return err } -func (t *Task) CloseStdin(ctx context.Context, pid uint32) error { - _, err := t.shim.CloseStdin(ctx, &shim.CloseStdinRequest{ - Pid: pid, +func (t *Task) CloseIO(ctx context.Context, pid uint32) error { + _, err := t.shim.CloseIO(ctx, &shim.CloseIORequest{ + Pid: pid, + Stdin: true, }) if err != nil { err = errors.New(grpc.ErrorDesc(err)) @@ -166,7 +168,7 @@ func (t *Task) CloseStdin(ctx context.Context, pid uint32) error { } func (t *Task) Checkpoint(ctx context.Context, path string, options map[string]string) error { - r := &shim.CheckpointRequest{ + r := &shim.CheckpointTaskRequest{ Path: path, Options: options, } diff --git a/plugin/task.go b/plugin/task.go index 33e57ac85..bedf0584a 100644 --- a/plugin/task.go +++ b/plugin/task.go @@ -28,9 +28,9 @@ type Task interface { // Processes returns all pids for the container Processes(context.Context) ([]uint32, error) // Pty resizes the processes pty/console - Pty(context.Context, uint32, ConsoleSize) error + ResizePty(context.Context, uint32, ConsoleSize) error // CloseStdin closes the processes stdin - CloseStdin(context.Context, uint32) error + CloseIO(context.Context, uint32) error // Checkpoint checkpoints a container to an image with live system data Checkpoint(context.Context, string, map[string]string) error // DeleteProcess deletes a specific exec process via the pid diff --git a/process.go b/process.go index 3784fbe08..3b9436d6f 100644 --- a/process.go +++ b/process.go @@ -7,7 +7,6 @@ import ( eventsapi "github.com/containerd/containerd/api/services/events/v1" "github.com/containerd/containerd/api/services/tasks/v1" - tasktypes "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/events" protobuf "github.com/gogo/protobuf/types" specs "github.com/opencontainers/runtime-spec/specs-go" @@ -92,7 +91,7 @@ evloop: return UnknownExitStatus, err } - if e.Type != tasktypes.Event_EXIT { + if e.Type != eventsapi.RuntimeEvent_EXIT { continue evloop } diff --git a/services/tasks/service.go b/services/tasks/service.go index 4f9b73f30..a15029a25 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -392,7 +392,7 @@ func (s *Service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*goog if err != nil { return nil, err } - if err := t.Pty(ctx, r.Pid, plugin.ConsoleSize{ + if err := t.ResizePty(ctx, r.Pid, plugin.ConsoleSize{ Width: r.Width, Height: r.Height, }); err != nil { @@ -407,7 +407,7 @@ func (s *Service) CloseIO(ctx context.Context, r *api.CloseIORequest) (*google_p return nil, err } if r.Stdin { - if err := t.CloseStdin(ctx, r.Pid); err != nil { + if err := t.CloseIO(ctx, r.Pid); err != nil { return nil, err } } diff --git a/task.go b/task.go index d00e63d4a..edb41878b 100644 --- a/task.go +++ b/task.go @@ -13,7 +13,6 @@ import ( "github.com/containerd/containerd/api/services/containers/v1" eventsapi "github.com/containerd/containerd/api/services/events/v1" "github.com/containerd/containerd/api/services/tasks/v1" - tasktypes "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/content" "github.com/containerd/containerd/events" "github.com/containerd/containerd/plugin" @@ -172,7 +171,7 @@ func (t *task) Wait(ctx context.Context) (uint32, error) { return UnknownExitStatus, err } - if e.Type != tasktypes.Event_EXIT { + if e.Type != eventsapi.RuntimeEvent_EXIT { continue } diff --git a/windows/container.go b/windows/container.go index b4ae348a4..7102fb7c7 100644 --- a/windows/container.go +++ b/windows/container.go @@ -17,9 +17,7 @@ import ( winsys "golang.org/x/sys/windows" ) -var ( - ErrLoadedContainer = errors.New("loaded container can only be terminated") -) +var ErrLoadedContainer = errors.New("loaded container can only be terminated") type eventCallback func(id string, evType plugin.EventType, pid, exitStatus uint32, exitedAt time.Time) @@ -160,12 +158,12 @@ func (c *container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Proc return &process{p}, nil } -func (c *container) CloseStdin(ctx context.Context, pid uint32) error { - return c.ctr.CloseStdin(ctx, pid) +func (c *container) CloseIO(ctx context.Context, pid uint32) error { + return c.ctr.CloseIO(ctx, pid) } -func (c *container) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { - return c.ctr.Pty(ctx, pid, size) +func (c *container) ResizePty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { + return c.ctr.ResizePty(ctx, pid, size) } func (c *container) Status() plugin.Status { diff --git a/windows/hcs/hcs.go b/windows/hcs/hcs.go index 0b5473ecd..41fa3caef 100644 --- a/windows/hcs/hcs.go +++ b/windows/hcs/hcs.go @@ -199,7 +199,7 @@ func (c *Container) Stop(ctx context.Context) error { return nil } -func (c *Container) CloseStdin(ctx context.Context, pid uint32) error { +func (c *Container) CloseIO(ctx context.Context, pid uint32) error { var proc *Process c.Lock() for _, p := range c.processes { @@ -216,7 +216,7 @@ func (c *Container) CloseStdin(ctx context.Context, pid uint32) error { return proc.CloseStdin() } -func (c *Container) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { +func (c *Container) ResizePty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { var proc *Process c.Lock() for _, p := range c.processes {