diff --git a/api/services/execution/execution.pb.go b/api/services/execution/execution.pb.go index 3a97e66ba..cee6786bd 100644 --- a/api/services/execution/execution.pb.go +++ b/api/services/execution/execution.pb.go @@ -27,6 +27,8 @@ ResumeRequest ProcessesRequest ProcessesResponse + CheckpointRequest + CheckpointResponse */ package execution @@ -38,9 +40,11 @@ import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" import containerd_v1_types "github.com/containerd/containerd/api/types/mount" import containerd_v1_types1 "github.com/containerd/containerd/api/types/container" +import containerd_v1_types2 "github.com/containerd/containerd/api/types/descriptor" import _ "github.com/gogo/protobuf/types" import time "time" +import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" import ( context "golang.org/x/net/context" @@ -67,14 +71,15 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type CreateRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Spec *google_protobuf1.Any `protobuf:"bytes,2,opt,name=spec" json:"spec,omitempty"` - Rootfs []*containerd_v1_types.Mount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` - Runtime string `protobuf:"bytes,4,opt,name=runtime,proto3" json:"runtime,omitempty"` - Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` - Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Spec *google_protobuf1.Any `protobuf:"bytes,2,opt,name=spec" json:"spec,omitempty"` + Rootfs []*containerd_v1_types.Mount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` + Runtime string `protobuf:"bytes,4,opt,name=runtime,proto3" json:"runtime,omitempty"` + Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` + Checkpoint *containerd_v1_types2.Descriptor `protobuf:"bytes,9,opt,name=checkpoint" json:"checkpoint,omitempty"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } @@ -337,6 +342,29 @@ func (m *ProcessesResponse) Reset() { *m = ProcessesResponse{ func (*ProcessesResponse) ProtoMessage() {} func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{17} } +type CheckpointRequest struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + AllowTcp bool `protobuf:"varint,2,opt,name=allow_tcp,json=allowTcp,proto3" json:"allow_tcp,omitempty"` + AllowUnixSockets bool `protobuf:"varint,3,opt,name=allow_unix_sockets,json=allowUnixSockets,proto3" json:"allow_unix_sockets,omitempty"` + AllowTerminal bool `protobuf:"varint,4,opt,name=allow_terminal,json=allowTerminal,proto3" json:"allow_terminal,omitempty"` + FileLocks bool `protobuf:"varint,5,opt,name=file_locks,json=fileLocks,proto3" json:"file_locks,omitempty"` + EmptyNamespaces []string `protobuf:"bytes,6,rep,name=empty_namespaces,json=emptyNamespaces" json:"empty_namespaces,omitempty"` + ParentCheckpoint github_com_opencontainers_go_digest.Digest `protobuf:"bytes,7,opt,name=parent_checkpoint,json=parentCheckpoint,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"parent_checkpoint"` + Exit bool `protobuf:"varint,8,opt,name=exit,proto3" json:"exit,omitempty"` +} + +func (m *CheckpointRequest) Reset() { *m = CheckpointRequest{} } +func (*CheckpointRequest) ProtoMessage() {} +func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{18} } + +type CheckpointResponse struct { + Descriptors []*containerd_v1_types2.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` +} + +func (m *CheckpointResponse) Reset() { *m = CheckpointResponse{} } +func (*CheckpointResponse) ProtoMessage() {} +func (*CheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{19} } + func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest") proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.CreateResponse") @@ -356,6 +384,8 @@ func init() { proto.RegisterType((*ResumeRequest)(nil), "containerd.v1.services.ResumeRequest") proto.RegisterType((*ProcessesRequest)(nil), "containerd.v1.services.ProcessesRequest") proto.RegisterType((*ProcessesResponse)(nil), "containerd.v1.services.ProcessesResponse") + proto.RegisterType((*CheckpointRequest)(nil), "containerd.v1.services.CheckpointRequest") + proto.RegisterType((*CheckpointResponse)(nil), "containerd.v1.services.CheckpointResponse") } // Reference imports to suppress errors if they are not otherwise used. @@ -382,6 +412,7 @@ type ContainerServiceClient interface { Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) + Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) } type containerServiceClient struct { @@ -532,6 +563,15 @@ func (c *containerServiceClient) Processes(ctx context.Context, in *ProcessesReq return out, nil } +func (c *containerServiceClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) { + out := new(CheckpointResponse) + err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Checkpoint", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ContainerService service type ContainerServiceServer interface { @@ -548,6 +588,7 @@ type ContainerServiceServer interface { Pause(context.Context, *PauseRequest) (*google_protobuf.Empty, error) Resume(context.Context, *ResumeRequest) (*google_protobuf.Empty, error) Processes(context.Context, *ProcessesRequest) (*ProcessesResponse, error) + Checkpoint(context.Context, *CheckpointRequest) (*CheckpointResponse, error) } func RegisterContainerServiceServer(s *grpc.Server, srv ContainerServiceServer) { @@ -791,6 +832,24 @@ func _ContainerService_Processes_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _ContainerService_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Checkpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.ContainerService/Checkpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Checkpoint(ctx, req.(*CheckpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ContainerService_serviceDesc = grpc.ServiceDesc{ ServiceName: "containerd.v1.services.ContainerService", HandlerType: (*ContainerServiceServer)(nil), @@ -843,6 +902,10 @@ var _ContainerService_serviceDesc = grpc.ServiceDesc{ MethodName: "Processes", Handler: _ContainerService_Processes_Handler, }, + { + MethodName: "Checkpoint", + Handler: _ContainerService_Checkpoint_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -931,6 +994,16 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { } i++ } + if m.Checkpoint != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintExecution(dAtA, i, uint64(m.Checkpoint.Size())) + n2, err := m.Checkpoint.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } return i, nil } @@ -1040,11 +1113,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintExecution(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) - n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) if err != nil { return 0, err } - i += n2 + i += n3 return i, nil } @@ -1147,11 +1220,11 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintExecution(dAtA, i, uint64(m.Signal)) } if m.PidOrAll != nil { - nn3, err := m.PidOrAll.MarshalTo(dAtA[i:]) + nn4, err := m.PidOrAll.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += nn3 + i += nn4 } return i, nil } @@ -1246,11 +1319,11 @@ func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x32 i++ i = encodeVarintExecution(dAtA, i, uint64(m.Spec.Size())) - n4, err := m.Spec.MarshalTo(dAtA[i:]) + n5, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n4 + i += n5 } return i, nil } @@ -1448,6 +1521,131 @@ func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *CheckpointRequest) 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 *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.AllowTcp { + dAtA[i] = 0x10 + i++ + if m.AllowTcp { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.AllowUnixSockets { + dAtA[i] = 0x18 + i++ + if m.AllowUnixSockets { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.AllowTerminal { + dAtA[i] = 0x20 + i++ + if m.AllowTerminal { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.FileLocks { + dAtA[i] = 0x28 + i++ + if m.FileLocks { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.EmptyNamespaces) > 0 { + for _, s := range m.EmptyNamespaces { + dAtA[i] = 0x32 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.ParentCheckpoint) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintExecution(dAtA, i, uint64(len(m.ParentCheckpoint))) + i += copy(dAtA[i:], m.ParentCheckpoint) + } + if m.Exit { + dAtA[i] = 0x40 + i++ + if m.Exit { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *CheckpointResponse) 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 *CheckpointResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Descriptors) > 0 { + for _, msg := range m.Descriptors { + dAtA[i] = 0xa + i++ + i = encodeVarintExecution(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + func encodeFixed64Execution(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1511,6 +1709,10 @@ func (m *CreateRequest) Size() (n int) { if m.Terminal { n += 2 } + if m.Checkpoint != nil { + l = m.Checkpoint.Size() + n += 1 + l + sovExecution(uint64(l)) + } return n } @@ -1736,6 +1938,53 @@ func (m *ProcessesResponse) Size() (n int) { return n } +func (m *CheckpointRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.AllowTcp { + n += 2 + } + if m.AllowUnixSockets { + n += 2 + } + if m.AllowTerminal { + n += 2 + } + if m.FileLocks { + n += 2 + } + if len(m.EmptyNamespaces) > 0 { + for _, s := range m.EmptyNamespaces { + l = len(s) + n += 1 + l + sovExecution(uint64(l)) + } + } + l = len(m.ParentCheckpoint) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.Exit { + n += 2 + } + return n +} + +func (m *CheckpointResponse) Size() (n int) { + var l int + _ = l + if len(m.Descriptors) > 0 { + for _, e := range m.Descriptors { + l = e.Size() + n += 1 + l + sovExecution(uint64(l)) + } + } + return n +} + func sovExecution(x uint64) (n int) { for { n++ @@ -1762,6 +2011,7 @@ func (this *CreateRequest) String() string { `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, + `Checkpoint:` + strings.Replace(fmt.Sprintf("%v", this.Checkpoint), "Descriptor", "containerd_v1_types2.Descriptor", 1) + `,`, `}`, }, "") return s @@ -1968,6 +2218,33 @@ func (this *ProcessesResponse) String() string { }, "") return s } +func (this *CheckpointRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CheckpointRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `AllowTcp:` + fmt.Sprintf("%v", this.AllowTcp) + `,`, + `AllowUnixSockets:` + fmt.Sprintf("%v", this.AllowUnixSockets) + `,`, + `AllowTerminal:` + fmt.Sprintf("%v", this.AllowTerminal) + `,`, + `FileLocks:` + fmt.Sprintf("%v", this.FileLocks) + `,`, + `EmptyNamespaces:` + fmt.Sprintf("%v", this.EmptyNamespaces) + `,`, + `ParentCheckpoint:` + fmt.Sprintf("%v", this.ParentCheckpoint) + `,`, + `Exit:` + fmt.Sprintf("%v", this.Exit) + `,`, + `}`, + }, "") + return s +} +func (this *CheckpointResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CheckpointResponse{`, + `Descriptors:` + strings.Replace(fmt.Sprintf("%v", this.Descriptors), "Descriptor", "containerd_v1_types2.Descriptor", 1) + `,`, + `}`, + }, "") + return s +} func valueToStringExecution(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2234,6 +2511,39 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } } m.Terminal = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Checkpoint == nil { + m.Checkpoint = &containerd_v1_types2.Descriptor{} + } + if err := m.Checkpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipExecution(dAtA[iNdEx:]) @@ -3878,6 +4188,324 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *CheckpointRequest) 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 ErrIntOverflowExecution + } + 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: CheckpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckpointRequest: 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 ErrIntOverflowExecution + } + 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 ErrInvalidLengthExecution + } + 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 AllowTcp", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowTcp = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUnixSockets", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowUnixSockets = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowTerminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowTerminal = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FileLocks", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.FileLocks = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmptyNamespaces", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + 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 ErrInvalidLengthExecution + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EmptyNamespaces = append(m.EmptyNamespaces, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentCheckpoint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + 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 ErrInvalidLengthExecution + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParentCheckpoint = github_com_opencontainers_go_digest.Digest(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exit", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Exit = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CheckpointResponse) 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 ErrIntOverflowExecution + } + 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: CheckpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Descriptors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Descriptors = append(m.Descriptors, &containerd_v1_types2.Descriptor{}) + if err := m.Descriptors[len(m.Descriptors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipExecution(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -3988,64 +4616,79 @@ func init() { } var fileDescriptorExecution = []byte{ - // 930 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0xf3, 0xc3, 0x9b, 0xbe, 0x34, 0x4b, 0x77, 0x54, 0x55, 0xc6, 0xa0, 0x24, 0x32, 0xbb, - 0x4b, 0x96, 0x83, 0x03, 0xe5, 0xb6, 0x02, 0xa4, 0xfe, 0x88, 0x96, 0xd5, 0xb2, 0x6c, 0x71, 0x91, - 0x38, 0x16, 0x37, 0x9e, 0x26, 0x23, 0x39, 0x1e, 0xe3, 0x19, 0x97, 0xe6, 0x06, 0x77, 0x0e, 0x1c, - 0xf9, 0x37, 0xf8, 0x2f, 0x7a, 0xe4, 0xc8, 0x69, 0x61, 0xf3, 0x97, 0xa0, 0xf1, 0x8c, 0x13, 0x3b, - 0xcd, 0xe0, 0xf6, 0x12, 0xcd, 0x7b, 0xf9, 0xde, 0xf8, 0x7b, 0x6f, 0xbe, 0xf9, 0x06, 0x5e, 0x4c, - 0x08, 0x9f, 0xa6, 0x17, 0xee, 0x98, 0xce, 0x86, 0x63, 0x1a, 0x71, 0x9f, 0x44, 0x38, 0x09, 0x8a, - 0x4b, 0x3f, 0x26, 0x43, 0x86, 0x93, 0x2b, 0x32, 0xc6, 0x6c, 0x88, 0xaf, 0xf1, 0x38, 0xe5, 0x84, - 0x46, 0xab, 0x95, 0x1b, 0x27, 0x94, 0x53, 0xb4, 0xbf, 0x2a, 0x71, 0xaf, 0x3e, 0x73, 0xf3, 0x0a, - 0xfb, 0x83, 0x09, 0xa5, 0x93, 0x10, 0x0f, 0x33, 0xd4, 0x45, 0x7a, 0x39, 0xc4, 0xb3, 0x98, 0xcf, - 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0x23, 0xeb, 0xe6, 0x5d, 0x77, 0xeb, 0xef, 0x77, 0xdd, 0xad, - 0x5f, 0x16, 0x5d, 0xe3, 0x66, 0xd1, 0x35, 0xfe, 0x5a, 0x74, 0x8d, 0x7f, 0x17, 0x5d, 0xe3, 0xc2, - 0xcc, 0xb8, 0x7c, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0x89, 0x1c, 0x40, 0x06, 0x0b, - 0x00, 0x00, + // 1173 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xae, 0x93, 0x34, 0x9b, 0x9c, 0x34, 0xdd, 0x74, 0x54, 0x55, 0xc6, 0x0b, 0x49, 0x64, 0xb6, + 0x4b, 0x5a, 0x81, 0x03, 0xe5, 0x6e, 0xc5, 0x8f, 0xfa, 0xc7, 0xb2, 0xda, 0xbf, 0xe2, 0x2e, 0xda, + 0xcb, 0xe0, 0xda, 0xd3, 0x74, 0x54, 0xc7, 0x63, 0x3c, 0xe3, 0x6e, 0x7b, 0xc7, 0x03, 0x70, 0xc1, + 0xab, 0xf0, 0x0a, 0x5c, 0xf5, 0x92, 0x4b, 0x84, 0x50, 0x61, 0xfb, 0x1e, 0x48, 0x68, 0xc6, 0x76, + 0xe2, 0xa4, 0x19, 0xdc, 0xde, 0x24, 0x73, 0x8e, 0xcf, 0x39, 0x3e, 0x7f, 0xf3, 0x7d, 0x86, 0x27, + 0x43, 0xc2, 0x4f, 0xe2, 0x23, 0xcb, 0xa5, 0xa3, 0xbe, 0x4b, 0x03, 0xee, 0x90, 0x00, 0x47, 0x5e, + 0xfe, 0xe8, 0x84, 0xa4, 0xcf, 0x70, 0x74, 0x46, 0x5c, 0xcc, 0xfa, 0xf8, 0x1c, 0xbb, 0x31, 0x27, + 0x34, 0x98, 0x9c, 0xac, 0x30, 0xa2, 0x9c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0x6f, 0x43, 0xf9, 0x80, 0x5f, 0x20, 0x53, 0x65, 0x3c, + 0x01, 0x77, 0x65, 0x91, 0xaf, 0x00, 0x26, 0xe0, 0x8c, 0x36, 0x94, 0xfb, 0x39, 0x0b, 0xe0, 0xca, + 0x80, 0xfb, 0xb0, 0x28, 0xe1, 0x5a, 0xbd, 0xba, 0x79, 0x34, 0x57, 0x86, 0x79, 0x02, 0xd5, 0x04, + 0xcd, 0xd5, 0xcd, 0x9f, 0x42, 0x7b, 0x65, 0xa0, 0x1f, 0xa0, 0x3e, 0x46, 0x70, 0xd4, 0x53, 0xe6, + 0x34, 0x43, 0x08, 0xc6, 0xc6, 0x2d, 0x2c, 0xd3, 0x29, 0xb8, 0x00, 0x39, 0x54, 0x52, 0xb7, 0x70, + 0x16, 0xf5, 0x8d, 0xcd, 0xdb, 0x98, 0x26, 0x2f, 0xd9, 0xd1, 0x2f, 0xdf, 0xb5, 0x17, 0xfe, 0x78, + 0xd7, 0x5e, 0xf8, 0xe9, 0xba, 0xad, 0x5d, 0x5e, 0xb7, 0xb5, 0xdf, 0xaf, 0xdb, 0xda, 0x3f, 0xd7, + 0x6d, 0xed, 0xa8, 0x2a, 0x0b, 0xfe, 0xfc, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x60, 0x79, 0x3f, + 0x8c, 0xac, 0x0d, 0x00, 0x00, } diff --git a/api/services/execution/execution.proto b/api/services/execution/execution.proto index f982609ca..7a3e3ca7f 100644 --- a/api/services/execution/execution.proto +++ b/api/services/execution/execution.proto @@ -7,6 +7,7 @@ import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "github.com/containerd/containerd/api/types/mount/mount.proto"; import "github.com/containerd/containerd/api/types/container/container.proto"; +import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; import "google/protobuf/timestamp.proto"; service ContainerService { @@ -23,6 +24,7 @@ service ContainerService { rpc Pause(PauseRequest) returns (google.protobuf.Empty); rpc Resume(ResumeRequest) returns (google.protobuf.Empty); rpc Processes(ProcessesRequest) returns (ProcessesResponse); + rpc Checkpoint(CheckpointRequest) returns (CheckpointResponse); } message CreateRequest { @@ -34,6 +36,7 @@ message CreateRequest { string stdout = 6; string stderr = 7; bool terminal = 8; + types.Descriptor checkpoint = 9; } message CreateResponse { @@ -118,3 +121,18 @@ message ProcessesRequest { message ProcessesResponse{ repeated containerd.v1.types.Process processes = 1; } + +message CheckpointRequest { + string id = 1; + bool allow_tcp = 2; + bool allow_unix_sockets = 3; + bool allow_terminal = 4; + bool file_locks = 5; + repeated string empty_namespaces = 6; + string parent_checkpoint = 7 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; + bool exit = 8; +} + +message CheckpointResponse { + repeated types.Descriptor descriptors = 1; +} diff --git a/api/services/shim/shim.pb.go b/api/services/shim/shim.pb.go index fa0f44e90..85b9ee30e 100644 --- a/api/services/shim/shim.pb.go +++ b/api/services/shim/shim.pb.go @@ -28,6 +28,7 @@ CloseStdinRequest ProcessesRequest ProcessesResponse + CheckpointRequest */ package shim @@ -68,15 +69,17 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type CreateRequest 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"` - 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_v1_types.Mount `protobuf:"bytes,9,rep,name=rootfs" json:"rootfs,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` + 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"` + 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_v1_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"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } @@ -236,6 +239,20 @@ func (m *ProcessesResponse) Reset() { *m = ProcessesResponse{ func (*ProcessesResponse) ProtoMessage() {} func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{18} } +type CheckpointRequest struct { + Exit bool `protobuf:"varint,1,opt,name=exit,proto3" json:"exit,omitempty"` + AllowTcp bool `protobuf:"varint,2,opt,name=allow_tcp,json=allowTcp,proto3" json:"allow_tcp,omitempty"` + AllowUnixSockets bool `protobuf:"varint,3,opt,name=allow_unix_sockets,json=allowUnixSockets,proto3" json:"allow_unix_sockets,omitempty"` + AllowTerminal bool `protobuf:"varint,4,opt,name=allow_terminal,json=allowTerminal,proto3" json:"allow_terminal,omitempty"` + FileLocks bool `protobuf:"varint,5,opt,name=file_locks,json=fileLocks,proto3" json:"file_locks,omitempty"` + EmptyNamespaces []string `protobuf:"bytes,6,rep,name=empty_namespaces,json=emptyNamespaces" json:"empty_namespaces,omitempty"` + Image string `protobuf:"bytes,7,opt,name=image,proto3" json:"image,omitempty"` +} + +func (m *CheckpointRequest) Reset() { *m = CheckpointRequest{} } +func (*CheckpointRequest) ProtoMessage() {} +func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{19} } + func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.shim.CreateRequest") proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.shim.CreateResponse") @@ -256,6 +273,7 @@ func init() { proto.RegisterType((*CloseStdinRequest)(nil), "containerd.v1.services.shim.CloseStdinRequest") proto.RegisterType((*ProcessesRequest)(nil), "containerd.v1.services.shim.ProcessesRequest") proto.RegisterType((*ProcessesResponse)(nil), "containerd.v1.services.shim.ProcessesResponse") + proto.RegisterType((*CheckpointRequest)(nil), "containerd.v1.services.shim.CheckpointRequest") } // Reference imports to suppress errors if they are not otherwise used. @@ -276,6 +294,7 @@ type ShimClient interface { 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) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) @@ -355,6 +374,15 @@ 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) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/Checkpoint", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + 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.v1.services.shim.Shim/Exit", in, out, c.cc, opts...) @@ -442,6 +470,7 @@ type ShimServer interface { 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 Kill(context.Context, *KillRequest) (*google_protobuf1.Empty, error) @@ -580,6 +609,24 @@ func _Shim_Resume_Handler(srv interface{}, ctx context.Context, dec func(interfa 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) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).Checkpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.shim.Shim/Checkpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).Checkpoint(ctx, req.(*CheckpointRequest)) + } + 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 { @@ -723,6 +770,10 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ MethodName: "Resume", Handler: _Shim_Resume_Handler, }, + { + MethodName: "Checkpoint", + Handler: _Shim_Checkpoint_Handler, + }, { MethodName: "Exit", Handler: _Shim_Exit_Handler, @@ -837,6 +888,18 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { i += n } } + if len(m.Checkpoint) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintShim(dAtA, i, uint64(len(m.Checkpoint))) + i += copy(dAtA[i:], m.Checkpoint) + } + if len(m.ParentCheckpoint) > 0 { + dAtA[i] = 0x5a + i++ + i = encodeVarintShim(dAtA, i, uint64(len(m.ParentCheckpoint))) + i += copy(dAtA[i:], m.ParentCheckpoint) + } return i, nil } @@ -1338,6 +1401,95 @@ func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *CheckpointRequest) 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 *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Exit { + dAtA[i] = 0x8 + i++ + if m.Exit { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.AllowTcp { + dAtA[i] = 0x10 + i++ + if m.AllowTcp { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.AllowUnixSockets { + dAtA[i] = 0x18 + i++ + if m.AllowUnixSockets { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.AllowTerminal { + dAtA[i] = 0x20 + i++ + if m.AllowTerminal { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.FileLocks { + dAtA[i] = 0x28 + i++ + if m.FileLocks { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.EmptyNamespaces) > 0 { + for _, s := range m.EmptyNamespaces { + dAtA[i] = 0x32 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Image) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintShim(dAtA, i, uint64(len(m.Image))) + i += copy(dAtA[i:], m.Image) + } + return i, nil +} + func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1404,6 +1556,14 @@ func (m *CreateRequest) Size() (n int) { n += 1 + l + sovShim(uint64(l)) } } + l = len(m.Checkpoint) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } + l = len(m.ParentCheckpoint) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } return n } @@ -1609,6 +1769,37 @@ func (m *ProcessesResponse) Size() (n int) { return n } +func (m *CheckpointRequest) Size() (n int) { + var l int + _ = l + if m.Exit { + n += 2 + } + if m.AllowTcp { + n += 2 + } + if m.AllowUnixSockets { + n += 2 + } + if m.AllowTerminal { + n += 2 + } + if m.FileLocks { + n += 2 + } + if len(m.EmptyNamespaces) > 0 { + for _, s := range m.EmptyNamespaces { + l = len(s) + n += 1 + l + sovShim(uint64(l)) + } + } + l = len(m.Image) + if l > 0 { + n += 1 + l + sovShim(uint64(l)) + } + return n +} + func sovShim(x uint64) (n int) { for { n++ @@ -1636,6 +1827,8 @@ func (this *CreateRequest) String() string { `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Rootfs:` + strings.Replace(fmt.Sprintf("%v", this.Rootfs), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `Checkpoint:` + fmt.Sprintf("%v", this.Checkpoint) + `,`, + `ParentCheckpoint:` + fmt.Sprintf("%v", this.ParentCheckpoint) + `,`, `}`, }, "") return s @@ -1829,6 +2022,22 @@ func (this *ProcessesResponse) String() string { }, "") return s } +func (this *CheckpointRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CheckpointRequest{`, + `Exit:` + fmt.Sprintf("%v", this.Exit) + `,`, + `AllowTcp:` + fmt.Sprintf("%v", this.AllowTcp) + `,`, + `AllowUnixSockets:` + fmt.Sprintf("%v", this.AllowUnixSockets) + `,`, + `AllowTerminal:` + fmt.Sprintf("%v", this.AllowTerminal) + `,`, + `FileLocks:` + fmt.Sprintf("%v", this.FileLocks) + `,`, + `EmptyNamespaces:` + fmt.Sprintf("%v", this.EmptyNamespaces) + `,`, + `Image:` + fmt.Sprintf("%v", this.Image) + `,`, + `}`, + }, "") + return s +} func valueToStringShim(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2111,6 +2320,64 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", 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.Checkpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentCheckpoint", 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.ParentCheckpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipShim(dAtA[iNdEx:]) @@ -3666,6 +3933,214 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *CheckpointRequest) 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: CheckpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exit", 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.Exit = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowTcp", 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.AllowTcp = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUnixSockets", 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.AllowUnixSockets = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowTerminal", 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.AllowTerminal = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FileLocks", 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.FileLocks = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmptyNamespaces", 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.EmptyNamespaces = append(m.EmptyNamespaces, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Image", 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.Image = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipShim(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthShim + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipShim(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -3776,65 +4251,76 @@ func init() { } var fileDescriptorShim = []byte{ - // 951 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0x5e, 0x27, 0xa9, 0x9b, 0xbe, 0xac, 0xbb, 0xbb, 0xa3, 0xaa, 0xf2, 0xa6, 0x28, 0x29, 0x96, - 0x10, 0xd9, 0x22, 0x1c, 0xc8, 0xde, 0x10, 0x1c, 0xda, 0x6d, 0x11, 0x0b, 0x8b, 0x88, 0xa6, 0x7b, - 0x43, 0xa2, 0x72, 0x93, 0x69, 0x32, 0xc8, 0xf6, 0x18, 0xcf, 0xb8, 0x6c, 0x6e, 0x9c, 0x39, 0x71, - 0xe5, 0xdf, 0xe1, 0xd4, 0x23, 0x47, 0x4e, 0x0b, 0xcd, 0x5f, 0x82, 0xe6, 0x87, 0x9d, 0xa4, 0xa9, - 0x93, 0xf4, 0x62, 0xcd, 0x7b, 0xfe, 0x66, 0xe6, 0x7b, 0xdf, 0xfb, 0x31, 0xf0, 0xd5, 0x88, 0x8a, - 0x71, 0x76, 0xe9, 0x0f, 0x58, 0xd4, 0x1d, 0xb0, 0x58, 0x04, 0x34, 0x26, 0xe9, 0x70, 0x7e, 0x19, - 0x24, 0xb4, 0xcb, 0x49, 0x7a, 0x4d, 0x07, 0x84, 0x77, 0xf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, 0x6b, - 0xde, 0xff, 0x90, 0x2a, 0xcc, 0x67, 0x96, 0x64, 0x27, 0xa7, 0xc1, 0x1a, 0x76, 0x73, 0x03, 0xa3, - 0x94, 0xdd, 0x8f, 0x32, 0x4e, 0x32, 0x58, 0x1b, 0x67, 0xf1, 0xc2, 0x35, 0x5f, 0x6c, 0x80, 0x34, - 0xe9, 0xfd, 0x1a, 0xaa, 0x7d, 0x31, 0x41, 0x1f, 0xaf, 0x4e, 0x6e, 0xf1, 0x74, 0x94, 0x92, 0x7c, - 0x0b, 0x30, 0x9b, 0x58, 0x68, 0x75, 0x91, 0x2d, 0x8d, 0xb6, 0xb2, 0x53, 0x4f, 0xdc, 0x9b, 0xdb, - 0xd6, 0xa3, 0x7f, 0x6e, 0x5b, 0x8f, 0x7e, 0x9b, 0xb6, 0xac, 0x9b, 0x69, 0xcb, 0xfa, 0x7b, 0xda, - 0xb2, 0xfe, 0x9b, 0xb6, 0xac, 0x4b, 0x5b, 0x21, 0x5f, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x26, - 0xfb, 0xd6, 0x0f, 0x06, 0x0b, 0x00, 0x00, + // 1125 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcb, 0x72, 0xe3, 0x44, + 0x17, 0x1e, 0xd9, 0x8e, 0xc7, 0x3e, 0x1e, 0xe7, 0xd2, 0x95, 0x4a, 0x69, 0x9c, 0xff, 0x77, 0x82, + 0xaa, 0xa6, 0x70, 0x32, 0x20, 0x43, 0x66, 0x47, 0xc1, 0x22, 0x37, 0x8a, 0x81, 0x00, 0xae, 0x4e, + 0x58, 0x51, 0x85, 0x4b, 0x91, 0x3b, 0x76, 0x13, 0x49, 0x2d, 0xd4, 0xad, 0x4c, 0xb2, 0xe3, 0x11, + 0xd8, 0xf2, 0x24, 0xec, 0x59, 0x65, 0xc9, 0x0e, 0x56, 0x03, 0x93,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0x85, 0xde, 0x4e, 0x00, 0xc6, 0xbb, 0x87, + 0x66, 0xe7, 0x75, 0x67, 0x49, 0x0b, 0xbd, 0x7e, 0x01, 0x15, 0x49, 0x68, 0xa8, 0x33, 0xd3, 0xdf, + 0x04, 0xe7, 0x15, 0x7a, 0xc2, 0x50, 0xd5, 0x2f, 0xc4, 0x9c, 0x6c, 0xa7, 0x9e, 0x91, 0xd6, 0xfd, + 0xff, 0x73, 0x14, 0xe6, 0x23, 0x4b, 0x46, 0x27, 0xf9, 0x75, 0x4e, 0x74, 0x13, 0x14, 0x5c, 0x18, + 0xdd, 0xf7, 0x32, 0x4f, 0xe2, 0xcf, 0xcd, 0x33, 0xff, 0xcf, 0xd0, 0xda, 0x7a, 0x00, 0xd2, 0x0c, + 0xcd, 0xe7, 0x50, 0xee, 0x89, 0x2b, 0xf4, 0xfe, 0xec, 0x91, 0xc9, 0x1f, 0xe3, 0x99, 0x2d, 0xce, + 0xdf, 0x80, 0x79, 0x2d, 0xbe, 0xfd, 0x58, 0x14, 0x79, 0xdd, 0xb3, 0xaf, 0xdf, 0xb5, 0x9f, 0xfc, + 0xf5, 0xae, 0xfd, 0xe4, 0xe7, 0x9b, 0xb6, 0x75, 0x7d, 0xd3, 0xb6, 0xfe, 0xb8, 0x69, 0x5b, 0xff, + 0xdc, 0xb4, 0xad, 0xd3, 0xaa, 0x42, 0xbe, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x44, 0x45, + 0xe4, 0xa5, 0x0c, 0x00, 0x00, } diff --git a/api/services/shim/shim.proto b/api/services/shim/shim.proto index 8c2afac04..62cbe5227 100644 --- a/api/services/shim/shim.proto +++ b/api/services/shim/shim.proto @@ -21,6 +21,7 @@ service Shim { 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); rpc Exit(ExitRequest) returns (google.protobuf.Empty); rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); @@ -40,6 +41,8 @@ message CreateRequest { string stdout = 7; string stderr = 8; repeated containerd.v1.types.Mount rootfs = 9; + string checkpoint = 10; + string parent_checkpoint = 11; } message CreateResponse { @@ -122,3 +125,13 @@ message ProcessesRequest { message ProcessesResponse{ repeated containerd.v1.types.Process processes = 1; } + +message CheckpointRequest { + bool exit = 1; + bool allow_tcp = 2; + bool allow_unix_sockets = 3; + bool allow_terminal = 4; + bool file_locks = 5; + repeated string empty_namespaces = 6; + string image = 7; +} diff --git a/api/types/container/container.pb.go b/api/types/container/container.pb.go index e9abe0b97..58c8cf640 100644 --- a/api/types/container/container.pb.go +++ b/api/types/container/container.pb.go @@ -19,8 +19,8 @@ package container import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" -import google_protobuf "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" +import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" import time "time" @@ -108,9 +108,10 @@ func (x Event_EventType) String() string { func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorContainer, []int{3, 0} } type Container struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` - Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` + Spec *google_protobuf1.Any `protobuf:"bytes,4,opt,name=spec" json:"spec,omitempty"` } func (m *Container) Reset() { *m = Container{} } @@ -118,15 +119,15 @@ func (*Container) ProtoMessage() {} func (*Container) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{0} } type Process struct { - Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` - Args []string `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` - Env []string `protobuf:"bytes,3,rep,name=env" json:"env,omitempty"` - User *User `protobuf:"bytes,4,opt,name=user" json:"user,omitempty"` - Cwd string `protobuf:"bytes,5,opt,name=cwd,proto3" json:"cwd,omitempty"` - Terminal bool `protobuf:"varint,6,opt,name=terminal,proto3" json:"terminal,omitempty"` - ExitStatus uint32 `protobuf:"varint,7,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` - RuntimeData *google_protobuf.Any `protobuf:"bytes,9,opt,name=runtime_data,json=runtimeData" json:"runtime_data,omitempty"` + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + Args []string `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` + Env []string `protobuf:"bytes,3,rep,name=env" json:"env,omitempty"` + User *User `protobuf:"bytes,4,opt,name=user" json:"user,omitempty"` + Cwd string `protobuf:"bytes,5,opt,name=cwd,proto3" json:"cwd,omitempty"` + Terminal bool `protobuf:"varint,6,opt,name=terminal,proto3" json:"terminal,omitempty"` + ExitStatus uint32 `protobuf:"varint,7,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` + RuntimeData *google_protobuf1.Any `protobuf:"bytes,9,opt,name=runtime_data,json=runtimeData" json:"runtime_data,omitempty"` } func (m *Process) Reset() { *m = Process{} } @@ -194,6 +195,16 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintContainer(dAtA, i, uint64(m.Status)) } + if m.Spec != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintContainer(dAtA, i, uint64(m.Spec.Size())) + n1, err := m.Spec.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } return i, nil } @@ -251,11 +262,11 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x22 i++ i = encodeVarintContainer(dAtA, i, uint64(m.User.Size())) - n1, err := m.User.MarshalTo(dAtA[i:]) + n2, err := m.User.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n1 + i += n2 } if len(m.Cwd) > 0 { dAtA[i] = 0x2a @@ -287,11 +298,11 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x4a i++ i = encodeVarintContainer(dAtA, i, uint64(m.RuntimeData.Size())) - n2, err := m.RuntimeData.MarshalTo(dAtA[i:]) + n3, err := m.RuntimeData.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n2 + i += n3 } return i, nil } @@ -322,21 +333,21 @@ func (m *User) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintContainer(dAtA, i, uint64(m.Gid)) } if len(m.AdditionalGids) > 0 { - dAtA4 := make([]byte, len(m.AdditionalGids)*10) - var j3 int + dAtA5 := make([]byte, len(m.AdditionalGids)*10) + var j4 int for _, num := range m.AdditionalGids { for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j3++ + j4++ } - dAtA4[j3] = uint8(num) - j3++ + dAtA5[j4] = uint8(num) + j4++ } dAtA[i] = 0x1a i++ - i = encodeVarintContainer(dAtA, i, uint64(j3)) - i += copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintContainer(dAtA, i, uint64(j4)) + i += copy(dAtA[i:], dAtA5[:j4]) } return i, nil } @@ -380,11 +391,11 @@ func (m *Event) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2a i++ i = encodeVarintContainer(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) - n5, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + n6, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n6 return i, nil } @@ -428,6 +439,10 @@ func (m *Container) Size() (n int) { if m.Status != 0 { n += 1 + sovContainer(uint64(m.Status)) } + if m.Spec != nil { + l = m.Spec.Size() + n += 1 + l + sovContainer(uint64(l)) + } return n } @@ -534,6 +549,7 @@ func (this *Container) String() string { `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") return s @@ -551,7 +567,7 @@ func (this *Process) String() string { `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `RuntimeData:` + strings.Replace(fmt.Sprintf("%v", this.RuntimeData), "Any", "google_protobuf.Any", 1) + `,`, + `RuntimeData:` + strings.Replace(fmt.Sprintf("%v", this.RuntimeData), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") return s @@ -686,6 +702,39 @@ func (m *Container) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Spec == nil { + m.Spec = &google_protobuf1.Any{} + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipContainer(dAtA[iNdEx:]) @@ -960,7 +1009,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.RuntimeData == nil { - m.RuntimeData = &google_protobuf.Any{} + m.RuntimeData = &google_protobuf1.Any{} } if err := m.RuntimeData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1413,48 +1462,49 @@ func init() { } var fileDescriptorContainer = []byte{ - // 680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4d, 0x6f, 0xd3, 0x4a, - 0x14, 0x8d, 0x3f, 0xf2, 0x35, 0x69, 0xf3, 0xfc, 0xe6, 0x55, 0x4f, 0x6e, 0x40, 0x8e, 0x15, 0x21, - 0x11, 0x21, 0xe1, 0x88, 0x74, 0x01, 0xdb, 0x34, 0xb6, 0xaa, 0x0a, 0x91, 0x04, 0x27, 0x11, 0xdd, - 0x45, 0xd3, 0x78, 0x30, 0x03, 0xcd, 0xd8, 0xb2, 0xc7, 0x2d, 0xd9, 0xb1, 0x44, 0x5d, 0xf1, 0x07, - 0xba, 0x01, 0xb6, 0x6c, 0x59, 0xf0, 0x0b, 0xba, 0x64, 0xc9, 0xaa, 0xd0, 0xfc, 0x12, 0x34, 0xe3, - 0xa4, 0x8e, 0xda, 0x22, 0xb1, 0xb1, 0xce, 0xdc, 0x73, 0xe6, 0xce, 0x3d, 0xf7, 0x18, 0xd8, 0x3e, - 0x61, 0xaf, 0x92, 0x43, 0x6b, 0x1a, 0xcc, 0x5a, 0xd3, 0x80, 0x32, 0x44, 0x28, 0x8e, 0xbc, 0x75, - 0x88, 0x42, 0xd2, 0x62, 0xf3, 0x10, 0xc7, 0x59, 0x31, 0x43, 0x56, 0x18, 0x05, 0x2c, 0x80, 0xff, - 0x65, 0x7a, 0xeb, 0xf8,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, 0xaf, 0x6b, 0x9e, 0x04, 0x00, 0x00, + // 694 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xbf, 0x6f, 0xdb, 0x46, + 0x18, 0xd5, 0x91, 0xd4, 0xaf, 0x93, 0xad, 0xb2, 0x57, 0xa3, 0xa0, 0xd5, 0x82, 0x22, 0x84, 0x02, + 0x15, 0x0a, 0x94, 0x42, 0xe5, 0xa1, 0x5d, 0x65, 0x91, 0x30, 0x8c, 0x22, 0x92, 0x42, 0x49, 0x88, + 0x37, 0xe1, 0x2c, 0x5e, 0x18, 0x22, 0xd6, 0x91, 0x20, 0x8f, 0x76, 0xb4, 0x65, 0x0c, 0x3c, 0x65, + 0xc8, 0xea, 0x25, 0xc9, 0x9a, 0x35, 0x43, 0xfe, 0x02, 0x8f, 0x19, 0x33, 0x39, 0xb1, 0xfe, 0x92, + 0xe0, 0x8e, 0x94, 0x29, 0xd8, 0x4e, 0x90, 0x85, 0x78, 0x77, 0xef, 0xf1, 0xfb, 0xde, 0xf7, 0xbe, + 0x83, 0x96, 0xe7, 0xb3, 0x27, 0xc9, 0xb1, 0x39, 0x0f, 0x16, 0x9d, 0x79, 0x40, 0x19, 0xf6, 0x29, + 0x89, 0xdc, 0x4d, 0x88, 0x43, 0xbf, 0xc3, 0x96, 0x21, 0x89, 0xf3, 0xcb, 0x1c, 0x99, 0x61, 0x14, + 0xb0, 0x00, 0xfd, 0x92, 0xeb, 0xcd, 0xd3, 0x7f, 0x4c, 0x21, 0x6f, 0xec, 0x78, 0x81, 0x17, 0x08, + 0xbe, 0xc3, 0x51, 0x2a, 0x6d, 0xec, 0x7a, 0x41, 0xe0, 0x9d, 0x90, 0x8e, 0x38, 0x1d, 0x27, 0x8f, + 0x3b, 0x98, 0x2e, 0x33, 0xaa, 0x79, 0x9b, 0x62, 0xfe, 0x82, 0xc4, 0x0c, 0x2f, 0xc2, 0x54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a, 0x96, 0x65, 0x5b, 0xaa, + 0xc2, 0x65, 0xa3, 0xde, 0x74, 0x6c, 0x5b, 0x6a, 0xf1, 0xaf, 0xf7, 0x00, 0x96, 0x32, 0x83, 0x3a, + 0x2c, 0x4f, 0x07, 0xff, 0x0f, 0x86, 0x8f, 0x06, 0x6a, 0xa1, 0xf1, 0xf3, 0xf9, 0x85, 0xb1, 0x9d, + 0x12, 0x53, 0xfa, 0x94, 0x06, 0x67, 0x94, 0xf3, 0x69, 0x75, 0x4b, 0x05, 0x9b, 0x7c, 0x3f, 0x22, + 0x98, 0x11, 0x97, 0xf3, 0xce, 0x74, 0x30, 0x38, 0x1c, 0x1c, 0xa8, 0xd2, 0x26, 0xef, 0x24, 0x94, + 0xfa, 0xd4, 0xe3, 0xfc, 0x78, 0x32, 0x1c, 0x8d, 0x6c, 0x4b, 0x95, 0x37, 0xf9, 0x31, 0x0b, 0xc2, + 0x90, 0xb8, 0xe8, 0xf7, 0x1b, 0x5b, 0x4a, 0x43, 0x3d, 0xbf, 0x30, 0xb6, 0x52, 0x7a, 0x84, 0x93, + 0x98, 0xb8, 0x8d, 0xfa, 0x8b, 0x37, 0x7a, 0xe1, 0xc3, 0x5b, 0x3d, 0x73, 0xbb, 0xaf, 0x5d, 0x5e, + 0xeb, 0x85, 0x4f, 0xd7, 0x7a, 0xe1, 0xf9, 0x4a, 0x07, 0x97, 0x2b, 0x1d, 0x7c, 0x5c, 0xe9, 0xe0, + 0xcb, 0x4a, 0x07, 0xc7, 0x25, 0x91, 0xe6, 0xde, 0xd7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0x6e, + 0xa4, 0xd7, 0xc9, 0x04, 0x00, 0x00, } diff --git a/api/types/container/container.proto b/api/types/container/container.proto index e098f5e66..a5efa4090 100644 --- a/api/types/container/container.proto +++ b/api/types/container/container.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package containerd.v1.types; -import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; enum Status { @@ -21,6 +21,7 @@ message Container { string id = 1; uint32 pid = 2; Status status = 3; + google.protobuf.Any spec = 4; } message Process { diff --git a/cmd/ctr/checkpoint.go b/cmd/ctr/checkpoint.go new file mode 100644 index 000000000..65065bb31 --- /dev/null +++ b/cmd/ctr/checkpoint.go @@ -0,0 +1,196 @@ +package main + +import ( + "bytes" + gocontext "context" + "encoding/json" + "fmt" + "io" + "runtime" + + "github.com/Sirupsen/logrus" + "github.com/containerd/containerd/api/services/execution" + "github.com/containerd/containerd/api/types/descriptor" + "github.com/containerd/containerd/archive" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/rootfs" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/pkg/errors" + "github.com/urfave/cli" +) + +var checkpointCommand = cli.Command{ + Name: "checkpoint", + Usage: "checkpoint a container", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "id", + Usage: "id of the container", + }, + cli.BoolFlag{ + Name: "exit", + Usage: "stop the container after the checkpoint", + }, + cli.BoolFlag{ + Name: "binds", + Usage: "checkpoint bind mounts with the checkpoint", + }, + }, + Action: func(context *cli.Context) error { + var ( + id = context.String("id") + ctx = gocontext.Background() + ) + if id == "" { + return errors.New("container id must be provided") + } + containers, err := getExecutionService(context) + if err != nil { + return err + } + content, err := getContentStore(context) + if err != nil { + return err + } + imageStore, err := getImageStore(context) + if err != nil { + return errors.Wrap(err, "failed resolving image store") + } + var spec specs.Spec + info, err := containers.Info(ctx, &execution.InfoRequest{ + ID: id, + }) + if err != nil { + return err + } + if err := json.Unmarshal(info.Spec.Value, &spec); err != nil { + return err + } + stopped := context.Bool("exit") + // if the container will still be running after the checkpoint make sure that + // we pause the container and give us time to checkpoint the filesystem before + // it resumes execution + if !stopped { + if _, err := containers.Pause(ctx, &execution.PauseRequest{ + ID: id, + }); err != nil { + return err + } + defer func() { + if _, err := containers.Resume(ctx, &execution.ResumeRequest{ + ID: id, + }); err != nil { + logrus.WithError(err).Error("ctr: unable to resume container") + } + }() + } + checkpoint, err := containers.Checkpoint(ctx, &execution.CheckpointRequest{ + ID: id, + Exit: context.Bool("exit"), + }) + if err != nil { + return err + } + image, err := imageStore.Get(ctx, spec.Annotations["image"]) + if err != nil { + return err + } + var additionalDescriptors []*descriptor.Descriptor + if context.Bool("binds") { + if additionalDescriptors, err = checkpointBinds(ctx, &spec, content); err != nil { + return err + } + } + var index ocispec.ImageIndex + for _, d := range append(checkpoint.Descriptors, additionalDescriptors...) { + index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ + Descriptor: ocispec.Descriptor{ + MediaType: d.MediaType, + Size: d.Size_, + Digest: d.Digest, + }, + Platform: ocispec.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + }, + }) + } + // add image to the index + index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ + Descriptor: image.Target, + }) + // checkpoint rw layer + snapshotter, err := getSnapshotter(context) + if err != nil { + return err + } + differ, err := getDiffService(context) + if err != nil { + return err + } + rw, err := rootfs.Diff(ctx, id, fmt.Sprintf("checkpoint-rw-%s", id), snapshotter, differ) + if err != nil { + return err + } + index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ + Descriptor: rw, + Platform: ocispec.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + }, + }) + data, err := json.Marshal(index) + if err != nil { + return err + } + // write the index to the content store + buf := bytes.NewReader(data) + desc, err := writeContent(ctx, content, ocispec.MediaTypeImageIndex, id, buf) + if err != nil { + return err + } + fmt.Println(desc.Digest.String()) + return nil + }, +} + +func checkpointBinds(ctx gocontext.Context, s *specs.Spec, store content.Store) ([]*descriptor.Descriptor, error) { + var out []*descriptor.Descriptor + for _, m := range s.Mounts { + if m.Type != "bind" { + continue + } + tar := archive.Diff(ctx, "", m.Source) + d, err := writeContent(ctx, store, images.MediaTypeContainerd1Resource, m.Source, tar) + if err := tar.Close(); err != nil { + return nil, err + } + if err != nil { + return nil, err + } + out = append(out, d) + } + return out, nil +} + +func writeContent(ctx gocontext.Context, store content.Store, mediaType, ref string, r io.Reader) (*descriptor.Descriptor, error) { + writer, err := store.Writer(ctx, ref, 0, "") + if err != nil { + return nil, err + } + defer writer.Close() + size, err := io.Copy(writer, r) + if err != nil { + return nil, err + } + if err := writer.Commit(0, ""); err != nil { + return nil, err + } + return &descriptor.Descriptor{ + MediaType: mediaType, + Digest: writer.Digest(), + Size_: size, + }, nil +} diff --git a/cmd/ctr/main.go b/cmd/ctr/main.go index 5e08b39f8..84bc711b0 100644 --- a/cmd/ctr/main.go +++ b/cmd/ctr/main.go @@ -51,6 +51,7 @@ containerd client }, } app.Commands = []cli.Command{ + checkpointCommand, runCommand, eventsCommand, deleteCommand, diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index 53bf6054a..8ca6f0abb 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -4,6 +4,7 @@ import ( gocontext "context" "encoding/json" "fmt" + "io/ioutil" "os" "runtime" @@ -11,9 +12,9 @@ import ( "github.com/containerd/console" "github.com/containerd/containerd" "github.com/containerd/containerd/api/services/execution" - mounttypes "github.com/containerd/containerd/api/types/mount" "github.com/containerd/containerd/images" "github.com/containerd/containerd/snapshot" + digest "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/identity" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -55,8 +56,12 @@ var runCommand = cli.Command{ Usage: "enable host networking for the container", }, cli.BoolFlag{ - Name: "keep", - Usage: "keep container after running", + Name: "rm", + Usage: "remove the container after running", + }, + cli.StringFlag{ + Name: "checkpoint", + Usage: "provide the checkpoint digest to restore the container", }, }, Action: func(context *cli.Context) error { @@ -94,82 +99,137 @@ var runCommand = cli.Command{ if err != nil { return err } - imageStore, err := getImageStore(context) if err != nil { return errors.Wrap(err, "failed resolving image store") } - - if runtime.GOOS != "windows" && context.String("rootfs") == "" { - ref := context.Args().First() - - image, err := imageStore.Get(ctx, ref) - if err != nil { - return errors.Wrapf(err, "could not resolve %q", ref) + differ, err := getDiffService(context) + if err != nil { + return err + } + var ( + checkpoint *ocispec.Descriptor + checkpointIndex digest.Digest + ref = context.Args().First() + ) + if raw := context.String("checkpoint"); raw != "" { + if checkpointIndex, err = digest.Parse(raw); err != nil { + return err } - // let's close out our db and tx so we don't hold the lock whilst running. - - diffIDs, err := image.RootFS(ctx, content) + } + var spec []byte + if checkpointIndex != "" { + var index ocispec.ImageIndex + r, err := content.Reader(ctx, checkpointIndex) if err != nil { return err } - - if context.Bool("readonly") { - mounts, err = snapshotter.View(ctx, id, identity.ChainID(diffIDs).String()) - } else { - mounts, err = snapshotter.Prepare(ctx, id, identity.ChainID(diffIDs).String()) - } + err = json.NewDecoder(r).Decode(&index) + r.Close() if err != nil { - if !snapshot.IsExist(err) { - return err + return err + } + var rw ocispec.Descriptor + for _, m := range index.Manifests { + switch m.MediaType { + case images.MediaTypeContainerd1Checkpoint: + fkingo := m.Descriptor + checkpoint = &fkingo + case images.MediaTypeContainerd1CheckpointConfig: + if r, err = content.Reader(ctx, m.Digest); err != nil { + return err + } + spec, err = ioutil.ReadAll(r) + r.Close() + if err != nil { + return err + } + case images.MediaTypeDockerSchema2Manifest: + // make sure we have the original image that was used during checkpoint + diffIDs, err := images.RootFS(ctx, content, m.Descriptor) + if err != nil { + return err + } + if _, err := snapshotter.Prepare(ctx, id, identity.ChainID(diffIDs).String()); err != nil { + if !snapshot.IsExist(err) { + return err + } + } + case ocispec.MediaTypeImageLayer: + rw = m.Descriptor } - mounts, err = snapshotter.Mounts(ctx, id) + } + if mounts, err = snapshotter.Mounts(ctx, id); err != nil { + return err + } + if _, err := differ.Apply(ctx, rw, mounts); err != nil { + return err + } + } else { + if runtime.GOOS != "windows" && context.String("rootfs") == "" { + image, err := imageStore.Get(ctx, ref) + if err != nil { + return errors.Wrapf(err, "could not resolve %q", ref) + } + // let's close out our db and tx so we don't hold the lock whilst running. + diffIDs, err := image.RootFS(ctx, content) if err != nil { return err } - } else { + if context.Bool("readonly") { + mounts, err = snapshotter.View(ctx, id, identity.ChainID(diffIDs).String()) + } else { + mounts, err = snapshotter.Prepare(ctx, id, identity.ChainID(diffIDs).String()) + } defer func() { - if id != "" { + if err != nil || context.Bool("rm") { if err := snapshotter.Remove(ctx, id); err != nil { logrus.WithError(err).Errorf("failed to remove snapshot %q", id) } } }() - } - - ic, err := image.Config(ctx, content) - if err != nil { - return err - } - switch ic.MediaType { - case ocispec.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config: - r, err := content.Reader(ctx, ic.Digest) + if err != nil { + if !snapshot.IsExist(err) { + return err + } + mounts, err = snapshotter.Mounts(ctx, id) + if err != nil { + return err + } + } + ic, err := image.Config(ctx, content) if err != nil { return err } - if err := json.NewDecoder(r).Decode(&imageConfig); err != nil { + switch ic.MediaType { + case ocispec.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config: + r, err := content.Reader(ctx, ic.Digest) + if err != nil { + return err + } + if err := json.NewDecoder(r).Decode(&imageConfig); err != nil { + r.Close() + return err + } r.Close() - return err + default: + return fmt.Errorf("unknown image config media type %s", ic.MediaType) } - r.Close() - default: - return fmt.Errorf("unknown image config media type %s", ic.MediaType) + } else { + // TODO: get the image / rootfs through the API once windows has a snapshotter } - } else { - // TODO: get the image / rootfs through the API once windows has a snapshotter } - - create, err := newCreateRequest(context, &imageConfig.Config, id, tmpDir, context.String("rootfs")) if err != nil { return err } - for _, m := range mounts { - create.Rootfs = append(create.Rootfs, &mounttypes.Mount{ - Type: m.Type, - Source: m.Source, - Options: m.Options, - }) - + if len(spec) == 0 { + if spec, err = newSpec(context, &imageConfig.Config, ref); err != nil { + return err + } + } + create, err := newCreateRequest(context, id, tmpDir, checkpoint, mounts, spec) + if err != nil { + return err } var con console.Console if create.Terminal { @@ -179,7 +239,6 @@ var runCommand = cli.Command{ return err } } - fwg, err := prepareStdio(create.Stdin, create.Stdout, create.Stderr, create.Terminal) if err != nil { return err @@ -188,35 +247,33 @@ var runCommand = cli.Command{ if err != nil { return err } + pid := response.Pid if create.Terminal { - if err := handleConsoleResize(ctx, containers, response.ID, response.Pid, con); err != nil { + if err := handleConsoleResize(ctx, containers, id, pid, con); err != nil { logrus.WithError(err).Error("console resize") } } else { sigc := forwardAllSignals(containers, id) defer stopCatch(sigc) } - if _, err := containers.Start(ctx, &execution.StartRequest{ - ID: response.ID, - }); err != nil { - return err + if checkpoint == nil { + if _, err := containers.Start(ctx, &execution.StartRequest{ + ID: id, + }); err != nil { + return err + } } // Ensure we read all io only if container started successfully. defer fwg.Wait() - status, err := waitContainer(events, response.ID, response.Pid) + status, err := waitContainer(events, id, pid) if err != nil { return err } - if !context.Bool("keep") { - if _, err := containers.Delete(ctx, &execution.DeleteRequest{ - ID: response.ID, - }); err != nil { - return err - } - } else { - // Don't remove snapshot - id = "" + if _, err := containers.Delete(ctx, &execution.DeleteRequest{ + ID: response.ID, + }); err != nil { + return err } if status != 0 { return cli.NewExitError("", int(status)) diff --git a/cmd/ctr/run_unix.go b/cmd/ctr/run_unix.go index a26eb73be..967930f97 100644 --- a/cmd/ctr/run_unix.go +++ b/cmd/ctr/run_unix.go @@ -18,7 +18,10 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/console" + "github.com/containerd/containerd" "github.com/containerd/containerd/api/services/execution" + "github.com/containerd/containerd/api/types/descriptor" + "github.com/containerd/containerd/api/types/mount" protobuf "github.com/gogo/protobuf/types" ocispec "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/runtime-spec/specs-go" @@ -254,20 +257,24 @@ func getConfig(context *cli.Context, imageConfig *ocispec.ImageConfig, rootfs st return customSpec(config, rootfs) } -func newCreateRequest(context *cli.Context, imageConfig *ocispec.ImageConfig, id, tmpDir string, rootfs string) (*execution.CreateRequest, error) { - s, err := getConfig(context, imageConfig, rootfs) +func newSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) ([]byte, error) { + s, err := getConfig(context, config, context.String("rootfs")) if err != nil { return nil, err } - data, err := json.Marshal(s) - if err != nil { - return nil, err + if s.Annotations == nil { + s.Annotations = make(map[string]string) } + s.Annotations["image"] = imageRef + return json.Marshal(s) +} + +func newCreateRequest(context *cli.Context, id, tmpDir string, checkpoint *ocispec.Descriptor, mounts []containerd.Mount, spec []byte) (*execution.CreateRequest, error) { create := &execution.CreateRequest{ ID: id, Spec: &protobuf.Any{ TypeUrl: specs.Version, - Value: data, + Value: spec, }, Runtime: context.String("runtime"), Terminal: context.Bool("tty"), @@ -275,7 +282,20 @@ func newCreateRequest(context *cli.Context, imageConfig *ocispec.ImageConfig, id Stdout: filepath.Join(tmpDir, "stdout"), Stderr: filepath.Join(tmpDir, "stderr"), } - + if checkpoint != nil { + create.Checkpoint = &descriptor.Descriptor{ + MediaType: checkpoint.MediaType, + Size_: checkpoint.Size, + Digest: checkpoint.Digest, + } + } + for _, m := range mounts { + create.Rootfs = append(create.Rootfs, &mount.Mount{ + Type: m.Type, + Source: m.Source, + Options: m.Options, + }) + } return create, nil } diff --git a/cmd/ctr/run_windows.go b/cmd/ctr/run_windows.go index 6782a1df8..e028a8bd0 100644 --- a/cmd/ctr/run_windows.go +++ b/cmd/ctr/run_windows.go @@ -10,6 +10,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/console" + "github.com/containerd/containerd" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/log" "github.com/containerd/containerd/windows" @@ -116,12 +117,15 @@ func getConfig(context *cli.Context, imageConfig *ocispec.ImageConfig, rootfs st return s, nil } -func newCreateRequest(context *cli.Context, imageConfig *ocispec.ImageConfig, id, tmpDir, rootfs string) (*execution.CreateRequest, error) { - spec, err := getConfig(context, imageConfig, rootfs) +func newSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) ([]byte, error) { + spec, err := getConfig(context, config, context.String("rootfs")) if err != nil { return nil, err } - + if spec.Annotations == nil { + spec.Annotations = make(map[string]string) + } + spec.Annotations["image"] = imageRef rtSpec := windows.RuntimeSpec{ OCISpec: *spec, Configuration: hcs.Configuration{ @@ -129,16 +133,15 @@ func newCreateRequest(context *cli.Context, imageConfig *ocispec.ImageConfig, id IgnoreFlushesDuringBoot: true, AllowUnqualifiedDNSQuery: true}, } + return json.Marshal(rtSpec) +} - data, err := json.Marshal(rtSpec) - if err != nil { - return nil, err - } +func newCreateRequest(context *cli.Context, id, tmpDir string, checkpoint *ocispec.Descriptor, mounts []containerd.Mount, spec []byte) (*execution.CreateRequest, error) { create := &execution.CreateRequest{ ID: id, Spec: &protobuf.Any{ TypeUrl: specs.Version, - Value: data, + Value: spec, }, Runtime: context.String("runtime"), Terminal: context.Bool("tty"), @@ -148,7 +151,6 @@ func newCreateRequest(context *cli.Context, imageConfig *ocispec.ImageConfig, id if !create.Terminal { create.Stderr = fmt.Sprintf(`%s\ctr-%s-stderr`, pipeRoot, id) } - return create, nil } diff --git a/images/image.go b/images/image.go index 832b4412f..c1ff32cb2 100644 --- a/images/image.go +++ b/images/image.go @@ -7,7 +7,6 @@ import ( "io/ioutil" "github.com/containerd/containerd/content" - "github.com/containerd/containerd/log" digest "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) @@ -66,25 +65,7 @@ func (image *Image) RootFS(ctx context.Context, provider content.Provider) ([]di if err != nil { return nil, err } - - p, err := content.ReadBlob(ctx, provider, desc.Digest) - if err != nil { - log.G(ctx).Fatal(err) - } - - var config ocispec.Image - if err := json.Unmarshal(p, &config); err != nil { - log.G(ctx).Fatal(err) - } - - // TODO(stevvooe): Remove this bit when OCI structure uses correct type for - // rootfs.DiffIDs. - var diffIDs []digest.Digest - for _, diffID := range config.RootFS.DiffIDs { - diffIDs = append(diffIDs, digest.Digest(diffID)) - } - - return diffIDs, nil + return RootFS(ctx, provider, desc) } // Size returns the total size of an image's packed resources. @@ -123,3 +104,28 @@ func (image *Image) Size(ctx context.Context, provider content.Provider) (int64, }), image.Target) } + +// RootFS returns the unpacked diffids that make up and images rootfs. +// +// These are used to verify that a set of layers unpacked to the expected +// values. +func RootFS(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) ([]digest.Digest, error) { + p, err := content.ReadBlob(ctx, provider, desc.Digest) + if err != nil { + return nil, err + } + + var config ocispec.Image + if err := json.Unmarshal(p, &config); err != nil { + return nil, err + } + + // TODO(stevvooe): Remove this bit when OCI structure uses correct type for + // rootfs.DiffIDs. + var diffIDs []digest.Digest + for _, diffID := range config.RootFS.DiffIDs { + diffIDs = append(diffIDs, digest.Digest(diffID)) + } + + return diffIDs, nil +} diff --git a/images/mediatypes.go b/images/mediatypes.go index f7cfe0953..7b75b8aff 100644 --- a/images/mediatypes.go +++ b/images/mediatypes.go @@ -10,4 +10,10 @@ const ( MediaTypeDockerSchema2Config = "application/vnd.docker.container.image.v1+json" MediaTypeDockerSchema2Manifest = "application/vnd.docker.distribution.manifest.v2+json" MediaTypeDockerSchema2ManifestList = "application/vnd.docker.distribution.manifest.list.v2+json" + // Checkpoint/Restore Media Types + MediaTypeContainerd1Checkpoint = "application/vnd.containerd.container.criu.checkpoint.criu.tar" + MediaTypeContainerd1CheckpointPreDump = "application/vnd.containerd.container.criu.checkpoint.predump.tar" + MediaTypeContainerd1Resource = "application/vnd.containerd.container.resource.tar" + MediaTypeContainerd1RW = "application/vnd.containerd.container.rw.tar" + MediaTypeContainerd1CheckpointConfig = "application/vnd.containerd.container.checkpoint.config.v1+json" ) diff --git a/linux/container.go b/linux/container.go index 3939bee7b..e31dc3dd7 100644 --- a/linux/container.go +++ b/linux/container.go @@ -25,15 +25,17 @@ func (s State) Status() plugin.Status { return s.status } -func newContainer(id string, shim shim.ShimClient) *Container { +func newContainer(id string, spec []byte, shim shim.ShimClient) *Container { return &Container{ id: id, shim: shim, + spec: spec, } } type Container struct { - id string + id string + spec []byte shim shim.ShimClient } @@ -42,6 +44,7 @@ func (c *Container) Info() plugin.ContainerInfo { return plugin.ContainerInfo{ ID: c.id, Runtime: runtimeName, + Spec: c.spec, } } @@ -148,6 +151,19 @@ func (c *Container) CloseStdin(ctx context.Context, pid uint32) error { return err } +func (c *Container) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) error { + _, err := c.shim.Checkpoint(ctx, &shim.CheckpointRequest{ + Exit: opts.Exit, + AllowTcp: opts.AllowTCP, + AllowUnixSockets: opts.AllowUnixSockets, + AllowTerminal: opts.AllowTerminal, + FileLocks: opts.FileLocks, + EmptyNamespaces: opts.EmptyNamespaces, + Image: opts.Path, + }) + return err +} + type Process struct { pid int c *Container diff --git a/linux/runtime.go b/linux/runtime.go index 6552b6927..68f92ce77 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -13,7 +13,6 @@ import ( "strings" "time" - "github.com/containerd/containerd" "github.com/containerd/containerd/api/services/shim" "github.com/containerd/containerd/api/types/container" "github.com/containerd/containerd/api/types/mount" @@ -65,7 +64,7 @@ func New(ic *plugin.InitContext) (interface{}, error) { remote: !cfg.NoShim, shim: cfg.Shim, runtime: cfg.Runtime, - events: make(chan *containerd.Event, 2048), + events: make(chan *plugin.Event, 2048), eventsContext: c, eventsCancel: cancel, monitor: ic.Monitor, @@ -81,7 +80,7 @@ type Runtime struct { runtime string remote bool - events chan *containerd.Event + events chan *plugin.Event eventsContext context.Context eventsCancel func() monitor plugin.ContainerMonitor @@ -108,13 +107,14 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) return nil, err } sopts := &shim.CreateRequest{ - ID: id, - Bundle: path, - Runtime: r.runtime, - Stdin: opts.IO.Stdin, - Stdout: opts.IO.Stdout, - Stderr: opts.IO.Stderr, - Terminal: opts.IO.Terminal, + ID: id, + Bundle: path, + Runtime: r.runtime, + Stdin: opts.IO.Stdin, + Stdout: opts.IO.Stdout, + Stderr: opts.IO.Stderr, + Terminal: opts.IO.Terminal, + Checkpoint: opts.Checkpoint, } for _, m := range opts.Rootfs { sopts.Rootfs = append(sopts.Rootfs, &mount.Mount{ @@ -127,8 +127,8 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) os.RemoveAll(path) return nil, err } - c := newContainer(id, s) - // after the container is create add it to the monitor + c := newContainer(id, opts.Spec, s) + // after the container is created, add it to the monitor if err = r.monitor.Monitor(c); err != nil { return nil, err } @@ -182,7 +182,7 @@ func (r *Runtime) Containers(ctx context.Context) ([]plugin.Container, error) { return o, nil } -func (r *Runtime) Events(ctx context.Context) <-chan *containerd.Event { +func (r *Runtime) Events(ctx context.Context) <-chan *plugin.Event { return r.events } @@ -204,20 +204,20 @@ func (r *Runtime) forward(events shim.Shim_EventsClient) { } return } - var et containerd.EventType + var et plugin.EventType switch e.Type { case container.Event_CREATE: - et = containerd.CreateEvent + et = plugin.CreateEvent case container.Event_EXEC_ADDED: - et = containerd.ExecAddEvent + et = plugin.ExecAddEvent case container.Event_EXIT: - et = containerd.ExitEvent + et = plugin.ExitEvent case container.Event_OOM: - et = containerd.OOMEvent + et = plugin.OOMEvent case container.Event_START: - et = containerd.StartEvent + et = plugin.StartEvent } - r.events <- &containerd.Event{ + r.events <- &plugin.Event{ Timestamp: time.Now(), Runtime: runtimeName, Type: et, @@ -256,9 +256,14 @@ func (r *Runtime) loadContainer(path string) (*Container, error) { if err != nil { return nil, err } + data, err := ioutil.ReadFile(filepath.Join(path, configFilename)) + if err != nil { + return nil, err + } return &Container{ id: id, shim: s, + spec: data, }, nil } diff --git a/linux/shim/client.go b/linux/shim/client.go index 1ab1f64e2..ca746dfc1 100644 --- a/linux/shim/client.go +++ b/linux/shim/client.go @@ -99,6 +99,10 @@ func (c *client) CloseStdin(ctx context.Context, in *shimapi.CloseStdinRequest, return c.s.CloseStdin(ctx, in) } +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 *container.Event ctx context.Context diff --git a/linux/shim/init.go b/linux/shim/init.go index a5a9a6498..e9bc6ffac 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -4,9 +4,11 @@ package shim import ( "context" + "fmt" "io" "os" "path/filepath" + "strings" "sync" "syscall" "time" @@ -16,6 +18,7 @@ import ( "github.com/containerd/console" "github.com/containerd/containerd" shimapi "github.com/containerd/containerd/api/services/shim" + "github.com/containerd/containerd/log" "github.com/containerd/fifo" runc "github.com/containerd/go-runc" ) @@ -74,16 +77,35 @@ func newInitProcess(context context.Context, path string, r *shimapi.CreateReque } p.io = io } - opts := &runc.CreateOpts{ - PidFile: filepath.Join(path, "init.pid"), - IO: io, - NoPivot: r.NoPivot, - } - if socket != nil { - opts.ConsoleSocket = socket - } - if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil { - return nil, err + pidFile := filepath.Join(path, "init.pid") + if r.Checkpoint != "" { + opts := &runc.RestoreOpts{ + CheckpointOpts: runc.CheckpointOpts{ + ImagePath: r.Checkpoint, + WorkDir: filepath.Join(r.Bundle, "work"), + ParentPath: r.ParentCheckpoint, + }, + PidFile: pidFile, + IO: io, + NoPivot: r.NoPivot, + Detach: true, + NoSubreaper: true, + } + if _, err := p.runc.Restore(context, r.ID, r.Bundle, opts); err != nil { + return nil, err + } + } else { + opts := &runc.CreateOpts{ + PidFile: pidFile, + IO: io, + NoPivot: r.NoPivot, + } + if socket != nil { + opts.ConsoleSocket = socket + } + if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil { + return nil, err + } } if r.Stdin != "" { sc, err := fifo.OpenFifo(context, r.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0) @@ -109,7 +131,7 @@ func newInitProcess(context context.Context, path string, r *shimapi.CreateReque } } copyWaitGroup.Wait() - pid, err := runc.ReadPidFile(opts.PidFile) + pid, err := runc.ReadPidFile(pidFile) if err != nil { return nil, err } @@ -194,3 +216,50 @@ func (p *initProcess) Signal(sig int) error { func (p *initProcess) Stdin() io.Closer { return p.stdin } + +func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointRequest) error { + var actions []runc.CheckpointAction + if !r.Exit { + actions = append(actions, runc.LeaveRunning) + } + work := filepath.Join(p.bundle, "work") + defer os.RemoveAll(work) + if err := p.runc.Checkpoint(context, p.id, &runc.CheckpointOpts{ + WorkDir: work, + ImagePath: r.Image, + AllowOpenTCP: r.AllowTcp, + AllowExternalUnixSockets: r.AllowUnixSockets, + AllowTerminal: r.AllowTerminal, + FileLocks: r.FileLocks, + EmptyNamespaces: r.EmptyNamespaces, + }, actions...); err != nil { + dumpLog := filepath.Join(p.bundle, "criu-dump.log") + if cerr := copyFile(dumpLog, filepath.Join(work, "dump.log")); cerr != nil { + log.G(context).Error(err) + } + return fmt.Errorf("%s path= %s", criuError(err), dumpLog) + } + return nil +} + +// criuError returns only the first line of the error message from criu +// it tries to add an invalid dump log location when returning the message +func criuError(err error) string { + parts := strings.Split(err.Error(), "\n") + return parts[0] +} + +func copyFile(to, from string) error { + ff, err := os.Open(from) + if err != nil { + return err + } + defer ff.Close() + tt, err := os.Create(to) + if err != nil { + return err + } + defer tt.Close() + _, err = io.Copy(tt, ff) + return err +} diff --git a/linux/shim/service.go b/linux/shim/service.go index 53e0dd334..7ee398d8f 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -86,9 +86,8 @@ func (s *Service) Delete(ctx context.Context, r *shimapi.DeleteRequest) (*shimap if !ok { p = s.initProcess } - if err := p.Delete(ctx); err != nil { - return nil, err - } + // TODO: how to handle errors here + p.Delete(ctx) s.mu.Lock() delete(s.processes, p.Pid()) s.mu.Unlock() @@ -281,6 +280,13 @@ 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) { + if err := s.initProcess.Checkpoint(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) diff --git a/metrics/cgroups/cgroups.go b/metrics/cgroups/cgroups.go index 46d9e5985..c0aa8d647 100644 --- a/metrics/cgroups/cgroups.go +++ b/metrics/cgroups/cgroups.go @@ -5,7 +5,6 @@ import ( "github.com/containerd/cgroups" "github.com/containerd/cgroups/prometheus" - "github.com/containerd/containerd" "github.com/containerd/containerd/plugin" metrics "github.com/docker/go-metrics" "golang.org/x/net/context" @@ -41,7 +40,7 @@ type cgroupsMonitor struct { collector *prometheus.Collector oom *prometheus.OOMCollector context context.Context - events chan<- *containerd.Event + events chan<- *plugin.Event } func (m *cgroupsMonitor) Monitor(c plugin.Container) error { @@ -65,14 +64,14 @@ func (m *cgroupsMonitor) Stop(c plugin.Container) error { return nil } -func (m *cgroupsMonitor) Events(events chan<- *containerd.Event) { +func (m *cgroupsMonitor) Events(events chan<- *plugin.Event) { m.events = events } func (m *cgroupsMonitor) trigger(id string, cg cgroups.Cgroup) { - m.events <- &containerd.Event{ + m.events <- &plugin.Event{ Timestamp: time.Now(), - Type: containerd.OOMEvent, + Type: plugin.OOMEvent, ID: id, } } diff --git a/plugin/container.go b/plugin/container.go index 75ebc13f7..bb109d286 100644 --- a/plugin/container.go +++ b/plugin/container.go @@ -5,6 +5,7 @@ import "context" type ContainerInfo struct { ID string Runtime string + Spec []byte } type Container interface { @@ -28,6 +29,18 @@ type Container interface { Pty(context.Context, uint32, ConsoleSize) error // CloseStdin closes the processes stdin CloseStdin(context.Context, uint32) error + // Checkpoint checkpoints a container to an image with live system data + Checkpoint(context.Context, CheckpointOpts) error +} + +type CheckpointOpts struct { + Exit bool + AllowTCP bool + AllowUnixSockets bool + AllowTerminal bool + FileLocks bool + EmptyNamespaces []string + Path string } type ExecOpts struct { diff --git a/event.go b/plugin/event.go similarity index 96% rename from event.go rename to plugin/event.go index 35c2d54e4..8e131fce5 100644 --- a/event.go +++ b/plugin/event.go @@ -1,4 +1,4 @@ -package containerd +package plugin import "time" diff --git a/plugin/monitor.go b/plugin/monitor.go index 602c02c49..09600e3cb 100644 --- a/plugin/monitor.go +++ b/plugin/monitor.go @@ -1,7 +1,5 @@ package plugin -import "github.com/containerd/containerd" - // ContainerMonitor provides an interface for monitoring of containers within containerd type ContainerMonitor interface { // Monitor adds the provided container to the monitor @@ -9,7 +7,7 @@ type ContainerMonitor interface { // Stop stops and removes the provided container from the monitor Stop(Container) error // Events emits events from the monitor - Events(chan<- *containerd.Event) + Events(chan<- *Event) } func NewMultiContainerMonitor(monitors ...ContainerMonitor) ContainerMonitor { @@ -33,7 +31,7 @@ func (mm *noopContainerMonitor) Stop(c Container) error { return nil } -func (mm *noopContainerMonitor) Events(events chan<- *containerd.Event) { +func (mm *noopContainerMonitor) Events(events chan<- *Event) { } type multiContainerMonitor struct { @@ -58,7 +56,7 @@ func (mm *multiContainerMonitor) Stop(c Container) error { return nil } -func (mm *multiContainerMonitor) Events(events chan<- *containerd.Event) { +func (mm *multiContainerMonitor) Events(events chan<- *Event) { for _, m := range mm.monitors { m.Events(events) } diff --git a/plugin/runtime.go b/plugin/runtime.go index 97895d01f..c7902d952 100644 --- a/plugin/runtime.go +++ b/plugin/runtime.go @@ -20,7 +20,8 @@ type CreateOpts struct { // Rootfs mounts to perform to gain access to the container's filesystem Rootfs []containerd.Mount // IO for the container's main process - IO IO + IO IO + Checkpoint string } type Exit struct { @@ -38,5 +39,5 @@ type Runtime interface { // Delete removes the container in the runtime Delete(context.Context, Container) (*Exit, error) // Events returns events for the runtime and all containers created by the runtime - Events(context.Context) <-chan *containerd.Event + Events(context.Context) <-chan *Event } diff --git a/services/execution/collector.go b/services/execution/collector.go index a71bde8a2..5922500ac 100644 --- a/services/execution/collector.go +++ b/services/execution/collector.go @@ -3,7 +3,6 @@ package execution import ( "sync" - "github.com/containerd/containerd" "github.com/containerd/containerd/plugin" "golang.org/x/net/context" @@ -12,7 +11,7 @@ import ( func newCollector(ctx context.Context, runtimes map[string]plugin.Runtime) (*collector, error) { c := &collector{ context: ctx, - ch: make(chan *containerd.Event, 2048), + ch: make(chan *plugin.Event, 2048), eventClients: make(map[*eventClient]struct{}), } for _, r := range runtimes { @@ -38,7 +37,7 @@ type collector struct { wg sync.WaitGroup context context.Context - ch chan *containerd.Event + ch chan *plugin.Event eventClients map[*eventClient]struct{} } diff --git a/services/execution/service.go b/services/execution/service.go index d94f64f72..ea3daded0 100644 --- a/services/execution/service.go +++ b/services/execution/service.go @@ -1,15 +1,26 @@ package execution import ( + "bytes" "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" "sync" "github.com/containerd/containerd" api "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/types/container" + "github.com/containerd/containerd/api/types/descriptor" + "github.com/containerd/containerd/archive" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" "github.com/containerd/containerd/log" "github.com/containerd/containerd/plugin" + protobuf "github.com/gogo/protobuf/types" google_protobuf "github.com/golang/protobuf/ptypes/empty" + specs "github.com/opencontainers/image-spec/specs-go" "golang.org/x/net/context" "google.golang.org/grpc" ) @@ -35,6 +46,7 @@ func New(ic *plugin.InitContext) (interface{}, error) { runtimes: ic.Runtimes, containers: make(map[string]plugin.Container), collector: c, + store: ic.Content, }, nil } @@ -44,6 +56,7 @@ type Service struct { runtimes map[string]plugin.Runtime containers map[string]plugin.Container collector *collector + store content.Store } func (s *Service) Register(server *grpc.Server) error { @@ -62,6 +75,28 @@ func (s *Service) Register(server *grpc.Server) error { } func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.CreateResponse, error) { + var ( + checkpointPath string + err error + ) + if r.Checkpoint != nil { + checkpointPath, err = ioutil.TempDir("", "ctd-checkpoint") + if err != nil { + return nil, err + } + if r.Checkpoint.MediaType != images.MediaTypeContainerd1Checkpoint { + return nil, fmt.Errorf("unsupported checkpoint type %q", r.Checkpoint.MediaType) + } + reader, err := s.store.Reader(ctx, r.Checkpoint.Digest) + if err != nil { + return nil, err + } + _, err = archive.Apply(ctx, checkpointPath, reader) + reader.Close() + if err != nil { + return nil, err + } + } opts := plugin.CreateOpts{ Spec: r.Spec.Value, IO: plugin.IO{ @@ -70,6 +105,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create Stderr: r.Stderr, Terminal: r.Terminal, }, + Checkpoint: checkpointPath, } for _, m := range r.Rootfs { opts.Rootfs = append(opts.Rootfs, containerd.Mount{ @@ -164,6 +200,10 @@ func containerFromContainerd(ctx context.Context, c plugin.Container) (*containe ID: c.Info().ID, Pid: state.Pid(), Status: status, + Spec: &protobuf.Any{ + TypeUrl: specs.Version, + Value: c.Info().Spec, + }, }, nil } @@ -317,6 +357,72 @@ func (s *Service) CloseStdin(ctx context.Context, r *api.CloseStdinRequest) (*go return empty, nil } +func (s *Service) Checkpoint(ctx context.Context, r *api.CheckpointRequest) (*api.CheckpointResponse, error) { + c, err := s.getContainer(r.ID) + if err != nil { + return nil, err + } + image, err := ioutil.TempDir("", "ctd-checkpoint") + if err != nil { + return nil, err + } + defer os.RemoveAll(image) + if err := c.Checkpoint(ctx, plugin.CheckpointOpts{ + Exit: r.Exit, + AllowTCP: r.AllowTcp, + AllowTerminal: r.AllowTerminal, + AllowUnixSockets: r.AllowUnixSockets, + FileLocks: r.FileLocks, + // ParentImage: r.ParentImage, + EmptyNamespaces: r.EmptyNamespaces, + Path: image, + }); err != nil { + return nil, err + } + // write checkpoint to the content store + tar := archive.Diff(ctx, "", image) + cp, err := s.writeContent(ctx, images.MediaTypeContainerd1Checkpoint, image, tar) + // close tar first after write + if err := tar.Close(); err != nil { + return nil, err + } + if err != nil { + return nil, err + } + // write the config to the content store + spec := bytes.NewReader(c.Info().Spec) + specD, err := s.writeContent(ctx, images.MediaTypeContainerd1CheckpointConfig, filepath.Join(image, "spec"), spec) + if err != nil { + return nil, err + } + return &api.CheckpointResponse{ + Descriptors: []*descriptor.Descriptor{ + cp, + specD, + }, + }, nil +} + +func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io.Reader) (*descriptor.Descriptor, error) { + writer, err := s.store.Writer(ctx, ref, 0, "") + if err != nil { + return nil, err + } + defer writer.Close() + size, err := io.Copy(writer, r) + if err != nil { + return nil, err + } + if err := writer.Commit(0, ""); err != nil { + return nil, err + } + return &descriptor.Descriptor{ + MediaType: mediaType, + Digest: writer.Digest(), + Size_: size, + }, nil +} + func (s *Service) getContainer(id string) (plugin.Container, error) { s.mu.Lock() c, ok := s.containers[id] @@ -339,20 +445,20 @@ type grpcEventWriter struct { server api.ContainerService_EventsServer } -func (g *grpcEventWriter) Write(e *containerd.Event) error { +func (g *grpcEventWriter) Write(e *plugin.Event) error { var t container.Event_EventType switch e.Type { - case containerd.ExitEvent: + case plugin.ExitEvent: t = container.Event_EXIT - case containerd.ExecAddEvent: + case plugin.ExecAddEvent: t = container.Event_EXEC_ADDED - case containerd.PausedEvent: + case plugin.PausedEvent: t = container.Event_PAUSED - case containerd.CreateEvent: + case plugin.CreateEvent: t = container.Event_CREATE - case containerd.StartEvent: + case plugin.StartEvent: t = container.Event_START - case containerd.OOMEvent: + case plugin.OOMEvent: t = container.Event_OOM } return g.server.Send(&container.Event{ diff --git a/vendor.conf b/vendor.conf index 4f8947014..5a70ea9ab 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,5 +1,5 @@ github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 -github.com/containerd/go-runc 66d084de463f26efe84e6a5669e573fa6202e814 +github.com/containerd/go-runc 49b2a02ec1ed3e4ae52d30b54a291b75061e7e9a github.com/containerd/console a3863895279f5104533fd999c1babf80faffd98c github.com/containerd/cgroups 7b2d1a0f50963678d5799e29d17a4d611f5a5dee github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87 @@ -13,8 +13,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.0 github.com/docker/go-units v0.3.1 github.com/gogo/protobuf d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8 github.com/golang/protobuf 8ee79997227bf9b34611aee7946ae64735e6fd93 -github.com/opencontainers/runc 50401b5b4c2e01e4f1372b73a021742deeaf4e2d github.com/opencontainers/runtime-spec v1.0.0-rc5 +github.com/opencontainers/runc 639454475cb9c8b861cc599f8bcd5c8c790ae402 github.com/Sirupsen/logrus v0.11.0 github.com/containerd/btrfs e9c546f46bccffefe71a6bc137e4c21b5503cc18 github.com/stretchr/testify v1.1.4 diff --git a/vendor/github.com/containerd/go-runc/runc.go b/vendor/github.com/containerd/go-runc/runc.go index 5f2fd52d2..dd8074ec7 100644 --- a/vendor/github.com/containerd/go-runc/runc.go +++ b/vendor/github.com/containerd/go-runc/runc.go @@ -489,6 +489,13 @@ func (r *Runc) Restore(context context.Context, id, bundle string, opts *Restore if err := Monitor.Start(cmd); err != nil { return -1, err } + if opts != nil && opts.IO != nil { + if c, ok := opts.IO.(StartCloser); ok { + if err := c.CloseAfterStart(); err != nil { + return -1, err + } + } + } return Monitor.Wait(cmd) } diff --git a/vendor/github.com/opencontainers/runc/README.md b/vendor/github.com/opencontainers/runc/README.md index ae1ab2819..a951f0db3 100644 --- a/vendor/github.com/opencontainers/runc/README.md +++ b/vendor/github.com/opencontainers/runc/README.md @@ -117,8 +117,8 @@ Assuming you have an OCI bundle from the previous step you can execute the conta The first way is to use the convenience command `run` that will handle creating, starting, and deleting the container after it exits. ```bash +# run as root cd /mycontainer - runc run mycontainerid ``` @@ -165,8 +165,8 @@ Now we can go though the lifecycle operations in your shell. ```bash +# run as root cd /mycontainer - runc create mycontainerid # view the container is created and in the "created" state @@ -185,6 +185,22 @@ runc delete mycontainerid This adds more complexity but allows higher level systems to manage runc and provides points in the containers creation to setup various settings after the container has created and/or before it is deleted. This is commonly used to setup the container's network stack after `create` but before `start` where the user's defined process will be running. +#### Rootless containers +`runc` has the ability to run containers without root privileges. This is called `rootless`. You need to pass some parameters to `runc` in order to run rootless containers. See below and compare with the previous version. Run the following commands as an ordinary user: +```bash +# Same as the first example +mkdir ~/mycontainer +cd ~/mycontainer +mkdir rootfs +docker export $(docker create busybox) | tar -C rootfs -xvf - + +# The --rootless parameter instructs runc spec to generate a configuration for a rootless container, which will allow you to run the container as a non-root user. +runc spec --rootless + +# The --root parameter tells runc where to store the container state. It must be writable by the user. +runc --root /tmp/runc run mycontainerid +``` + #### Supervisors `runc` can be used with process supervisors and init systems to ensure that containers are restarted when they exit. diff --git a/vendor/github.com/opencontainers/runc/vendor.conf b/vendor/github.com/opencontainers/runc/vendor.conf index 60b80d087..8a5918cac 100644 --- a/vendor/github.com/opencontainers/runc/vendor.conf +++ b/vendor/github.com/opencontainers/runc/vendor.conf @@ -1,14 +1,21 @@ -github.com/Sirupsen/logrus 26709e2714106fb8ad40b773b711ebce25b78914 -github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 -github.com/coreos/pkg/dlopen 3ac0863d7acf3bc44daf49afef8919af12f704ef -github.com/docker/docker 0f5c9d301b9b1cca66b3ea0f9dec3b5317d3686d -github.com/docker/go-units 9b001659dd36225e356b4467c465d732e745f53d -github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f -github.com/golang/protobuf/proto f7137ae6b19afbfd61a94b746fda3b3fe0491874 +# OCI runtime-spec. When updating this, make sure you use a version tag rather +# than a commit ID so it's much more obvious what version of the spec we are +# using. +github.com/opencontainers/runtime-spec v1.0.0-rc5 +# Core libcontainer functionality. github.com/mrunalp/fileutils ed869b029674c0e9ce4c0dfa781405c2d9946d08 -github.com/opencontainers/runtime-spec/specs-go 035da1dca3dfbb00d752eb58b0b158d6129f3776 +github.com/opencontainers/selinux v1.0.0-rc1 github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 -github.com/syndtr/gocapability/capability e7cb7fa329f456b3855136a2642b197bad7366ba -github.com/urfave/cli d53eb991652b1d438abdd34ce4bfa3ef1539108e +github.com/Sirupsen/logrus 26709e2714106fb8ad40b773b711ebce25b78914 +github.com/syndtr/gocapability e7cb7fa329f456b3855136a2642b197bad7366ba github.com/vishvananda/netlink 1e2e08e8a2dcdacaae3f14ac44c5cfa31361f270 +# systemd integration. +github.com/coreos/go-systemd v14 +github.com/coreos/pkg v3 +github.com/godbus/dbus v3 +github.com/golang/protobuf 18c9bb3261723cd5401db4d0c9fbc5c3b6c70fe8 +# Command-line interface. +github.com/docker/docker 0f5c9d301b9b1cca66b3ea0f9dec3b5317d3686d +github.com/docker/go-units v0.2.0 +github.com/urfave/cli d53eb991652b1d438abdd34ce4bfa3ef1539108e golang.org/x/sys 9a7256cb28ed514b4e1e5f68959914c4c28a92e0 https://github.com/golang/sys diff --git a/windows/container.go b/windows/container.go index a54bbcb35..60b57119f 100644 --- a/windows/container.go +++ b/windows/container.go @@ -9,7 +9,6 @@ import ( "sync" "time" - "github.com/containerd/containerd" "github.com/containerd/containerd/log" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/windows/hcs" @@ -22,7 +21,7 @@ var ( ErrLoadedContainer = errors.New("loaded container can only be terminated") ) -type eventCallback func(id string, evType containerd.EventType, pid, exitStatus uint32, exitedAt time.Time) +type eventCallback func(id string, evType plugin.EventType, pid, exitStatus uint32, exitedAt time.Time) func loadContainers(ctx context.Context, h *hcs.HCS, sendEvent eventCallback) ([]*container, error) { hCtr, err := h.LoadContainers(ctx) @@ -52,7 +51,7 @@ func newContainer(ctx context.Context, h *hcs.HCS, id string, spec RuntimeSpec, if err != nil { return nil, err } - sendEvent(id, containerd.CreateEvent, hcsCtr.Pid(), 0, time.Time{}) + sendEvent(id, plugin.CreateEvent, hcsCtr.Pid(), 0, time.Time{}) return &container{ ctr: hcsCtr, @@ -87,7 +86,7 @@ func (c *container) Start(ctx context.Context) error { } c.setStatus(plugin.RunningStatus) - c.sendEvent(c.ctr.ID(), containerd.StartEvent, c.ctr.Pid(), 0, time.Time{}) + c.sendEvent(c.ctr.ID(), plugin.StartEvent, c.ctr.Pid(), 0, time.Time{}) // Wait for our process to terminate go func() { @@ -96,7 +95,7 @@ func (c *container) Start(ctx context.Context) error { log.G(ctx).Debug(err) } c.setStatus(plugin.StoppedStatus) - c.sendEvent(c.ctr.ID(), containerd.ExitEvent, c.ctr.Pid(), ec, c.ctr.Processes()[0].ExitedAt()) + c.sendEvent(c.ctr.ID(), plugin.ExitEvent, c.ctr.Pid(), ec, c.ctr.Processes()[0].ExitedAt()) }() return nil @@ -152,7 +151,7 @@ func (c *container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Proc if err != nil { log.G(ctx).Debug(err) } - c.sendEvent(c.ctr.ID(), containerd.ExitEvent, p.Pid(), ec, p.ExitedAt()) + c.sendEvent(c.ctr.ID(), plugin.ExitEvent, p.Pid(), ec, p.ExitedAt()) }() return &process{p}, nil @@ -188,6 +187,10 @@ func (c *container) Processes(ctx context.Context) ([]uint32, error) { return pids, nil } +func (c *container) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) error { + return fmt.Errorf("Windows containers do not support checkpoint") +} + func (c *container) setStatus(status plugin.Status) { c.Lock() c.status = status diff --git a/windows/runtime.go b/windows/runtime.go index d076c3a1b..2953d7a0b 100644 --- a/windows/runtime.go +++ b/windows/runtime.go @@ -11,7 +11,6 @@ import ( "sync" "time" - "github.com/containerd/containerd" "github.com/containerd/containerd/log" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/windows/hcs" @@ -45,7 +44,7 @@ func New(ic *plugin.InitContext) (interface{}, error) { r := &Runtime{ pidPool: pid.NewPool(), containers: make(map[string]*container), - events: make(chan *containerd.Event, 2048), + events: make(chan *plugin.Event, 2048), eventsContext: c, eventsCancel: cancel, rootDir: rootDir, @@ -61,7 +60,7 @@ func New(ic *plugin.InitContext) (interface{}, error) { for _, c := range ctrs { c.ctr.Delete(ic.Context) - r.sendEvent(c.ctr.ID(), containerd.ExitEvent, c.ctr.Pid(), 255, time.Time{}) + r.sendEvent(c.ctr.ID(), plugin.ExitEvent, c.ctr.Pid(), 255, time.Time{}) } // Try to delete the old state dir and recreate it @@ -88,7 +87,7 @@ type Runtime struct { containers map[string]*container - events chan *containerd.Event + events chan *plugin.Event eventsContext context.Context eventsCancel func() } @@ -157,12 +156,12 @@ func (r *Runtime) Containers(ctx context.Context) ([]plugin.Container, error) { return list, nil } -func (r *Runtime) Events(ctx context.Context) <-chan *containerd.Event { +func (r *Runtime) Events(ctx context.Context) <-chan *plugin.Event { return r.events } -func (r *Runtime) sendEvent(id string, evType containerd.EventType, pid, exitStatus uint32, exitedAt time.Time) { - r.events <- &containerd.Event{ +func (r *Runtime) sendEvent(id string, evType plugin.EventType, pid, exitStatus uint32, exitedAt time.Time) { + r.events <- &plugin.Event{ Timestamp: time.Now(), Runtime: runtimeName, Type: evType,