diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index ea02cef85..0fbc4fa5d 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -57,7 +57,6 @@ import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" import strings "strings" import reflect "reflect" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" import io "io" @@ -92,6 +91,7 @@ type CreateTaskRequest struct { Stderr string `protobuf:"bytes,6,opt,name=stderr,proto3" json:"stderr,omitempty"` Terminal bool `protobuf:"varint,7,opt,name=terminal,proto3" json:"terminal,omitempty"` Checkpoint *containerd_types1.Descriptor `protobuf:"bytes,8,opt,name=checkpoint" json:"checkpoint,omitempty"` + Options *google_protobuf1.Any `protobuf:"bytes,9,opt,name=options" json:"options,omitempty"` } func (m *CreateTaskRequest) Reset() { *m = CreateTaskRequest{} } @@ -374,7 +374,7 @@ func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorTas type CheckpointTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ParentCheckpoint github_com_opencontainers_go_digest.Digest `protobuf:"bytes,2,opt,name=parent_checkpoint,json=parentCheckpoint,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"parent_checkpoint"` - Options map[string]string `protobuf:"bytes,3,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Options *google_protobuf1.Any `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` } func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } @@ -1036,6 +1036,16 @@ func (m *CreateTaskRequest) MarshalTo(dAtA []byte) (int, error) { } i += n1 } + if m.Options != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintTasks(dAtA, i, uint64(m.Options.Size())) + n2, err := m.Options.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } return i, nil } @@ -1150,11 +1160,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x22 i++ i = encodeVarintTasks(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 } @@ -1230,11 +1240,11 @@ func (m *GetTaskResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintTasks(dAtA, i, uint64(m.Task.Size())) - n3, err := m.Task.MarshalTo(dAtA[i:]) + n4, err := m.Task.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n3 + i += n4 } return i, nil } @@ -1320,11 +1330,11 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(m.Signal)) } if m.PidOrAll != nil { - nn4, err := m.PidOrAll.MarshalTo(dAtA[i:]) + nn5, err := m.PidOrAll.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += nn4 + i += nn5 } return i, nil } @@ -1401,11 +1411,11 @@ func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x32 i++ i = encodeVarintTasks(dAtA, i, uint64(m.Spec.Size())) - n5, err := m.Spec.MarshalTo(dAtA[i:]) + n6, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n6 } return i, nil } @@ -1599,21 +1609,21 @@ func (m *ListPidsResponse) MarshalTo(dAtA []byte) (int, error) { var l int _ = l if len(m.Pids) > 0 { - dAtA7 := make([]byte, len(m.Pids)*10) - var j6 int + dAtA8 := make([]byte, len(m.Pids)*10) + var j7 int for _, num := range m.Pids { for num >= 1<<7 { - dAtA7[j6] = uint8(uint64(num)&0x7f | 0x80) + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j6++ + j7++ } - dAtA7[j6] = uint8(num) - j6++ + dAtA8[j7] = uint8(num) + j7++ } dAtA[i] = 0xa i++ - i = encodeVarintTasks(dAtA, i, uint64(j6)) - i += copy(dAtA[i:], dAtA7[:j6]) + i = encodeVarintTasks(dAtA, i, uint64(j7)) + i += copy(dAtA[i:], dAtA8[:j7]) } return i, nil } @@ -1645,22 +1655,15 @@ func (m *CheckpointTaskRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTasks(dAtA, i, uint64(len(m.ParentCheckpoint))) i += copy(dAtA[i:], m.ParentCheckpoint) } - if len(m.Options) > 0 { - for k, _ := range m.Options { - dAtA[i] = 0x1a - i++ - v := m.Options[k] - mapSize := 1 + len(k) + sovTasks(uint64(len(k))) + 1 + len(v) + sovTasks(uint64(len(v))) - i = encodeVarintTasks(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintTasks(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - dAtA[i] = 0x12 - i++ - i = encodeVarintTasks(dAtA, i, uint64(len(v))) - i += copy(dAtA[i:], v) + if m.Options != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintTasks(dAtA, i, uint64(m.Options.Size())) + n9, err := m.Options.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err } + i += n9 } return i, nil } @@ -1720,11 +1723,11 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintTasks(dAtA, i, uint64(m.Resources.Size())) - n8, err := m.Resources.MarshalTo(dAtA[i:]) + n10, err := m.Resources.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n8 + i += n10 } return i, nil } @@ -1788,6 +1791,10 @@ func (m *CreateTaskRequest) Size() (n int) { l = m.Checkpoint.Size() n += 1 + l + sovTasks(uint64(l)) } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovTasks(uint64(l)) + } return n } @@ -2052,13 +2059,9 @@ func (m *CheckpointTaskRequest) Size() (n int) { if l > 0 { n += 1 + l + sovTasks(uint64(l)) } - if len(m.Options) > 0 { - for k, v := range m.Options { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovTasks(uint64(len(k))) + 1 + len(v) + sovTasks(uint64(len(v))) - n += mapEntrySize + 1 + sovTasks(uint64(mapEntrySize)) - } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovTasks(uint64(l)) } return n } @@ -2114,6 +2117,7 @@ func (this *CreateTaskRequest) String() string { `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Checkpoint:` + strings.Replace(fmt.Sprintf("%v", this.Checkpoint), "Descriptor", "containerd_types1.Descriptor", 1) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") return s @@ -2339,20 +2343,10 @@ func (this *CheckpointTaskRequest) String() string { if this == nil { return "nil" } - keysForOptions := make([]string, 0, len(this.Options)) - for k, _ := range this.Options { - keysForOptions = append(keysForOptions, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForOptions) - mapStringForOptions := "map[string]string{" - for _, k := range keysForOptions { - mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k]) - } - mapStringForOptions += "}" s := strings.Join([]string{`&CheckpointTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ParentCheckpoint:` + fmt.Sprintf("%v", this.ParentCheckpoint) + `,`, - `Options:` + mapStringForOptions + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") return s @@ -2615,6 +2609,39 @@ func (m *CreateTaskRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTasks + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &google_protobuf1.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTasks(dAtA[iNdEx:]) @@ -4602,94 +4629,11 @@ func (m *CheckpointTaskRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTasks - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTasks - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthTasks - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey if m.Options == nil { - m.Options = make(map[string]string) + m.Options = &google_protobuf1.Any{} } - if iNdEx < postIndex { - var valuekey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTasks - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTasks - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthTasks - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - m.Options[mapkey] = mapvalue - } else { - var mapvalue string - m.Options[mapkey] = mapvalue + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -5016,82 +4960,80 @@ func init() { } var fileDescriptorTasks = []byte{ - // 1228 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xfa, 0x57, 0x9d, 0xe7, 0xa6, 0x4d, 0xe6, 0x9b, 0x6f, 0x70, 0x97, 0xca, 0x8e, 0xf6, - 0x00, 0xa6, 0x22, 0xbb, 0xc4, 0x45, 0x08, 0xb5, 0x15, 0x6a, 0x13, 0x87, 0x12, 0x01, 0x4a, 0xba, - 0x29, 0x08, 0x45, 0x48, 0xd6, 0xc6, 0x3b, 0x71, 0x46, 0x5e, 0xef, 0x6e, 0x77, 0xc6, 0x69, 0x0d, - 0x17, 0x4e, 0x5c, 0xe1, 0xc8, 0x7f, 0xc0, 0xff, 0xc0, 0x99, 0x43, 0x8e, 0x1c, 0x38, 0x20, 0x0e, - 0x81, 0xe6, 0x2f, 0x41, 0xf3, 0x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0xae, 0xcc, 0xfd, 0xf5, 0xba, - 0x32, 0xf7, 0xc3, 0x59, 0x45, 0x3b, 0x39, 0xab, 0x68, 0x7f, 0x9c, 0x55, 0xb4, 0x7f, 0xcf, 0x2a, - 0xda, 0xfe, 0xa3, 0xab, 0xfd, 0x12, 0xf2, 0x50, 0x1c, 0x0e, 0x0a, 0xe2, 0x9d, 0xfb, 0xff, 0x05, - 0x00, 0x00, 0xff, 0xff, 0x29, 0x59, 0x7a, 0x4c, 0x50, 0x11, 0x00, 0x00, + // 1191 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0xc6, 0x1f, 0x75, 0x8e, 0x9b, 0x36, 0x99, 0x7f, 0xfe, 0xc1, 0x5d, 0x2a, 0x3b, 0xda, + 0x0b, 0x30, 0x15, 0xd9, 0x25, 0x2e, 0xe2, 0x82, 0x56, 0x88, 0x26, 0x0e, 0x21, 0x02, 0x94, 0x74, + 0x53, 0x10, 0xaa, 0x90, 0xac, 0x8d, 0x77, 0xe2, 0x8c, 0xb2, 0xde, 0xd9, 0xee, 0x8c, 0xd3, 0x06, + 0x6e, 0xb8, 0xe2, 0x16, 0xde, 0x82, 0x77, 0xe0, 0x09, 0x72, 0xc9, 0x05, 0x17, 0x08, 0xa1, 0x40, + 0xf3, 0x24, 0x68, 0x3e, 0xbc, 0xd9, 0xd8, 0xb1, 0xd7, 0xa9, 0x73, 0x93, 0xcc, 0xcc, 0x9e, 0x73, + 0xe6, 0x9c, 0xdf, 0xf9, 0xf8, 0x8d, 0x0c, 0xeb, 0x1d, 0xc2, 0x0f, 0x7b, 0xfb, 0x76, 0x9b, 0x76, + 0x9d, 0x36, 0x0d, 0xb9, 0x47, 0x42, 0x1c, 0xfb, 0xe9, 0xa5, 0x17, 0x11, 0x87, 0xe1, 0xf8, 0x98, + 0xb4, 0x31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x76, 0x0d, 0x0d, 0xed, 0xf7, 0x1e, 0xcc, 0x25, 0xa4, 0x96, 0x85, 0xd2, 0x20, 0xfb, + 0x8d, 0x8c, 0x60, 0x07, 0x6e, 0x69, 0x86, 0xca, 0xca, 0xee, 0x65, 0x22, 0x1b, 0x63, 0xb0, 0x20, + 0x49, 0x28, 0xcb, 0xc3, 0x41, 0xa6, 0x1a, 0x69, 0xf0, 0x29, 0x14, 0x15, 0x1b, 0x65, 0xf5, 0xd5, + 0x10, 0x67, 0x8d, 0x34, 0x49, 0xa0, 0xd4, 0x27, 0x14, 0xb4, 0x9a, 0x5d, 0x3e, 0x29, 0xfe, 0x32, + 0xed, 0x49, 0xc5, 0x75, 0xd2, 0x5e, 0x02, 0xa4, 0x46, 0xfe, 0xc3, 0x0c, 0x88, 0xaf, 0x22, 0x2f, + 0xf3, 0xc3, 0xeb, 0x29, 0xe9, 0x8b, 0x9f, 0x42, 0x51, 0xcd, 0xf4, 0x2c, 0xd8, 0x86, 0x26, 0xff, + 0x28, 0xd8, 0xd6, 0xbf, 0x39, 0x7d, 0x5d, 0x9d, 0xf9, 0xf3, 0x75, 0x75, 0xe6, 0xc7, 0xf3, 0xaa, + 0x71, 0x7a, 0x5e, 0x35, 0x7e, 0x3f, 0xaf, 0x1a, 0xff, 0x9e, 0x57, 0x8d, 0xe7, 0x8f, 0xdf, 0xec, + 0x17, 0x8d, 0x47, 0x72, 0xb1, 0x5f, 0x94, 0xf7, 0x3c, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x7e, + 0x07, 0x52, 0x7c, 0x18, 0x11, 0x00, 0x00, } diff --git a/api/services/tasks/v1/tasks.proto b/api/services/tasks/v1/tasks.proto index e46fc3ffa..f720bbbab 100644 --- a/api/services/tasks/v1/tasks.proto +++ b/api/services/tasks/v1/tasks.proto @@ -72,6 +72,8 @@ message CreateTaskRequest { bool terminal = 7; containerd.types.Descriptor checkpoint = 8; + + google.protobuf.Any options = 9; } message CreateTaskResponse { @@ -184,7 +186,7 @@ message ListPidsResponse{ message CheckpointTaskRequest { string container_id = 1; string parent_checkpoint = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; - map options = 3; + google.protobuf.Any options = 3; } message CheckpointTaskResponse { diff --git a/checkpoint_test.go b/checkpoint_test.go index 5222fd72e..45f0cd18d 100644 --- a/checkpoint_test.go +++ b/checkpoint_test.go @@ -1,8 +1,14 @@ package containerd import ( + "path/filepath" "syscall" "testing" + + tasks "github.com/containerd/containerd/api/services/tasks/v1" + "github.com/containerd/containerd/linux/runcopts" + "github.com/gogo/protobuf/proto" + protobuf "github.com/gogo/protobuf/types" ) func TestCheckpointRestore(t *testing.T) { @@ -200,3 +206,105 @@ func TestCheckpointRestoreNewContainer(t *testing.T) { } <-statusC } + +func TestCheckpointLeaveRunning(t *testing.T) { + if testing.Short() { + t.Skip() + } + if !supportsCriu { + t.Skip("system does not have criu installed") + } + client, err := New(address) + if err != nil { + t.Fatal(err) + } + defer client.Close() + + var ( + ctx, cancel = testContext() + id = t.Name() + ) + defer cancel() + + image, err := client.GetImage(ctx, testImage) + if err != nil { + t.Error(err) + return + } + spec, err := GenerateSpec(WithImageConfig(ctx, image), WithProcessArgs("sleep", "100")) + if err != nil { + t.Error(err) + return + } + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) + if err != nil { + t.Error(err) + return + } + defer container.Delete(ctx, WithRootFSDeletion) + + task, err := container.NewTask(ctx, empty()) + if err != nil { + t.Error(err) + return + } + defer task.Delete(ctx) + + statusC := make(chan uint32, 1) + go func() { + status, err := task.Wait(ctx) + if err != nil { + t.Error(err) + } + statusC <- status + }() + + if err := task.Start(ctx); err != nil { + t.Error(err) + return + } + + if _, err := task.Checkpoint(ctx); err != nil { + t.Error(err) + return + } + + status, err := task.Status(ctx) + if err != nil { + t.Error(err) + return + } + if status != Running { + t.Errorf("expected status %q but received %q", Running, status) + return + } + + if err := task.Kill(ctx, syscall.SIGKILL); err != nil { + t.Error(err) + return + } + + <-statusC +} + +func WithExit(r *tasks.CheckpointTaskRequest) error { + a, err := marshal(&runcopts.CheckpointOptions{ + Exit: true, + }, "CheckpointOptions") + if err != nil { + return err + } + r.Options = a + return nil +} + +func marshal(m proto.Message, name string) (*protobuf.Any, error) { + data, err := proto.Marshal(m) + if err != nil { + return nil, err + } + return &protobuf.Any{ + TypeUrl: filepath.Join(runcopts.URIBase, name), + Value: data, + }, nil +} diff --git a/client.go b/client.go index 5f9a3f469..11ef3b92c 100644 --- a/client.go +++ b/client.go @@ -195,10 +195,13 @@ func WithNewReadonlyRootFS(id string, i Image) NewContainerOpts { } } -func WithRuntime(name string) NewContainerOpts { +// WithRuntime allows a user to specify the runtime name and additional options that should +// be used to create tasks for the container +func WithRuntime(name string, options map[string]string) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { c.Runtime = &containers.Container_Runtime{ - Name: name, + Name: name, + Options: options, } return nil } diff --git a/cmd/ctr/checkpoint.go b/cmd/ctr/checkpoint.go index 58370ec4d..b259c8fd0 100644 --- a/cmd/ctr/checkpoint.go +++ b/cmd/ctr/checkpoint.go @@ -2,8 +2,13 @@ package main import ( "fmt" + "path/filepath" "github.com/containerd/containerd" + tasks "github.com/containerd/containerd/api/services/tasks/v1" + "github.com/containerd/containerd/linux/runcopts" + "github.com/gogo/protobuf/proto" + protobuf "github.com/gogo/protobuf/types" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -42,7 +47,7 @@ var checkpointCommand = cli.Command{ } var opts []containerd.CheckpointOpts if context.Bool("exit") { - opts = append(opts, containerd.WithExit) + opts = append(opts, WithExit) } checkpoint, err := task.Checkpoint(ctx, opts...) if err != nil { @@ -52,3 +57,25 @@ var checkpointCommand = cli.Command{ return nil }, } + +func WithExit(r *tasks.CheckpointTaskRequest) error { + a, err := marshal(&runcopts.CheckpointOptions{ + Exit: true, + }, "CheckpointOptions") + if err != nil { + return err + } + r.Options = a + return nil +} + +func marshal(m proto.Message, name string) (*protobuf.Any, error) { + data, err := proto.Marshal(m) + if err != nil { + return nil, err + } + return &protobuf.Any{ + TypeUrl: filepath.Join(runcopts.URIBase, name), + Value: data, + }, nil +} diff --git a/linux/runcopts/options.go b/linux/runcopts/options.go new file mode 100644 index 000000000..b5ab393a4 --- /dev/null +++ b/linux/runcopts/options.go @@ -0,0 +1,3 @@ +package runcopts + +const URIBase = "containerd.io/linux/runc" diff --git a/linux/runcopts/runc.pb.go b/linux/runcopts/runc.pb.go new file mode 100644 index 000000000..488afc62b --- /dev/null +++ b/linux/runcopts/runc.pb.go @@ -0,0 +1,1153 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/linux/runcopts/runc.proto +// DO NOT EDIT! + +/* + Package runcopts is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/linux/runcopts/runc.proto + + It has these top-level messages: + RuncOptions + CreateOptions + CheckpointOptions +*/ +package runcopts + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type RuncOptions struct { + CriuPath string `protobuf:"bytes,1,opt,name=criu_path,json=criuPath,proto3" json:"criu_path,omitempty"` + SystemdCgroup string `protobuf:"bytes,2,opt,name=systemd_cgroup,json=systemdCgroup,proto3" json:"systemd_cgroup,omitempty"` +} + +func (m *RuncOptions) Reset() { *m = RuncOptions{} } +func (*RuncOptions) ProtoMessage() {} +func (*RuncOptions) Descriptor() ([]byte, []int) { return fileDescriptorRunc, []int{0} } + +type CreateOptions struct { + NoPivotRoot bool `protobuf:"varint,1,opt,name=no_pivot_root,json=noPivotRoot,proto3" json:"no_pivot_root,omitempty"` + OpenTcp bool `protobuf:"varint,2,opt,name=open_tcp,json=openTcp,proto3" json:"open_tcp,omitempty"` + ExternalUnixSockets bool `protobuf:"varint,3,opt,name=external_unix_sockets,json=externalUnixSockets,proto3" json:"external_unix_sockets,omitempty"` + Terminal bool `protobuf:"varint,4,opt,name=terminal,proto3" json:"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"` + CgroupsMode string `protobuf:"bytes,7,opt,name=cgroups_mode,json=cgroupsMode,proto3" json:"cgroups_mode,omitempty"` + NoNewKeyring bool `protobuf:"varint,8,opt,name=no_new_keyring,json=noNewKeyring,proto3" json:"no_new_keyring,omitempty"` +} + +func (m *CreateOptions) Reset() { *m = CreateOptions{} } +func (*CreateOptions) ProtoMessage() {} +func (*CreateOptions) Descriptor() ([]byte, []int) { return fileDescriptorRunc, []int{1} } + +type CheckpointOptions struct { + Exit bool `protobuf:"varint,1,opt,name=exit,proto3" json:"exit,omitempty"` + OpenTcp bool `protobuf:"varint,2,opt,name=open_tcp,json=openTcp,proto3" json:"open_tcp,omitempty"` + ExternalUnixSockets bool `protobuf:"varint,3,opt,name=external_unix_sockets,json=externalUnixSockets,proto3" json:"external_unix_sockets,omitempty"` + Terminal bool `protobuf:"varint,4,opt,name=terminal,proto3" json:"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"` + CgroupsMode string `protobuf:"bytes,7,opt,name=cgroups_mode,json=cgroupsMode,proto3" json:"cgroups_mode,omitempty"` +} + +func (m *CheckpointOptions) Reset() { *m = CheckpointOptions{} } +func (*CheckpointOptions) ProtoMessage() {} +func (*CheckpointOptions) Descriptor() ([]byte, []int) { return fileDescriptorRunc, []int{2} } + +func init() { + proto.RegisterType((*RuncOptions)(nil), "containerd.linux.runc.RuncOptions") + proto.RegisterType((*CreateOptions)(nil), "containerd.linux.runc.CreateOptions") + proto.RegisterType((*CheckpointOptions)(nil), "containerd.linux.runc.CheckpointOptions") +} +func (m *RuncOptions) 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 *RuncOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.CriuPath) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuPath))) + i += copy(dAtA[i:], m.CriuPath) + } + if len(m.SystemdCgroup) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRunc(dAtA, i, uint64(len(m.SystemdCgroup))) + i += copy(dAtA[i:], m.SystemdCgroup) + } + return i, nil +} + +func (m *CreateOptions) 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 *CreateOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.NoPivotRoot { + dAtA[i] = 0x8 + i++ + if m.NoPivotRoot { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.OpenTcp { + dAtA[i] = 0x10 + i++ + if m.OpenTcp { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.ExternalUnixSockets { + dAtA[i] = 0x18 + i++ + if m.ExternalUnixSockets { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.Terminal { + dAtA[i] = 0x20 + i++ + if m.Terminal { + 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.CgroupsMode) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintRunc(dAtA, i, uint64(len(m.CgroupsMode))) + i += copy(dAtA[i:], m.CgroupsMode) + } + if m.NoNewKeyring { + dAtA[i] = 0x40 + i++ + if m.NoNewKeyring { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *CheckpointOptions) 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 *CheckpointOptions) 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.OpenTcp { + dAtA[i] = 0x10 + i++ + if m.OpenTcp { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.ExternalUnixSockets { + dAtA[i] = 0x18 + i++ + if m.ExternalUnixSockets { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.Terminal { + dAtA[i] = 0x20 + i++ + if m.Terminal { + 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.CgroupsMode) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintRunc(dAtA, i, uint64(len(m.CgroupsMode))) + i += copy(dAtA[i:], m.CgroupsMode) + } + return i, nil +} + +func encodeFixed64Runc(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Runc(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintRunc(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *RuncOptions) Size() (n int) { + var l int + _ = l + l = len(m.CriuPath) + if l > 0 { + n += 1 + l + sovRunc(uint64(l)) + } + l = len(m.SystemdCgroup) + if l > 0 { + n += 1 + l + sovRunc(uint64(l)) + } + return n +} + +func (m *CreateOptions) Size() (n int) { + var l int + _ = l + if m.NoPivotRoot { + n += 2 + } + if m.OpenTcp { + n += 2 + } + if m.ExternalUnixSockets { + n += 2 + } + if m.Terminal { + n += 2 + } + if m.FileLocks { + n += 2 + } + if len(m.EmptyNamespaces) > 0 { + for _, s := range m.EmptyNamespaces { + l = len(s) + n += 1 + l + sovRunc(uint64(l)) + } + } + l = len(m.CgroupsMode) + if l > 0 { + n += 1 + l + sovRunc(uint64(l)) + } + if m.NoNewKeyring { + n += 2 + } + return n +} + +func (m *CheckpointOptions) Size() (n int) { + var l int + _ = l + if m.Exit { + n += 2 + } + if m.OpenTcp { + n += 2 + } + if m.ExternalUnixSockets { + n += 2 + } + if m.Terminal { + n += 2 + } + if m.FileLocks { + n += 2 + } + if len(m.EmptyNamespaces) > 0 { + for _, s := range m.EmptyNamespaces { + l = len(s) + n += 1 + l + sovRunc(uint64(l)) + } + } + l = len(m.CgroupsMode) + if l > 0 { + n += 1 + l + sovRunc(uint64(l)) + } + return n +} + +func sovRunc(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRunc(x uint64) (n int) { + return sovRunc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *RuncOptions) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuncOptions{`, + `CriuPath:` + fmt.Sprintf("%v", this.CriuPath) + `,`, + `SystemdCgroup:` + fmt.Sprintf("%v", this.SystemdCgroup) + `,`, + `}`, + }, "") + return s +} +func (this *CreateOptions) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateOptions{`, + `NoPivotRoot:` + fmt.Sprintf("%v", this.NoPivotRoot) + `,`, + `OpenTcp:` + fmt.Sprintf("%v", this.OpenTcp) + `,`, + `ExternalUnixSockets:` + fmt.Sprintf("%v", this.ExternalUnixSockets) + `,`, + `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, + `FileLocks:` + fmt.Sprintf("%v", this.FileLocks) + `,`, + `EmptyNamespaces:` + fmt.Sprintf("%v", this.EmptyNamespaces) + `,`, + `CgroupsMode:` + fmt.Sprintf("%v", this.CgroupsMode) + `,`, + `NoNewKeyring:` + fmt.Sprintf("%v", this.NoNewKeyring) + `,`, + `}`, + }, "") + return s +} +func (this *CheckpointOptions) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CheckpointOptions{`, + `Exit:` + fmt.Sprintf("%v", this.Exit) + `,`, + `OpenTcp:` + fmt.Sprintf("%v", this.OpenTcp) + `,`, + `ExternalUnixSockets:` + fmt.Sprintf("%v", this.ExternalUnixSockets) + `,`, + `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, + `FileLocks:` + fmt.Sprintf("%v", this.FileLocks) + `,`, + `EmptyNamespaces:` + fmt.Sprintf("%v", this.EmptyNamespaces) + `,`, + `CgroupsMode:` + fmt.Sprintf("%v", this.CgroupsMode) + `,`, + `}`, + }, "") + return s +} +func valueToStringRunc(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *RuncOptions) 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 ErrIntOverflowRunc + } + 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: RuncOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuncOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CriuPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + 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 ErrInvalidLengthRunc + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CriuPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SystemdCgroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + 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 ErrInvalidLengthRunc + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SystemdCgroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRunc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRunc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateOptions) 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 ErrIntOverflowRunc + } + 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: CreateOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NoPivotRoot", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NoPivotRoot = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenTcp", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.OpenTcp = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExternalUnixSockets", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ExternalUnixSockets = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Terminal = 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 ErrIntOverflowRunc + } + 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 ErrIntOverflowRunc + } + 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 ErrInvalidLengthRunc + } + 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 CgroupsMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + 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 ErrInvalidLengthRunc + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CgroupsMode = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NoNewKeyring", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NoNewKeyring = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRunc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRunc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CheckpointOptions) 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 ErrIntOverflowRunc + } + 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: CheckpointOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckpointOptions: 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 ErrIntOverflowRunc + } + 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 OpenTcp", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.OpenTcp = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExternalUnixSockets", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ExternalUnixSockets = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Terminal = 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 ErrIntOverflowRunc + } + 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 ErrIntOverflowRunc + } + 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 ErrInvalidLengthRunc + } + 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 CgroupsMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunc + } + 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 ErrInvalidLengthRunc + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CgroupsMode = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRunc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRunc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRunc(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRunc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRunc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRunc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRunc + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRunc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRunc(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRunc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRunc = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/linux/runcopts/runc.proto", fileDescriptorRunc) +} + +var fileDescriptorRunc = []byte{ + // 428 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0x31, 0x6f, 0xd4, 0x4c, + 0x10, 0x86, 0xe3, 0x24, 0x5f, 0xe2, 0xdb, 0xcb, 0xe5, 0x83, 0x85, 0x48, 0x26, 0x08, 0x2b, 0x9c, + 0x40, 0x0a, 0xcd, 0x9d, 0x04, 0x0d, 0x82, 0x8e, 0x2b, 0x81, 0x10, 0x0c, 0x34, 0x34, 0x2b, 0x67, + 0x6f, 0xf0, 0xad, 0xce, 0x9e, 0x59, 0xed, 0x8e, 0x89, 0xaf, 0xe3, 0x2f, 0xf1, 0x2f, 0x52, 0x52, + 0x52, 0x92, 0xfb, 0x23, 0x20, 0xaf, 0xe3, 0x40, 0x4b, 0x4b, 0xf7, 0xce, 0x33, 0x8f, 0xc6, 0xd2, + 0x2b, 0xaf, 0x78, 0x56, 0x18, 0x5e, 0xd4, 0x67, 0x13, 0x4d, 0xd5, 0x54, 0x13, 0x72, 0x6e, 0x10, + 0xdc, 0xfc, 0xcf, 0x58, 0x1a, 0xac, 0x9b, 0xa9, 0xab, 0x51, 0x93, 0x65, 0x1f, 0xc2, 0xc4, 0x3a, + 0x62, 0x92, 0x07, 0xbf, 0xad, 0x49, 0xb0, 0x26, 0xed, 0xf2, 0xf0, 0x76, 0x41, 0x05, 0x05, 0x63, + 0xda, 0xa6, 0x4e, 0x1e, 0xbf, 0x15, 0xc3, 0xac, 0x46, 0xfd, 0xc6, 0xb2, 0x21, 0xf4, 0xf2, 0xae, + 0x18, 0x68, 0x67, 0x6a, 0x65, 0x73, 0x5e, 0x24, 0xd1, 0x51, 0x74, 0x3c, 0xc8, 0xe2, 0x16, 0x9c, + 0xe6, 0xbc, 0x90, 0x0f, 0xc5, 0xbe, 0x5f, 0x79, 0x86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e7, 0x2f, + 0x3b, 0x36, 0xfe, 0x19, 0x89, 0x9b, 0xb3, 0x05, 0xe8, 0xa5, 0x25, 0x83, 0xdc, 0xf7, 0x26, 0xc5, + 0x36, 0x34, 0xa6, 0xaf, 0x2b, 0xe4, 0x7f, 0xb5, 0xa7, 0x17, 0xd9, 0xc5, 0x65, 0xba, 0xf1, 0xfd, + 0x32, 0xdd, 0xf8, 0xb2, 0x4e, 0xa3, 0x8b, 0x75, 0x1a, 0x7d, 0x5b, 0xa7, 0xd1, 0x8f, 0x75, 0x1a, + 0x7d, 0x7c, 0xfa, 0x97, 0x6f, 0xe1, 0x79, 0x1f, 0xce, 0x76, 0xc2, 0x3f, 0xfe, 0xe4, 0x57, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x9d, 0xd8, 0x49, 0xfe, 0x4e, 0x03, 0x00, 0x00, +} diff --git a/linux/runcopts/runc.proto b/linux/runcopts/runc.proto new file mode 100644 index 000000000..a5b9b7e8b --- /dev/null +++ b/linux/runcopts/runc.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package containerd.linux.runc; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/containerd/containerd/linux/runcopts;runcopts"; + +message RuncOptions { + string criu_path = 1; + string systemd_cgroup = 2; +} + +message CreateOptions { + bool no_pivot_root = 1; + bool open_tcp = 2; + bool external_unix_sockets = 3; + bool terminal = 4; + bool file_locks = 5; + repeated string empty_namespaces = 6; + string cgroups_mode = 7; + bool no_new_keyring = 8; +} + +message CheckpointOptions { + bool exit = 1; + bool open_tcp = 2; + bool external_unix_sockets = 3; + bool terminal = 4; + bool file_locks = 5; + repeated string empty_namespaces = 6; + string cgroups_mode = 7; +} diff --git a/linux/runtime.go b/linux/runtime.go index e5725dbe2..a65e0d139 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -25,6 +25,7 @@ import ( "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/runtime" runc "github.com/containerd/go-runc" + protobuf "github.com/gogo/protobuf/types" google_protobuf "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" @@ -171,6 +172,9 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts Stderr: opts.IO.Stderr, Terminal: opts.IO.Terminal, Checkpoint: opts.Checkpoint, + Options: &protobuf.Any{ + Value: opts.Options, + }, } for _, m := range opts.Rootfs { sopts.Rootfs = append(sopts.Rootfs, &types.Mount{ diff --git a/linux/shim/init.go b/linux/shim/init.go index f47243311..3e10626fe 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -17,12 +17,14 @@ import ( "golang.org/x/sys/unix" "github.com/containerd/console" + "github.com/containerd/containerd/linux/runcopts" shimapi "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/containerd/log" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/runtime" "github.com/containerd/fifo" runc "github.com/containerd/go-runc" + "github.com/gogo/protobuf/proto" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) @@ -54,6 +56,12 @@ type initProcess struct { } func newInitProcess(context context.Context, path, namespace string, r *shimapi.CreateTaskRequest) (*initProcess, error) { + var options runcopts.CreateOptions + if r.Options != nil { + if err := proto.Unmarshal(r.Options.Value, &options); err != nil { + return nil, err + } + } for _, rm := range r.Rootfs { m := &mount.Mount{ Type: rm.Type, @@ -105,10 +113,9 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi. WorkDir: filepath.Join(r.Bundle, "work"), ParentPath: r.ParentCheckpoint, }, - PidFile: pidFile, - IO: io, - // TODO: implement runtime options - //NoPivot: r.NoPivot, + PidFile: pidFile, + IO: io, + NoPivot: options.NoPivotRoot, Detach: true, NoSubreaper: true, } @@ -117,9 +124,10 @@ func newInitProcess(context context.Context, path, namespace string, r *shimapi. } } else { opts := &runc.CreateOpts{ - PidFile: pidFile, - IO: io, - // NoPivot: r.NoPivot, + PidFile: pidFile, + IO: io, + NoPivot: options.NoPivotRoot, + NoNewKeyring: options.NoNewKeyring, } if socket != nil { opts.ConsoleSocket = socket @@ -256,25 +264,26 @@ func (p *initProcess) Stdin() io.Closer { } func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointTaskRequest) error { - var actions []runc.CheckpointAction - /* - if !r.Exit { - actions = append(actions, runc.LeaveRunning) + var options runcopts.CheckpointOptions + if r.Options != nil { + if err := proto.Unmarshal(r.Options.Value, &options); err != nil { + return err } - */ + } + var actions []runc.CheckpointAction + if !options.Exit { + actions = append(actions, runc.LeaveRunning) + } work := filepath.Join(p.bundle, "work") defer os.RemoveAll(work) - // TODO: convert options into runc flags or a better format for criu if err := p.runc.Checkpoint(context, p.id, &runc.CheckpointOpts{ - WorkDir: work, - ImagePath: r.Path, - /* - AllowOpenTCP: r.AllowTcp, - AllowExternalUnixSockets: r.AllowUnixSockets, - AllowTerminal: r.AllowTerminal, - FileLocks: r.FileLocks, - EmptyNamespaces: r.EmptyNamespaces, - */ + WorkDir: work, + ImagePath: r.Path, + AllowOpenTCP: options.OpenTcp, + AllowExternalUnixSockets: options.ExternalUnixSockets, + AllowTerminal: options.Terminal, + FileLocks: options.FileLocks, + EmptyNamespaces: options.EmptyNamespaces, }, actions...); err != nil { dumpLog := filepath.Join(p.bundle, "criu-dump.log") if cerr := copyFile(dumpLog, filepath.Join(work, "dump.log")); cerr != nil { diff --git a/linux/shim/v1/shim.pb.go b/linux/shim/v1/shim.pb.go index b96c8e06a..d2cfa4c20 100644 --- a/linux/shim/v1/shim.pb.go +++ b/linux/shim/v1/shim.pb.go @@ -50,7 +50,6 @@ import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" import strings "strings" import reflect "reflect" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" import io "io" @@ -77,6 +76,7 @@ type CreateTaskRequest struct { Stderr string `protobuf:"bytes,8,opt,name=stderr,proto3" json:"stderr,omitempty"` Checkpoint string `protobuf:"bytes,9,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` ParentCheckpoint string `protobuf:"bytes,10,opt,name=parent_checkpoint,json=parentCheckpoint,proto3" json:"parent_checkpoint,omitempty"` + Options *google_protobuf.Any `protobuf:"bytes,11,opt,name=options" json:"options,omitempty"` } func (m *CreateTaskRequest) Reset() { *m = CreateTaskRequest{} } @@ -191,8 +191,8 @@ func (*ListPidsResponse) ProtoMessage() {} func (*ListPidsResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} } type CheckpointTaskRequest struct { - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - Options map[string]string `protobuf:"bytes,2,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Options *google_protobuf.Any `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` } func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } @@ -925,6 +925,16 @@ func (m *CreateTaskRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintShim(dAtA, i, uint64(len(m.ParentCheckpoint))) i += copy(dAtA[i:], m.ParentCheckpoint) } + if m.Options != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintShim(dAtA, i, uint64(m.Options.Size())) + n1, err := m.Options.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } return i, nil } @@ -979,11 +989,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintShim(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) - n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) if err != nil { return 0, err } - i += n1 + i += n2 return i, nil } @@ -1057,11 +1067,11 @@ func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2a i++ i = encodeVarintShim(dAtA, i, uint64(m.Spec.Size())) - n2, err := m.Spec.MarshalTo(dAtA[i:]) + n3, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n2 + i += n3 } return i, nil } @@ -1313,21 +1323,21 @@ func (m *ListPidsResponse) MarshalTo(dAtA []byte) (int, error) { var l int _ = l if len(m.Pids) > 0 { - dAtA4 := make([]byte, len(m.Pids)*10) - var j3 int + dAtA5 := make([]byte, len(m.Pids)*10) + var j4 int for _, num := range m.Pids { 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] = 0xa i++ - i = encodeVarintShim(dAtA, i, uint64(j3)) - i += copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintShim(dAtA, i, uint64(j4)) + i += copy(dAtA[i:], dAtA5[:j4]) } return i, nil } @@ -1353,22 +1363,15 @@ func (m *CheckpointTaskRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintShim(dAtA, i, uint64(len(m.Path))) i += copy(dAtA[i:], m.Path) } - if len(m.Options) > 0 { - for k, _ := range m.Options { - dAtA[i] = 0x12 - i++ - v := m.Options[k] - mapSize := 1 + len(k) + sovShim(uint64(len(k))) + 1 + len(v) + sovShim(uint64(len(v))) - i = encodeVarintShim(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintShim(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - dAtA[i] = 0x12 - i++ - i = encodeVarintShim(dAtA, i, uint64(len(v))) - i += copy(dAtA[i:], v) + if m.Options != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.Options.Size())) + n6, err := m.Options.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err } + i += n6 } return i, nil } @@ -1433,11 +1436,11 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintShim(dAtA, i, uint64(m.Resources.Size())) - n5, err := m.Resources.MarshalTo(dAtA[i:]) + n7, err := m.Resources.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n7 } return i, nil } @@ -1513,6 +1516,10 @@ func (m *CreateTaskRequest) Size() (n int) { if l > 0 { n += 1 + l + sovShim(uint64(l)) } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovShim(uint64(l)) + } return n } @@ -1695,13 +1702,9 @@ func (m *CheckpointTaskRequest) Size() (n int) { if l > 0 { n += 1 + l + sovShim(uint64(l)) } - if len(m.Options) > 0 { - for k, v := range m.Options { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovShim(uint64(len(k))) + 1 + len(v) + sovShim(uint64(len(v))) - n += mapEntrySize + 1 + sovShim(uint64(mapEntrySize)) - } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovShim(uint64(l)) } return n } @@ -1759,6 +1762,7 @@ func (this *CreateTaskRequest) String() string { `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Checkpoint:` + fmt.Sprintf("%v", this.Checkpoint) + `,`, `ParentCheckpoint:` + fmt.Sprintf("%v", this.ParentCheckpoint) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf.Any", 1) + `,`, `}`, }, "") return s @@ -1896,19 +1900,9 @@ func (this *CheckpointTaskRequest) String() string { if this == nil { return "nil" } - keysForOptions := make([]string, 0, len(this.Options)) - for k, _ := range this.Options { - keysForOptions = append(keysForOptions, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForOptions) - mapStringForOptions := "map[string]string{" - for _, k := range keysForOptions { - mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k]) - } - mapStringForOptions += "}" s := strings.Join([]string{`&CheckpointTaskRequest{`, `Path:` + fmt.Sprintf("%v", this.Path) + `,`, - `Options:` + mapStringForOptions + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf.Any", 1) + `,`, `}`, }, "") return s @@ -2262,6 +2256,39 @@ func (m *CreateTaskRequest) Unmarshal(dAtA []byte) error { } m.ParentCheckpoint = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthShim + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &google_protobuf.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipShim(dAtA[iNdEx:]) @@ -3661,94 +3688,11 @@ func (m *CheckpointTaskRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthShim - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey if m.Options == nil { - m.Options = make(map[string]string) + m.Options = &google_protobuf.Any{} } - if iNdEx < postIndex { - var valuekey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShim - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthShim - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - m.Options[mapkey] = mapvalue - } else { - var mapvalue string - m.Options[mapkey] = mapvalue + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -4084,77 +4028,75 @@ func init() { } var fileDescriptorShim = []byte{ - // 1148 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0xaf, 0x6c, 0x47, 0xb1, 0x9f, 0x71, 0x48, 0xb6, 0x69, 0x50, 0x5d, 0xc6, 0xc9, 0xe8, 0x50, - 0xcc, 0x74, 0x2a, 0x35, 0x0e, 0x6d, 0x43, 0x38, 0xe5, 0xdf, 0x30, 0x19, 0xc8, 0xd4, 0xa3, 0xb4, - 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xc3, 0x0f, 0x1f, 0x0e, 0x00, 0x00, + // 1114 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xaf, 0x93, 0xd4, 0x4d, 0x5e, 0x94, 0xd2, 0xce, 0x76, 0x8b, 0x37, 0x8b, 0xd2, 0xc8, 0x87, + 0x25, 0x68, 0xb5, 0xf6, 0x36, 0x65, 0xff, 0xb0, 0x9c, 0xda, 0x6e, 0x85, 0x2a, 0xa8, 0x88, 0xdc, + 0x5d, 0x90, 0x40, 0xa8, 0x72, 0xe3, 0x69, 0x32, 0x6a, 0xe2, 0xf1, 0x7a, 0xc6, 0xa5, 0xe5, 0xc4, + 0x89, 0x33, 0x1f, 0x81, 0x03, 0x37, 0xbe, 0x48, 0x8f, 0x1c, 0x39, 0x2d, 0x6c, 0xee, 0x7c, 0x07, + 0x34, 0xe3, 0x71, 0xed, 0x24, 0x35, 0x49, 0x10, 0x97, 0x66, 0xde, 0xcc, 0xfb, 0xcd, 0xfc, 0xde, + 0x7f, 0x17, 0x3e, 0xe9, 0x11, 0xde, 0x8f, 0x4e, 0xad, 0x2e, 0x1d, 0xda, 0x5d, 0xea, 0x73, 0x97, + 0xf8, 0x38, 0xf4, 0xb2, 0xcb, 0x01, 0xf1, 0xa3, 0x4b, 0x9b, 0xf5, 0xc9, 0xd0, 0xbe, 0xd8, 0x96, + 0xbf, 0x56, 0x10, 0x52, 0x4e, 0x51, 0x33, 0x55, 0xb2, 0xc2, 0xc8, 0xe7, 0x64, 0x88, 0x2d, 0xa9, + 0x6c, 0x49, 0xa5, 0x8b, 0xed, 0xfa, 0xbd, 0x1e, 0xa5, 0xbd, 0x01, 0xb6, 0xa5, 0xfe, 0x69, 0x74, + 0x66, 0xbb, 0xfe, 0x55, 0x0c, 0xae, 0xdf, 0x9f, 0x3c, 0xc2, 0xc3, 0x80, 0x27, 0x87, 0x1b, 0x3d, + 0xda, 0xa3, 0x72, 0x69, 0x8b, 0x95, 0xda, 0xdd, 0x9a, 0x84, 0x88, 0x17, 0x19, 0x77, 0x87, 0x81, + 0x52, 0x78, 0x3a, 0xd3, 0x16, 0x37, 0x20, 0x36, 0xbf, 0x0a, 0x30, 0xb3, 0x87, 0x34, 0xf2, 0xb9, + 0xc2, 0xbd, 0x58, 0x00, 0xc7, 0x5d, 0x76, 0x2e, 0xff, 0x28, 0xec, 0xc1, 0x5c, 0x58, 0x86, 0xc3, + 0x0b, 0xd2, 0xc5, 0xcc, 0xc6, 0x17, 0xd8, 0xe7, 0x4c, 0x38, 0x32, 0xf1, 0x98, 0xbc, 0xc6, 0xfc, + 0xbb, 0x00, 0xeb, 0xfb, 0x21, 0x76, 0x39, 0x7e, 0xe5, 0xb2, 0x73, 0x07, 0xbf, 0x89, 0x30, 0xe3, + 0x68, 0x13, 0x0a, 0xc4, 0x33, 0xb4, 0xa6, 0xd6, 0xaa, 0xec, 0xe9, 0xa3, 0xb7, 0x5b, 0x85, 0xc3, + 0x97, 0x4e, 0x81, 0x78, 0x68, 0x13, 0xf4, 0xd3, 0xc8, 0xf7, 0x06, 0xd8, 0x28, 0x88, 0x33, 0x47, + 0x49, 0xc8, 0x80, 0x15, 0x75, 0xad, 0x51, 0x94, 0x07, 0x89, 0x88, 0x6c, 0xd0, 0x43, 0x4a, 0xf9, + 0x19, 0x33, 0x4a, 0xcd, 0x62, 0xab, 0xda, 0x7e, 0xdf, 0xca, 0x04, 0x4f, 0x5a, 0x66, 0x1d, 0x09, + 0x8f, 0x38, 0x4a, 0x0d, 0xd5, 0xa1, 0xcc, 0x71, 0x38, 0x24, 0xbe, 0x3b, 0x30, 0x96, 0x9b, 0x5a, + 0xab, 0xec, 0xdc, 0xc8, 0x68, 0x03, 0x96, 0x19, 0xf7, 0x88, 0x6f, 0xe8, 0xf2, 0x91, 0x58, 0x10, + 0xa4, 0x18, 0xf7, 0x68, 0xc4, 0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x70, 0x7b, 0x40, + 0x8b, 0x39, 0x01, 0x2d, 0x8d, 0x05, 0xb4, 0x05, 0x25, 0x16, 0xe0, 0xae, 0x4c, 0x97, 0xbc, 0x00, + 0x48, 0x0d, 0xf3, 0x43, 0xb8, 0x33, 0xc6, 0x30, 0xd7, 0xfd, 0x0e, 0xac, 0x39, 0x98, 0x91, 0x1f, + 0x70, 0x87, 0x5f, 0xe5, 0x5a, 0x2c, 0xe8, 0x7f, 0x4f, 0x3c, 0xde, 0x57, 0x9e, 0x8f, 0x05, 0x41, + 0xb3, 0x8f, 0x49, 0xaf, 0x1f, 0xd3, 0xaf, 0x39, 0x4a, 0x32, 0x7f, 0x2d, 0x40, 0x4d, 0xc4, 0x25, + 0x8d, 0xe8, 0xa2, 0x65, 0xa6, 0x18, 0x14, 0x53, 0x06, 0x3b, 0xc2, 0x25, 0x32, 0xf8, 0xc2, 0x25, + 0xab, 0xed, 0xfb, 0xd9, 0xf2, 0xba, 0xd8, 0x56, 0x15, 0x16, 0x67, 0x83, 0xa3, 0x54, 0xd1, 0x0b, + 0xa8, 0x04, 0xb1, 0x07, 0x30, 0x33, 0x96, 0x65, 0x59, 0x7e, 0x70, 0x2b, 0x2e, 0xf1, 0x53, 0xaa, + 0xfe, 0x3f, 0x95, 0x60, 0x36, 0x27, 0x2a, 0xe3, 0x39, 0x61, 0x1e, 0x42, 0xf5, 0x73, 0x32, 0x18, + 0xa4, 0xad, 0x48, 0x67, 0xa4, 0x97, 0x24, 0x4f, 0xcd, 0x51, 0x92, 0xf0, 0x85, 0x3b, 0x18, 0x48, + 0x07, 0x95, 0x1d, 0xb1, 0x9c, 0xf6, 0x8e, 0xf9, 0x1c, 0x56, 0xf7, 0x07, 0x94, 0xe1, 0xc3, 0x2f, + 0xff, 0x35, 0x86, 0x69, 0x0a, 0x96, 0x95, 0x41, 0xe6, 0x47, 0xf0, 0xde, 0x17, 0x84, 0xf1, 0x0e, + 0xf1, 0xd8, 0x8c, 0x9e, 0x68, 0x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xb4, 0x6f, + 0x76, 0x16, 0xfb, 0x27, 0xed, 0x53, 0xf1, 0x7b, 0xaa, 0xcb, 0xeb, 0x77, 0xfe, 0x09, 0x00, 0x00, + 0xff, 0xff, 0xe2, 0x51, 0xa8, 0x39, 0xe2, 0x0d, 0x00, 0x00, } diff --git a/linux/shim/v1/shim.proto b/linux/shim/v1/shim.proto index 1a877672a..9626bdcf9 100644 --- a/linux/shim/v1/shim.proto +++ b/linux/shim/v1/shim.proto @@ -63,6 +63,7 @@ message CreateTaskRequest { string stderr = 8; string checkpoint = 9; string parent_checkpoint = 10; + google.protobuf.Any options = 11; } message CreateTaskResponse { @@ -130,7 +131,7 @@ message ListPidsResponse{ message CheckpointTaskRequest { string path = 1; - map options = 2; + google.protobuf.Any options = 2; } message ShimInfoResponse { diff --git a/linux/task.go b/linux/task.go index 14844aa6f..a4b3d7f22 100644 --- a/linux/task.go +++ b/linux/task.go @@ -160,10 +160,12 @@ func (t *Task) CloseIO(ctx context.Context, pid uint32) error { return err } -func (t *Task) Checkpoint(ctx context.Context, path string, options map[string]string) error { +func (t *Task) Checkpoint(ctx context.Context, path string, options []byte) error { r := &shim.CheckpointTaskRequest{ - Path: path, - Options: options, + Path: path, + Options: &protobuf.Any{ + Value: options, + }, } if _, err := t.shim.Checkpoint(ctx, r); err != nil { return errors.New(grpc.ErrorDesc(err)) diff --git a/runtime/runtime.go b/runtime/runtime.go index c2eb902f4..a6893cfd9 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -20,8 +20,11 @@ type CreateOpts struct { // Rootfs mounts to perform to gain access to the container's filesystem Rootfs []mount.Mount // IO for the container's main process - IO IO + IO IO + // Checkpoint digest to restore container state Checkpoint string + // Options for the runtime and container + Options []byte } type Exit struct { diff --git a/runtime/task.go b/runtime/task.go index 41dc2257a..5afd43361 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -32,7 +32,7 @@ type Task interface { // CloseStdin closes the processes stdin CloseIO(context.Context, uint32) error // Checkpoint checkpoints a container to an image with live system data - Checkpoint(context.Context, string, map[string]string) error + Checkpoint(context.Context, string, []byte) error // DeleteProcess deletes a specific exec process via the pid DeleteProcess(context.Context, uint32) (*Exit, error) // Update sets the provided resources to a running task diff --git a/services/tasks/service.go b/services/tasks/service.go index 51b1e4e76..32a68598a 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -121,7 +121,10 @@ func (s *Service) Create(ctx context.Context, r *api.CreateTaskRequest) (*api.Cr if err != nil { return nil, errdefs.ToGRPC(err) } - + var options []byte + if r.Options != nil { + options = r.Options.Value + } opts := runtime.CreateOpts{ Spec: container.Spec, IO: runtime.IO{ @@ -131,6 +134,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateTaskRequest) (*api.Cr Terminal: r.Terminal, }, Checkpoint: checkpointPath, + Options: options, } for _, m := range r.Rootfs { opts.Rootfs = append(opts.Rootfs, mount.Mount{ @@ -414,7 +418,11 @@ func (s *Service) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest) return nil, err } defer os.RemoveAll(image) - if err := t.Checkpoint(ctx, image, r.Options); err != nil { + var options []byte + if r.Options != nil { + options = r.Options.Value + } + if err := t.Checkpoint(ctx, image, options); err != nil { return nil, err } // write checkpoint to the content store diff --git a/task.go b/task.go index d08f4944e..b1c38a6c5 100644 --- a/task.go +++ b/task.go @@ -248,15 +248,9 @@ func (t *task) Resize(ctx context.Context, w, h uint32) error { return err } -func WithExit(r *tasks.CheckpointTaskRequest) error { - r.Options["exit"] = "true" - return nil -} - func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Descriptor, err error) { request := &tasks.CheckpointTaskRequest{ ContainerID: t.containerID, - Options: make(map[string]string), } for _, o := range opts { if err := o(request); err != nil { diff --git a/windows/container.go b/windows/container.go index bd26fe343..4da13c6d4 100644 --- a/windows/container.go +++ b/windows/container.go @@ -187,7 +187,7 @@ func (c *container) Pids(ctx context.Context) ([]uint32, error) { return pids, nil } -func (c *container) Checkpoint(ctx context.Context, _ string, _ map[string]string) error { +func (c *container) Checkpoint(ctx context.Context, _ string, _ []byte) error { return fmt.Errorf("Windows containers do not support checkpoint") }