Implement task update

This allows tasks to have their resources updated as they are running.

Fixes #1067

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-06-26 16:38:49 -07:00
parent 1f478be14d
commit f36e0193a4
15 changed files with 749 additions and 152 deletions

View File

@ -30,6 +30,7 @@
ListProcessesResponse
CheckpointTaskRequest
CheckpointTaskResponse
UpdateTaskRequest
*/
package tasks
@ -388,6 +389,15 @@ func (m *CheckpointTaskResponse) Reset() { *m = CheckpointTas
func (*CheckpointTaskResponse) ProtoMessage() {}
func (*CheckpointTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} }
type UpdateTaskRequest struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
Resources *google_protobuf1.Any `protobuf:"bytes,2,opt,name=resources" json:"resources,omitempty"`
}
func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} }
func (*UpdateTaskRequest) ProtoMessage() {}
func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{21} }
func init() {
proto.RegisterType((*CreateTaskRequest)(nil), "containerd.services.tasks.v1.CreateTaskRequest")
proto.RegisterType((*CreateTaskResponse)(nil), "containerd.services.tasks.v1.CreateTaskResponse")
@ -410,6 +420,7 @@ func init() {
proto.RegisterType((*ListProcessesResponse)(nil), "containerd.services.tasks.v1.ListProcessesResponse")
proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.services.tasks.v1.CheckpointTaskRequest")
proto.RegisterType((*CheckpointTaskResponse)(nil), "containerd.services.tasks.v1.CheckpointTaskResponse")
proto.RegisterType((*UpdateTaskRequest)(nil), "containerd.services.tasks.v1.UpdateTaskRequest")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -441,6 +452,7 @@ type TasksClient interface {
Resume(ctx context.Context, in *ResumeTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
ListProcesses(ctx context.Context, in *ListProcessesRequest, opts ...grpc.CallOption) (*ListProcessesResponse, error)
Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*CheckpointTaskResponse, error)
Update(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
}
type tasksClient struct {
@ -577,6 +589,15 @@ func (c *tasksClient) Checkpoint(ctx context.Context, in *CheckpointTaskRequest,
return out, nil
}
func (c *tasksClient) Update(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
out := new(google_protobuf.Empty)
err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Update", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Tasks service
type TasksServer interface {
@ -598,6 +619,7 @@ type TasksServer interface {
Resume(context.Context, *ResumeTaskRequest) (*google_protobuf.Empty, error)
ListProcesses(context.Context, *ListProcessesRequest) (*ListProcessesResponse, error)
Checkpoint(context.Context, *CheckpointTaskRequest) (*CheckpointTaskResponse, error)
Update(context.Context, *UpdateTaskRequest) (*google_protobuf.Empty, error)
}
func RegisterTasksServer(s *grpc.Server, srv TasksServer) {
@ -856,6 +878,24 @@ func _Tasks_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Tasks_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateTaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TasksServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.services.tasks.v1.Tasks/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TasksServer).Update(ctx, req.(*UpdateTaskRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Tasks_serviceDesc = grpc.ServiceDesc{
ServiceName: "containerd.services.tasks.v1.Tasks",
HandlerType: (*TasksServer)(nil),
@ -916,6 +956,10 @@ var _Tasks_serviceDesc = grpc.ServiceDesc{
MethodName: "Checkpoint",
Handler: _Tasks_Checkpoint_Handler,
},
{
MethodName: "Update",
Handler: _Tasks_Update_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "github.com/containerd/containerd/api/services/tasks/v1/tasks.proto",
@ -1646,6 +1690,40 @@ func (m *CheckpointTaskResponse) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *UpdateTaskRequest) 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 *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.ContainerID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
}
if m.Resources != nil {
dAtA[i] = 0x12
i++
i = encodeVarintTasks(dAtA, i, uint64(m.Resources.Size()))
n6, err := m.Resources.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
}
return i, nil
}
func encodeFixed64Tasks(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
@ -1991,6 +2069,20 @@ func (m *CheckpointTaskResponse) Size() (n int) {
return n
}
func (m *UpdateTaskRequest) Size() (n int) {
var l int
_ = l
l = len(m.ContainerID)
if l > 0 {
n += 1 + l + sovTasks(uint64(l))
}
if m.Resources != nil {
l = m.Resources.Size()
n += 1 + l + sovTasks(uint64(l))
}
return n
}
func sovTasks(x uint64) (n int) {
for {
n++
@ -2269,6 +2361,17 @@ func (this *CheckpointTaskResponse) String() string {
}, "")
return s
}
func (this *UpdateTaskRequest) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&UpdateTaskRequest{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Any", "google_protobuf1.Any", 1) + `,`,
`}`,
}, "")
return s
}
func valueToStringTasks(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
@ -4654,6 +4757,118 @@ func (m *CheckpointTaskResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *UpdateTaskRequest) 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: UpdateTaskRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: UpdateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 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.ContainerID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTasks
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTasks
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Resources == nil {
m.Resources = &google_protobuf1.Any{}
}
if err := m.Resources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
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 skipTasks(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
@ -4764,80 +4979,82 @@ func init() {
}
var fileDescriptorTasks = []byte{
// 1191 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x4f, 0xe3, 0xc6,
0x17, 0xc7, 0xf9, 0xb5, 0xe1, 0x05, 0x58, 0x98, 0x2f, 0xcb, 0x37, 0xeb, 0xa2, 0x04, 0xf9, 0xd2,
0x74, 0x55, 0xec, 0x12, 0xaa, 0xaa, 0x62, 0x57, 0xd5, 0x02, 0xa1, 0x94, 0xfe, 0x10, 0xd4, 0xac,
0xaa, 0x0a, 0x55, 0x8a, 0x4c, 0x3c, 0x84, 0x51, 0x1c, 0xdb, 0xeb, 0x99, 0xb0, 0xa4, 0xa7, 0x9e,
0x7a, 0x6d, 0x8f, 0xfd, 0x5b, 0x7a, 0xee, 0x81, 0x63, 0x0f, 0x3d, 0x54, 0x3d, 0xd0, 0x2e, 0xfd,
0x47, 0xaa, 0x19, 0x4f, 0x8c, 0x93, 0x90, 0x5f, 0x84, 0x0b, 0xcc, 0x3c, 0xbf, 0xf7, 0xe6, 0xfd,
0xfe, 0x3c, 0x05, 0x76, 0xea, 0x84, 0x9d, 0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
0xf2, 0xab, 0xc6, 0xd8, 0xfc, 0xf2, 0xa1, 0x03, 0x48, 0x71, 0x2c, 0x47, 0xef, 0x0d, 0x17, 0x8c,
0xe1, 0xfd, 0xc0, 0x9c, 0x37, 0x20, 0xc5, 0xe1, 0x0a, 0x8d, 0x28, 0xbf, 0x7e, 0xa0, 0x56, 0x37,
0x26, 0x90, 0x90, 0x76, 0x1f, 0xc3, 0x6c, 0x84, 0x78, 0xa3, 0xa2, 0xd4, 0x0b, 0x8d, 0x03, 0x3d,
0x38, 0x84, 0x47, 0x12, 0xbe, 0x46, 0x65, 0xb7, 0x1b, 0xe5, 0x86, 0x28, 0x4c, 0x0b, 0x84, 0x1a,
0x65, 0x61, 0x2f, 0x8c, 0x0d, 0x54, 0xf8, 0x35, 0x64, 0x42, 0xa8, 0x1a, 0xd5, 0x57, 0x7d, 0x80,
0x36, 0x50, 0xe5, 0x25, 0xcc, 0x77, 0x01, 0xcd, 0xa8, 0x0e, 0xba, 0x0b, 0xe1, 0xd4, 0xcd, 0x89,
0x64, 0x64, 0x0e, 0xdf, 0x00, 0xc4, 0x86, 0xfd, 0xe6, 0x3d, 0x66, 0xbb, 0xfa, 0xe1, 0x64, 0x42,
0xe1, 0xc3, 0x3b, 0xdf, 0x5c, 0xbd, 0x2d, 0xcc, 0xfc, 0xf9, 0xb6, 0x30, 0xf3, 0xc3, 0x4d, 0x41,
0xb9, 0xba, 0x29, 0x28, 0xbf, 0xdf, 0x14, 0x94, 0x7f, 0x6e, 0x0a, 0xca, 0xc9, 0x8b, 0xfb, 0xfd,
0xf4, 0xf0, 0x5c, 0x1c, 0x4e, 0x33, 0x22, 0xb4, 0x9b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf2,
0x10, 0x7d, 0xd7, 0xc1, 0x10, 0x00, 0x00,
// 1231 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd,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, 0x8f, 0x71, 0x16, 0xf6, 0x63,
0xe8, 0x50, 0x85, 0x2f, 0x20, 0x13, 0xe0, 0x64, 0x5c, 0x5f, 0x0d, 0xa0, 0xe9, 0x50, 0x95, 0x97,
0x30, 0xdf, 0x83, 0x72, 0x71, 0x1d, 0x74, 0x1b, 0xbc, 0xca, 0x9b, 0x13, 0xc9, 0x88, 0x1c, 0xbe,
0x06, 0x88, 0x20, 0xcd, 0xe6, 0x1d, 0x80, 0x45, 0xfe, 0x70, 0x32, 0x21, 0xf1, 0xf0, 0x0b, 0xc8,
0x04, 0x23, 0x3e, 0x2e, 0x8a, 0x03, 0x40, 0x30, 0x2c, 0x8a, 0x3b, 0xdf, 0x5c, 0xbd, 0x29, 0xcc,
0xfc, 0xfd, 0xa6, 0x30, 0xf3, 0xe3, 0x4d, 0x41, 0xba, 0xba, 0x29, 0x48, 0x7f, 0xde, 0x14, 0xa4,
0xff, 0x6e, 0x0a, 0xd2, 0xc9, 0xb3, 0xbb, 0xfd, 0x94, 0xf2, 0x94, 0x1f, 0x4e, 0x33, 0xfc, 0x9d,
0xcd, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x9f, 0x9a, 0x26, 0x91, 0x11, 0x00, 0x00,
}

View File

@ -44,6 +44,8 @@ service Tasks {
rpc ListProcesses(ListProcessesRequest) returns (ListProcessesResponse);
rpc Checkpoint(CheckpointTaskRequest) returns (CheckpointTaskResponse);
rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty);
}
message CreateTaskRequest {
@ -188,3 +190,8 @@ message CheckpointTaskRequest {
message CheckpointTaskResponse {
repeated containerd.types.Descriptor descriptors = 1;
}
message UpdateTaskRequest {
string container_id = 1;
google.protobuf.Any resources = 2;
}

View File

@ -9,6 +9,9 @@ import (
"sync"
"syscall"
"testing"
"github.com/containerd/cgroups"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
func empty() IOCreation {
@ -734,3 +737,95 @@ func TestContainerKill(t *testing.T) {
t.Errorf("expected error %q but received %q", ErrProcessExited, err)
}
}
func TestContainerUpdate(t *testing.T) {
if testing.Short() {
t.Skip()
}
client, err := New(address)
if err != nil {
t.Fatal(err)
}
defer client.Close()
var (
ctx, cancel = testContext()
id = t.Name()
)
defer cancel()
image, err := client.GetImage(ctx, testImage)
if err != nil {
t.Error(err)
return
}
spec, err := GenerateSpec(WithImageConfig(ctx, image), WithProcessArgs("sleep", "30"))
if err != nil {
t.Error(err)
return
}
limit := uint64(32 * 1024 * 1024)
spec.Linux.Resources.Memory = &specs.LinuxMemory{
Limit: &limit,
}
container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image))
if err != nil {
t.Error(err)
return
}
defer container.Delete(ctx, WithRootFSDeletion)
task, err := container.NewTask(ctx, empty())
if err != nil {
t.Error(err)
return
}
defer task.Delete(ctx)
statusC := make(chan uint32, 1)
go func() {
status, err := task.Wait(ctx)
if err != nil {
t.Error(err)
}
statusC <- status
}()
// check that the task has a limit of 32mb
cgroup, err := cgroups.Load(cgroups.V1, cgroups.PidPath(int(task.Pid())))
if err != nil {
t.Error(err)
return
}
stat, err := cgroup.Stat(cgroups.IgnoreNotExist)
if err != nil {
t.Error(err)
return
}
if stat.Memory.Usage.Limit != limit {
t.Errorf("expected memory limit to be set to %d but received %d", limit, stat.Memory.Usage.Limit)
return
}
limit = 64 * 1024 * 1024
if err := task.Update(ctx, WithResources(&specs.LinuxResources{
Memory: &specs.LinuxMemory{
Limit: &limit,
},
})); err != nil {
t.Error(err)
}
// check that the task has a limit of 64mb
if stat, err = cgroup.Stat(cgroups.IgnoreNotExist); err != nil {
t.Error(err)
return
}
if stat.Memory.Usage.Limit != limit {
t.Errorf("expected memory limit to be set to %d but received %d", limit, stat.Memory.Usage.Limit)
}
if err := task.Kill(ctx, syscall.SIGKILL); err != nil {
t.Error(err)
return
}
<-statusC
}

View File

@ -23,6 +23,7 @@ import (
"github.com/containerd/containerd/plugin"
"github.com/containerd/fifo"
runc "github.com/containerd/go-runc"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
@ -284,6 +285,14 @@ func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointT
return nil
}
func (p *initProcess) Update(context context.Context, r *shimapi.UpdateTaskRequest) error {
var resources specs.LinuxResources
if err := json.Unmarshal(r.Resources.Value, &resources); err != nil {
return err
}
return p.runc.Update(context, p.id, &resources)
}
// TODO(mlaventure): move to runc package?
func getLastRuncError(r *runc.Runc) (string, error) {
if r.Log == "" {

View File

@ -91,6 +91,10 @@ func (c *local) ShimInfo(ctx context.Context, in *google_protobuf.Empty, opts ..
return c.s.ShimInfo(ctx, in)
}
func (c *local) Update(ctx context.Context, in *shimapi.UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
return c.s.Update(ctx, in)
}
type events struct {
c chan *shimapi.Event
ctx context.Context

View File

@ -364,6 +364,16 @@ func (s *Service) ShimInfo(ctx context.Context, r *google_protobuf.Empty) (*shim
}, nil
}
func (s *Service) Update(ctx context.Context, r *shimapi.UpdateTaskRequest) (*google_protobuf.Empty, error) {
if s.initProcess == nil {
return nil, errors.New(ErrContainerNotCreated)
}
if err := s.initProcess.Update(ctx, r); err != nil {
return nil, err
}
return empty, nil
}
func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) {
status := <-cmd.ExitCh
p.Exited(status)

View File

@ -25,6 +25,7 @@
ShimInfoResponse
StreamEventsRequest
Event
UpdateTaskRequest
*/
package shim
@ -258,6 +259,14 @@ func (m *Event) Reset() { *m = Event{} }
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} }
type UpdateTaskRequest struct {
Resources *google_protobuf.Any `protobuf:"bytes,1,opt,name=resources" json:"resources,omitempty"`
}
func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} }
func (*UpdateTaskRequest) ProtoMessage() {}
func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} }
func init() {
proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest")
proto.RegisterType((*CreateTaskResponse)(nil), "containerd.runtime.linux.shim.v1.CreateTaskResponse")
@ -275,6 +284,7 @@ func init() {
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.RegisterType((*UpdateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.UpdateTaskRequest")
proto.RegisterEnum("containerd.runtime.linux.shim.v1.Event_EventType", Event_EventType_name, Event_EventType_value)
}
@ -306,6 +316,7 @@ type ShimClient interface {
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)
Update(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
}
type shimClient struct {
@ -474,6 +485,15 @@ func (c *shimClient) ShimInfo(ctx context.Context, in *google_protobuf1.Empty, o
return out, nil
}
func (c *shimClient) Update(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
out := new(google_protobuf1.Empty)
err := grpc.Invoke(ctx, "/containerd.runtime.linux.shim.v1.Shim/Update", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Shim service
type ShimServer interface {
@ -494,6 +514,7 @@ type ShimServer interface {
CloseIO(context.Context, *CloseIORequest) (*google_protobuf1.Empty, error)
// ShimInfo returns information about the shim.
ShimInfo(context.Context, *google_protobuf1.Empty) (*ShimInfoResponse, error)
Update(context.Context, *UpdateTaskRequest) (*google_protobuf1.Empty, error)
}
func RegisterShimServer(s *grpc.Server, srv ShimServer) {
@ -773,6 +794,24 @@ func _Shim_ShimInfo_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Shim_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateTaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShimServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.runtime.linux.shim.v1.Shim/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Update(ctx, req.(*UpdateTaskRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Shim_serviceDesc = grpc.ServiceDesc{
ServiceName: "containerd.runtime.linux.shim.v1.Shim",
HandlerType: (*ShimServer)(nil),
@ -833,6 +872,10 @@ var _Shim_serviceDesc = grpc.ServiceDesc{
MethodName: "ShimInfo",
Handler: _Shim_ShimInfo_Handler,
},
{
MethodName: "Update",
Handler: _Shim_Update_Handler,
},
},
Streams: []grpc.StreamDesc{
{
@ -1460,6 +1503,34 @@ func (m *Event) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *UpdateTaskRequest) 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 *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Resources != nil {
dAtA[i] = 0xa
i++
i = encodeVarintShim(dAtA, i, uint64(m.Resources.Size()))
n4, err := m.Resources.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
}
return i, nil
}
func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
@ -1759,6 +1830,16 @@ func (m *Event) Size() (n int) {
return n
}
func (m *UpdateTaskRequest) Size() (n int) {
var l int
_ = l
if m.Resources != nil {
l = m.Resources.Size()
n += 1 + l + sovShim(uint64(l))
}
return n
}
func sovShim(x uint64) (n int) {
for {
n++
@ -1974,6 +2055,16 @@ func (this *Event) String() string {
}, "")
return s
}
func (this *UpdateTaskRequest) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&UpdateTaskRequest{`,
`Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Any", "google_protobuf.Any", 1) + `,`,
`}`,
}, "")
return s
}
func valueToStringShim(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
@ -4058,6 +4149,89 @@ func (m *Event) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *UpdateTaskRequest) 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: UpdateTaskRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: UpdateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Resources", 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 m.Resources == nil {
m.Resources = &google_protobuf.Any{}
}
if err := m.Resources.Unmarshal(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
@ -4168,80 +4342,82 @@ func init() {
}
var fileDescriptorShim = []byte{
// 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, 0x34, 0x33, 0x4c, 0xe5, 0xc6, 0xa1, 0x4d, 0x08, 0x27, 0x27, 0xd6, 0x21, 0x03, 0x99, 0x98,
0xb5, 0x81, 0x0e, 0x33, 0x90, 0x51, 0xec, 0x8d, 0x2d, 0x22, 0x4b, 0x42, 0xbb, 0x0a, 0x31, 0xa7,
0x9e, 0x38, 0xf3, 0x27, 0x70, 0xe0, 0xce, 0x5f, 0xc0, 0x99, 0x1c, 0x39, 0x72, 0x2a, 0x6d, 0xfe,
0x12, 0x66, 0x57, 0x92, 0x2d, 0xdb, 0x51, 0x6d, 0x67, 0xb8, 0x58, 0xfb, 0x76, 0xdf, 0xdb, 0xfd,
0xec, 0xe7, 0xfd, 0x5a, 0xc3, 0x27, 0x3d, 0x93, 0xf5, 0xfd, 0x73, 0xad, 0xe3, 0x0c, 0xaa, 0x1d,
0xc7, 0x66, 0x86, 0x69, 0x13, 0xaf, 0x1b, 0x1f, 0x5a, 0xa6, 0xed, 0x5f, 0x57, 0x69, 0xdf, 0x1c,
0x54, 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79, 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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c0, 0x25, 0x66, 0xfa, 0xe1, 0x29, 0xc8, 0x1e, 0x57, 0x2f, 0xc2, 0x83, 0x33,
0xac, 0x1e, 0xe7, 0xee, 0xc1, 0xf1, 0xcd, 0xdb, 0xca, 0xca, 0x5f, 0x6f, 0x2b, 0x2b, 0xaf, 0x6f,
0x2b, 0xd2, 0xcd, 0x6d, 0x45, 0xfa, 0xf3, 0xb6, 0x22, 0xfd, 0x73, 0x5b, 0x91, 0xbe, 0xda, 0x59,
0xee, 0xaf, 0xf0, 0xc7, 0xfc, 0x7b, 0x2e, 0x8b, 0xed, 0x77, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff,
0x94, 0x4d, 0x29, 0x2c, 0x48, 0x0f, 0x00, 0x00,
}

View File

@ -47,6 +47,8 @@ service Shim {
// ShimInfo returns information about the shim.
rpc ShimInfo(google.protobuf.Empty) returns (ShimInfoResponse);
rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty);
}
message CreateTaskRequest {
@ -154,3 +156,7 @@ message Event {
uint32 exit_status = 4;
google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}
message UpdateTaskRequest {
google.protobuf.Any resources = 1;
}

View File

@ -192,6 +192,16 @@ func (t *Task) DeleteProcess(ctx context.Context, pid uint32) (*plugin.Exit, err
}, nil
}
func (t *Task) Update(ctx context.Context, resources []byte) error {
_, err := t.shim.Update(ctx, &shim.UpdateTaskRequest{
Resources: &protobuf.Any{
TypeUrl: specs.Version,
Value: resources,
},
})
return err
}
type Process struct {
pid int
t *Task

View File

@ -35,6 +35,8 @@ type Task interface {
Checkpoint(context.Context, string, map[string]string) error
// DeleteProcess deletes a specific exec process via the pid
DeleteProcess(context.Context, uint32) (*Exit, error)
// Update sets the provided resources to a running task
Update(context.Context, []byte) error
}
type ExecOpts struct {

View File

@ -451,6 +451,17 @@ func (s *Service) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest)
}, nil
}
func (s *Service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*google_protobuf.Empty, error) {
t, err := s.getTask(ctx, r.ContainerID)
if err != nil {
return nil, err
}
if err := t.Update(ctx, r.Resources.Value); err != nil {
return nil, err
}
return empty, nil
}
func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io.Reader) (*types.Descriptor, error) {
writer, err := s.store.Writer(ctx, ref, 0, "")
if err != nil {

View File

@ -11,6 +11,7 @@ import (
"strings"
"github.com/containerd/containerd/api/services/containers/v1"
"github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/images"
protobuf "github.com/gogo/protobuf/types"
"github.com/opencontainers/image-spec/specs-go/v1"
@ -290,3 +291,17 @@ func WithSpec(spec *specs.Spec) NewContainerOpts {
return nil
}
}
func WithResources(resources *specs.LinuxResources) UpdateTaskOpts {
return func(ctx context.Context, client *Client, r *tasks.UpdateTaskRequest) error {
data, err := json.Marshal(resources)
if err != nil {
return err
}
r.Resources = &protobuf.Any{
TypeUrl: specs.Version,
Value: data,
}
return nil
}
}

View File

@ -7,6 +7,7 @@ import (
"runtime"
"github.com/containerd/containerd/api/services/containers/v1"
tasks "github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/images"
protobuf "github.com/gogo/protobuf/types"
"github.com/opencontainers/image-spec/specs-go/v1"
@ -92,3 +93,17 @@ func WithSpec(spec *specs.Spec) NewContainerOpts {
return nil
}
}
func WithResources(resources *specs.WindowsResources) UpdateTaskOpts {
return func(ctx context.Context, client *Client, r *tasks.UpdateTaskRequest) error {
data, err := json.Marshal(resources)
if err != nil {
return err
}
r.Resources = &protobuf.Any{
TypeUrl: specs.Version,
Value: data,
}
return nil
}
}

16
task.go
View File

@ -57,6 +57,7 @@ type Task interface {
Resize(ctx context.Context, w, h uint32) error
IO() *IO
Checkpoint(context.Context, ...CheckpointOpts) (v1.Descriptor, error)
Update(context.Context, ...UpdateTaskOpts) error
}
type Process interface {
@ -292,6 +293,21 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Des
return t.writeIndex(ctx, &index)
}
type UpdateTaskOpts func(context.Context, *Client, *tasks.UpdateTaskRequest) error
func (t *task) Update(ctx context.Context, opts ...UpdateTaskOpts) error {
request := &tasks.UpdateTaskRequest{
ContainerID: t.containerID,
}
for _, o := range opts {
if err := o(ctx, t.client, request); err != nil {
return err
}
}
_, err := t.client.TaskService().Update(ctx, request)
return err
}
func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *tasks.CheckpointTaskRequest) error {
response, err := t.client.TaskService().Checkpoint(ctx, request)
if err != nil {

View File

@ -214,6 +214,10 @@ func (c *container) DeleteProcess(ctx context.Context, pid uint32) (*plugin.Exit
}, nil
}
func (c *container) Update(ctx context.Context, spec []byte) error {
return fmt.Errorf("Windows containers do not support update")
}
func (c *container) setStatus(status plugin.Status) {
c.Lock()
c.status = status