Implement Exec + Start for tasks service

This splits up the exec creation and start in the tasks service

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-07-31 14:02:52 -04:00
parent 63878d14ea
commit a2a3451925
9 changed files with 350 additions and 194 deletions

View File

@ -11,7 +11,8 @@
It has these top-level messages: It has these top-level messages:
CreateTaskRequest CreateTaskRequest
CreateTaskResponse CreateTaskResponse
StartTaskRequest StartRequest
StartResponse
DeleteTaskRequest DeleteTaskRequest
DeleteResponse DeleteResponse
DeleteProcessRequest DeleteProcessRequest
@ -102,13 +103,22 @@ func (m *CreateTaskResponse) Reset() { *m = CreateTaskRespons
func (*CreateTaskResponse) ProtoMessage() {} func (*CreateTaskResponse) ProtoMessage() {}
func (*CreateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{1} } func (*CreateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{1} }
type StartTaskRequest struct { type StartRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
ExecID string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
} }
func (m *StartTaskRequest) Reset() { *m = StartTaskRequest{} } func (m *StartRequest) Reset() { *m = StartRequest{} }
func (*StartTaskRequest) ProtoMessage() {} func (*StartRequest) ProtoMessage() {}
func (*StartTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{2} } func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{2} }
type StartResponse struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
}
func (m *StartResponse) Reset() { *m = StartResponse{} }
func (*StartResponse) ProtoMessage() {}
func (*StartResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} }
type DeleteTaskRequest struct { type DeleteTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -116,7 +126,7 @@ type DeleteTaskRequest struct {
func (m *DeleteTaskRequest) Reset() { *m = DeleteTaskRequest{} } func (m *DeleteTaskRequest) Reset() { *m = DeleteTaskRequest{} }
func (*DeleteTaskRequest) ProtoMessage() {} func (*DeleteTaskRequest) ProtoMessage() {}
func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} } func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{4} }
type DeleteResponse struct { type DeleteResponse struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@ -127,7 +137,7 @@ type DeleteResponse struct {
func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{4} } func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{5} }
type DeleteProcessRequest struct { type DeleteProcessRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -136,7 +146,7 @@ type DeleteProcessRequest struct {
func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} }
func (*DeleteProcessRequest) ProtoMessage() {} func (*DeleteProcessRequest) ProtoMessage() {}
func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{5} } func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{6} }
type GetTaskRequest struct { type GetTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -144,7 +154,7 @@ type GetTaskRequest struct {
func (m *GetTaskRequest) Reset() { *m = GetTaskRequest{} } func (m *GetTaskRequest) Reset() { *m = GetTaskRequest{} }
func (*GetTaskRequest) ProtoMessage() {} func (*GetTaskRequest) ProtoMessage() {}
func (*GetTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{6} } func (*GetTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} }
type GetTaskResponse struct { type GetTaskResponse struct {
Task *containerd_v1_types.Task `protobuf:"bytes,1,opt,name=task" json:"task,omitempty"` Task *containerd_v1_types.Task `protobuf:"bytes,1,opt,name=task" json:"task,omitempty"`
@ -152,7 +162,7 @@ type GetTaskResponse struct {
func (m *GetTaskResponse) Reset() { *m = GetTaskResponse{} } func (m *GetTaskResponse) Reset() { *m = GetTaskResponse{} }
func (*GetTaskResponse) ProtoMessage() {} func (*GetTaskResponse) ProtoMessage() {}
func (*GetTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} } func (*GetTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} }
type ListTasksRequest struct { type ListTasksRequest struct {
Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
@ -160,7 +170,7 @@ type ListTasksRequest struct {
func (m *ListTasksRequest) Reset() { *m = ListTasksRequest{} } func (m *ListTasksRequest) Reset() { *m = ListTasksRequest{} }
func (*ListTasksRequest) ProtoMessage() {} func (*ListTasksRequest) ProtoMessage() {}
func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} } func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{9} }
type ListTasksResponse struct { type ListTasksResponse struct {
Tasks []*containerd_v1_types.Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` Tasks []*containerd_v1_types.Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"`
@ -168,7 +178,7 @@ type ListTasksResponse struct {
func (m *ListTasksResponse) Reset() { *m = ListTasksResponse{} } func (m *ListTasksResponse) Reset() { *m = ListTasksResponse{} }
func (*ListTasksResponse) ProtoMessage() {} func (*ListTasksResponse) ProtoMessage() {}
func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{9} } func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} }
type KillRequest struct { type KillRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -179,7 +189,7 @@ type KillRequest struct {
func (m *KillRequest) Reset() { *m = KillRequest{} } func (m *KillRequest) Reset() { *m = KillRequest{} }
func (*KillRequest) ProtoMessage() {} func (*KillRequest) ProtoMessage() {}
func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} } func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{11} }
type ExecProcessRequest struct { type ExecProcessRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -197,15 +207,14 @@ type ExecProcessRequest struct {
func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} } func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} }
func (*ExecProcessRequest) ProtoMessage() {} func (*ExecProcessRequest) ProtoMessage() {}
func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{11} } func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{12} }
type ExecProcessResponse struct { type ExecProcessResponse struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
} }
func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} } func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} }
func (*ExecProcessResponse) ProtoMessage() {} func (*ExecProcessResponse) ProtoMessage() {}
func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{12} } func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{13} }
type ResizePtyRequest struct { type ResizePtyRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -216,7 +225,7 @@ type ResizePtyRequest struct {
func (m *ResizePtyRequest) Reset() { *m = ResizePtyRequest{} } func (m *ResizePtyRequest) Reset() { *m = ResizePtyRequest{} }
func (*ResizePtyRequest) ProtoMessage() {} func (*ResizePtyRequest) ProtoMessage() {}
func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{13} } func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{14} }
type CloseIORequest struct { type CloseIORequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -226,7 +235,7 @@ type CloseIORequest struct {
func (m *CloseIORequest) Reset() { *m = CloseIORequest{} } func (m *CloseIORequest) Reset() { *m = CloseIORequest{} }
func (*CloseIORequest) ProtoMessage() {} func (*CloseIORequest) ProtoMessage() {}
func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{14} } func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{15} }
type PauseTaskRequest struct { type PauseTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -234,7 +243,7 @@ type PauseTaskRequest struct {
func (m *PauseTaskRequest) Reset() { *m = PauseTaskRequest{} } func (m *PauseTaskRequest) Reset() { *m = PauseTaskRequest{} }
func (*PauseTaskRequest) ProtoMessage() {} func (*PauseTaskRequest) ProtoMessage() {}
func (*PauseTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{15} } func (*PauseTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{16} }
type ResumeTaskRequest struct { type ResumeTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -242,7 +251,7 @@ type ResumeTaskRequest struct {
func (m *ResumeTaskRequest) Reset() { *m = ResumeTaskRequest{} } func (m *ResumeTaskRequest) Reset() { *m = ResumeTaskRequest{} }
func (*ResumeTaskRequest) ProtoMessage() {} func (*ResumeTaskRequest) ProtoMessage() {}
func (*ResumeTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{16} } func (*ResumeTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{17} }
type ListPidsRequest struct { type ListPidsRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -250,7 +259,7 @@ type ListPidsRequest struct {
func (m *ListPidsRequest) Reset() { *m = ListPidsRequest{} } func (m *ListPidsRequest) Reset() { *m = ListPidsRequest{} }
func (*ListPidsRequest) ProtoMessage() {} func (*ListPidsRequest) ProtoMessage() {}
func (*ListPidsRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{17} } func (*ListPidsRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{18} }
type ListPidsResponse struct { type ListPidsResponse struct {
Pids []uint32 `protobuf:"varint,1,rep,packed,name=pids" json:"pids,omitempty"` Pids []uint32 `protobuf:"varint,1,rep,packed,name=pids" json:"pids,omitempty"`
@ -258,7 +267,7 @@ type ListPidsResponse struct {
func (m *ListPidsResponse) Reset() { *m = ListPidsResponse{} } func (m *ListPidsResponse) Reset() { *m = ListPidsResponse{} }
func (*ListPidsResponse) ProtoMessage() {} func (*ListPidsResponse) ProtoMessage() {}
func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{18} } func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{19} }
type CheckpointTaskRequest struct { type CheckpointTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -268,7 +277,7 @@ type CheckpointTaskRequest struct {
func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} }
func (*CheckpointTaskRequest) ProtoMessage() {} func (*CheckpointTaskRequest) ProtoMessage() {}
func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{19} } func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} }
type CheckpointTaskResponse struct { type CheckpointTaskResponse struct {
Descriptors []*containerd_types1.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` Descriptors []*containerd_types1.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"`
@ -276,7 +285,7 @@ type CheckpointTaskResponse struct {
func (m *CheckpointTaskResponse) Reset() { *m = CheckpointTaskResponse{} } func (m *CheckpointTaskResponse) Reset() { *m = CheckpointTaskResponse{} }
func (*CheckpointTaskResponse) ProtoMessage() {} func (*CheckpointTaskResponse) ProtoMessage() {}
func (*CheckpointTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} } func (*CheckpointTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{21} }
type UpdateTaskRequest struct { type UpdateTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -285,12 +294,13 @@ type UpdateTaskRequest struct {
func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} } func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} }
func (*UpdateTaskRequest) ProtoMessage() {} func (*UpdateTaskRequest) ProtoMessage() {}
func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{21} } func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{22} }
func init() { func init() {
proto.RegisterType((*CreateTaskRequest)(nil), "containerd.services.tasks.v1.CreateTaskRequest") proto.RegisterType((*CreateTaskRequest)(nil), "containerd.services.tasks.v1.CreateTaskRequest")
proto.RegisterType((*CreateTaskResponse)(nil), "containerd.services.tasks.v1.CreateTaskResponse") proto.RegisterType((*CreateTaskResponse)(nil), "containerd.services.tasks.v1.CreateTaskResponse")
proto.RegisterType((*StartTaskRequest)(nil), "containerd.services.tasks.v1.StartTaskRequest") proto.RegisterType((*StartRequest)(nil), "containerd.services.tasks.v1.StartRequest")
proto.RegisterType((*StartResponse)(nil), "containerd.services.tasks.v1.StartResponse")
proto.RegisterType((*DeleteTaskRequest)(nil), "containerd.services.tasks.v1.DeleteTaskRequest") proto.RegisterType((*DeleteTaskRequest)(nil), "containerd.services.tasks.v1.DeleteTaskRequest")
proto.RegisterType((*DeleteResponse)(nil), "containerd.services.tasks.v1.DeleteResponse") proto.RegisterType((*DeleteResponse)(nil), "containerd.services.tasks.v1.DeleteResponse")
proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.services.tasks.v1.DeleteProcessRequest") proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.services.tasks.v1.DeleteProcessRequest")
@ -325,8 +335,8 @@ const _ = grpc.SupportPackageIsVersion4
type TasksClient interface { type TasksClient interface {
// Create a task. // Create a task.
Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error)
// Start a task. // Start a process.
Start(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
// Delete a task and on disk state. // Delete a task and on disk state.
Delete(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*DeleteResponse, error) Delete(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
@ -334,7 +344,7 @@ type TasksClient interface {
List(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) List(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error)
// Kill a task or process. // Kill a task or process.
Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
Pause(ctx context.Context, in *PauseTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Pause(ctx context.Context, in *PauseTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
@ -361,8 +371,8 @@ func (c *tasksClient) Create(ctx context.Context, in *CreateTaskRequest, opts ..
return out, nil return out, nil
} }
func (c *tasksClient) Start(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { func (c *tasksClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) {
out := new(google_protobuf.Empty) out := new(StartResponse)
err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Start", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Start", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -415,8 +425,8 @@ func (c *tasksClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.Ca
return out, nil return out, nil
} }
func (c *tasksClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) { func (c *tasksClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
out := new(ExecProcessResponse) out := new(google_protobuf.Empty)
err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Exec", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Exec", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -492,8 +502,8 @@ func (c *tasksClient) Update(ctx context.Context, in *UpdateTaskRequest, opts ..
type TasksServer interface { type TasksServer interface {
// Create a task. // Create a task.
Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error)
// Start a task. // Start a process.
Start(context.Context, *StartTaskRequest) (*google_protobuf.Empty, error) Start(context.Context, *StartRequest) (*StartResponse, error)
// Delete a task and on disk state. // Delete a task and on disk state.
Delete(context.Context, *DeleteTaskRequest) (*DeleteResponse, error) Delete(context.Context, *DeleteTaskRequest) (*DeleteResponse, error)
DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error)
@ -501,7 +511,7 @@ type TasksServer interface {
List(context.Context, *ListTasksRequest) (*ListTasksResponse, error) List(context.Context, *ListTasksRequest) (*ListTasksResponse, error)
// Kill a task or process. // Kill a task or process.
Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error)
Exec(context.Context, *ExecProcessRequest) (*ExecProcessResponse, error) Exec(context.Context, *ExecProcessRequest) (*google_protobuf.Empty, error)
ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf.Empty, error) ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf.Empty, error)
CloseIO(context.Context, *CloseIORequest) (*google_protobuf.Empty, error) CloseIO(context.Context, *CloseIORequest) (*google_protobuf.Empty, error)
Pause(context.Context, *PauseTaskRequest) (*google_protobuf.Empty, error) Pause(context.Context, *PauseTaskRequest) (*google_protobuf.Empty, error)
@ -534,7 +544,7 @@ func _Tasks_Create_Handler(srv interface{}, ctx context.Context, dec func(interf
} }
func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartTaskRequest) in := new(StartRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -546,7 +556,7 @@ func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interfa
FullMethod: "/containerd.services.tasks.v1.Tasks/Start", FullMethod: "/containerd.services.tasks.v1.Tasks/Start",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TasksServer).Start(ctx, req.(*StartTaskRequest)) return srv.(TasksServer).Start(ctx, req.(*StartRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -967,7 +977,7 @@ func (m *CreateTaskResponse) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func (m *StartTaskRequest) Marshal() (dAtA []byte, err error) { func (m *StartRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalTo(dAtA)
@ -977,7 +987,7 @@ func (m *StartTaskRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *StartTaskRequest) MarshalTo(dAtA []byte) (int, error) { func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) {
var i int var i int
_ = i _ = i
var l int var l int
@ -988,6 +998,35 @@ func (m *StartTaskRequest) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID) i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.ExecID) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintTasks(dAtA, i, uint64(len(m.ExecID)))
i += copy(dAtA[i:], m.ExecID)
}
return i, nil
}
func (m *StartResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *StartResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Pid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintTasks(dAtA, i, uint64(m.Pid))
}
return i, nil return i, nil
} }
@ -1321,11 +1360,6 @@ func (m *ExecProcessResponse) MarshalTo(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Pid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintTasks(dAtA, i, uint64(m.Pid))
}
return i, nil return i, nil
} }
@ -1699,13 +1733,26 @@ func (m *CreateTaskResponse) Size() (n int) {
return n return n
} }
func (m *StartTaskRequest) Size() (n int) { func (m *StartRequest) Size() (n int) {
var l int var l int
_ = l _ = l
l = len(m.ContainerID) l = len(m.ContainerID)
if l > 0 { if l > 0 {
n += 1 + l + sovTasks(uint64(l)) n += 1 + l + sovTasks(uint64(l))
} }
l = len(m.ExecID)
if l > 0 {
n += 1 + l + sovTasks(uint64(l))
}
return n
}
func (m *StartResponse) Size() (n int) {
var l int
_ = l
if m.Pid != 0 {
n += 1 + sovTasks(uint64(m.Pid))
}
return n return n
} }
@ -1849,9 +1896,6 @@ func (m *ExecProcessRequest) Size() (n int) {
func (m *ExecProcessResponse) Size() (n int) { func (m *ExecProcessResponse) Size() (n int) {
var l int var l int
_ = l _ = l
if m.Pid != 0 {
n += 1 + sovTasks(uint64(m.Pid))
}
return n return n
} }
@ -2020,12 +2064,23 @@ func (this *CreateTaskResponse) String() string {
}, "") }, "")
return s return s
} }
func (this *StartTaskRequest) String() string { func (this *StartRequest) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := strings.Join([]string{`&StartTaskRequest{`, s := strings.Join([]string{`&StartRequest{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
`}`,
}, "")
return s
}
func (this *StartResponse) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&StartResponse{`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -2138,7 +2193,6 @@ func (this *ExecProcessResponse) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&ExecProcessResponse{`, s := strings.Join([]string{`&ExecProcessResponse{`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -2630,7 +2684,7 @@ func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *StartTaskRequest) Unmarshal(dAtA []byte) error { func (m *StartRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -2653,10 +2707,10 @@ func (m *StartTaskRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: StartTaskRequest: wiretype end group for non-group") return fmt.Errorf("proto: StartRequest: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: StartTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: StartRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -2688,6 +2742,104 @@ func (m *StartTaskRequest) Unmarshal(dAtA []byte) error {
} }
m.ContainerID = string(dAtA[iNdEx:postIndex]) m.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExecID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTasks
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTasks
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ExecID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTasks(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTasks
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *StartResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTasks
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StartResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StartResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
}
m.Pid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTasks
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTasks(dAtA[iNdEx:]) skippy, err := skipTasks(dAtA[iNdEx:])
@ -3789,25 +3941,6 @@ func (m *ExecProcessResponse) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
}
m.Pid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTasks
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTasks(dAtA[iNdEx:]) skippy, err := skipTasks(dAtA[iNdEx:])
@ -4896,80 +5029,81 @@ func init() {
} }
var fileDescriptorTasks = []byte{ var fileDescriptorTasks = []byte{
// 1200 bytes of a gzipped FileDescriptorProto // 1211 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4d, 0x6f, 0x1b, 0xc5, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5d, 0x6f, 0x1b, 0x45,
0x1b, 0xef, 0xfa, 0x65, 0x63, 0x3f, 0xfe, 0xa7, 0x49, 0xf6, 0x1f, 0x82, 0xbb, 0x54, 0x76, 0xb4, 0x17, 0xee, 0xfa, 0x63, 0x63, 0x1f, 0x37, 0x6d, 0x3c, 0x6f, 0x9a, 0xd7, 0x5d, 0x2a, 0x3b, 0x2c,
0x48, 0x60, 0x2a, 0xb2, 0x4b, 0x5c, 0xc4, 0x81, 0x56, 0x88, 0x24, 0x0e, 0x91, 0x05,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 0x2a, 0x50, 0x7c, 0x51, 0xc9, 0x32, 0x3e, 0xba, 0x1c, 0x48, 0x6d, 0xfc, 0x04, 0x74, 0xa9, 0xe4, 0xd3,
0xdd, 0xf9, 0xfd, 0x55, 0xe9, 0xce, 0x4f, 0xbd, 0x92, 0x76, 0xde, 0x2b, 0x69, 0xbf, 0xf5, 0x4a, 0x68, 0x1b, 0xd1, 0xfb, 0x71, 0xb4, 0xad, 0x7f, 0x73, 0xf2, 0xaa, 0x7c, 0xed, 0xf7, 0x57, 0xe5,
0xda, 0xdf, 0xbd, 0x92, 0xf6, 0xec, 0xf1, 0xeb, 0xfd, 0x28, 0xf2, 0x48, 0x2c, 0x0e, 0x74, 0x71, 0x6b, 0x3f, 0xf5, 0xcb, 0xda, 0x49, 0xbf, 0xac, 0xfd, 0xd6, 0x2f, 0x6b, 0x7f, 0xf7, 0xcb, 0xda,
0xcf, 0xc3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xc3, 0x21, 0xef, 0x5b, 0x11, 0x00, 0x00, 0xb3, 0x87, 0xaf, 0xf7, 0xcf, 0x93, 0x07, 0x62, 0xb0, 0xab, 0x8b, 0x7d, 0xee, 0xff, 0x1b, 0x00,
0x00, 0xff, 0xff, 0x55, 0x8b, 0x54, 0x53, 0x83, 0x11, 0x00, 0x00,
} }

View File

@ -16,8 +16,8 @@ service Tasks {
// Create a task. // Create a task.
rpc Create(CreateTaskRequest) returns (CreateTaskResponse); rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
// Start a task. // Start a process.
rpc Start(StartTaskRequest) returns (google.protobuf.Empty); rpc Start(StartRequest) returns (StartResponse);
// Delete a task and on disk state. // Delete a task and on disk state.
rpc Delete(DeleteTaskRequest) returns (DeleteResponse); rpc Delete(DeleteTaskRequest) returns (DeleteResponse);
@ -31,7 +31,7 @@ service Tasks {
// Kill a task or process. // Kill a task or process.
rpc Kill(KillRequest) returns (google.protobuf.Empty); rpc Kill(KillRequest) returns (google.protobuf.Empty);
rpc Exec(ExecProcessRequest) returns (ExecProcessResponse); rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty);
rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty); rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty);
@ -74,8 +74,13 @@ message CreateTaskResponse {
uint32 pid = 2; uint32 pid = 2;
} }
message StartTaskRequest { message StartRequest {
string container_id = 1; string container_id = 1;
string exec_id = 2;
}
message StartResponse {
uint32 pid = 1;
} }
message DeleteTaskRequest { message DeleteTaskRequest {
@ -132,7 +137,6 @@ message ExecProcessRequest {
} }
message ExecProcessResponse { message ExecProcessResponse {
uint32 pid = 1;
} }
message ResizePtyRequest { message ResizePtyRequest {

View File

@ -869,7 +869,7 @@ func TestContainerExecNoBinaryExists(t *testing.T) {
close(finished) close(finished)
}() }()
// start an exec process without running the original container process info // start an exec process without running the original container process
processSpec := spec.Process processSpec := spec.Process
processSpec.Args = []string{ processSpec.Args = []string{
"none", "none",

View File

@ -79,7 +79,17 @@ func (p *Process) CloseIO(ctx context.Context) error {
Stdin: true, Stdin: true,
}) })
if err != nil { if err != nil {
err = errdefs.FromGRPC(err) return errdefs.FromGRPC(err)
} }
return err return nil
}
func (p *Process) Start(ctx context.Context) error {
_, err := p.t.shim.Start(ctx, &shim.StartRequest{
ID: p.id,
})
if err != nil {
return errdefs.FromGRPC(err)
}
return nil
} }

View File

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

View File

@ -31,27 +31,17 @@ func (p *process) Pid() uint32 {
// Start starts the exec process // Start starts the exec process
func (p *process) Start(ctx context.Context) error { func (p *process) Start(ctx context.Context) error {
any, err := typeurl.MarshalAny(p.spec) r, err := p.task.client.TaskService().Start(ctx, &tasks.StartRequest{
if err != nil {
return err
}
request := &tasks.ExecProcessRequest{
ContainerID: p.task.id, ContainerID: p.task.id,
ExecID: p.id, ExecID: p.id,
Terminal: p.io.Terminal, })
Stdin: p.io.Stdin,
Stdout: p.io.Stdout,
Stderr: p.io.Stderr,
Spec: any,
}
response, err := p.task.client.TaskService().Exec(ctx, request)
if err != nil { if err != nil {
p.io.Cancel() p.io.Cancel()
p.io.Wait() p.io.Wait()
p.io.Close() p.io.Close()
return err return err
} }
p.pid = response.Pid p.pid = r.Pid
return nil return nil
} }

View File

@ -23,6 +23,8 @@ type Process interface {
ResizePty(context.Context, ConsoleSize) error ResizePty(context.Context, ConsoleSize) error
// CloseStdin closes the processes stdin // CloseStdin closes the processes stdin
CloseIO(context.Context) error CloseIO(context.Context) error
// Start the container's user defined process
Start(context.Context) error
} }
type Task interface { type Task interface {
@ -30,8 +32,6 @@ type Task interface {
// Information of the container // Information of the container
Info() TaskInfo Info() TaskInfo
// Start the container's user defined process
Start(context.Context) error
// Pause pauses the container process // Pause pauses the container process
Pause(context.Context) error Pause(context.Context) error
// Resume unpauses the container process // Resume unpauses the container process

View File

@ -152,16 +152,27 @@ func (s *Service) Create(ctx context.Context, r *api.CreateTaskRequest) (*api.Cr
}, nil }, nil
} }
func (s *Service) Start(ctx context.Context, r *api.StartTaskRequest) (*google_protobuf.Empty, error) { func (s *Service) Start(ctx context.Context, r *api.StartRequest) (*api.StartResponse, error) {
t, err := s.getTask(ctx, r.ContainerID) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := t.Start(ctx); err != nil { p := runtime.Process(t)
if r.ExecID != "" {
if p, err = t.Process(ctx, r.ExecID); err != nil {
return nil, err return nil, err
} }
}
return empty, nil if err := p.Start(ctx); err != nil {
return nil, err
}
state, err := p.State(ctx)
if err != nil {
return nil, err
}
return &api.StartResponse{
Pid: state.Pid,
}, nil
} }
func (s *Service) Delete(ctx context.Context, r *api.DeleteTaskRequest) (*api.DeleteResponse, error) { func (s *Service) Delete(ctx context.Context, r *api.DeleteTaskRequest) (*api.DeleteResponse, error) {
@ -317,7 +328,7 @@ func (s *Service) ListPids(ctx context.Context, r *api.ListPidsRequest) (*api.Li
}, nil }, nil
} }
func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.ExecProcessResponse, error) { func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*google_protobuf.Empty, error) {
if r.ExecID == "" { if r.ExecID == "" {
return nil, grpc.Errorf(codes.InvalidArgument, "exec id cannot be empty") return nil, grpc.Errorf(codes.InvalidArgument, "exec id cannot be empty")
} }
@ -325,7 +336,7 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.Exe
if err != nil { if err != nil {
return nil, err return nil, err
} }
process, err := t.Exec(ctx, r.ExecID, runtime.ExecOpts{ if _, err := t.Exec(ctx, r.ExecID, runtime.ExecOpts{
Spec: r.Spec, Spec: r.Spec,
IO: runtime.IO{ IO: runtime.IO{
Stdin: r.Stdin, Stdin: r.Stdin,
@ -333,17 +344,10 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*api.Exe
Stderr: r.Stderr, Stderr: r.Stderr,
Terminal: r.Terminal, Terminal: r.Terminal,
}, },
}) }); err != nil {
if err != nil {
return nil, err return nil, err
} }
state, err := process.State(ctx) return empty, nil
if err != nil {
return nil, err
}
return &api.ExecProcessResponse{
Pid: state.Pid,
}, nil
} }
func (s *Service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*google_protobuf.Empty, error) { func (s *Service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*google_protobuf.Empty, error) {

21
task.go
View File

@ -118,7 +118,7 @@ func (t *task) Start(ctx context.Context) error {
t.pid = response.Pid t.pid = response.Pid
return nil return nil
} }
_, err := t.client.TaskService().Start(ctx, &tasks.StartTaskRequest{ _, err := t.client.TaskService().Start(ctx, &tasks.StartRequest{
ContainerID: t.id, ContainerID: t.id,
}) })
if err != nil { if err != nil {
@ -214,6 +214,25 @@ func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreat
if err != nil { if err != nil {
return nil, err return nil, err
} }
any, err := typeurl.MarshalAny(spec)
if err != nil {
return nil, err
}
request := &tasks.ExecProcessRequest{
ContainerID: t.id,
ExecID: id,
Terminal: i.Terminal,
Stdin: i.Stdin,
Stdout: i.Stdout,
Stderr: i.Stderr,
Spec: any,
}
if _, err := t.client.TaskService().Exec(ctx, request); err != nil {
i.Cancel()
i.Wait()
i.Close()
return nil, err
}
return &process{ return &process{
id: id, id: id,
task: t, task: t,