X Tutup
Skip to content

Commit 0961807

Browse files
committed
rename runcopts to runctypes
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
1 parent 807f4d2 commit 0961807

File tree

10 files changed

+69
-69
lines changed

10 files changed

+69
-69
lines changed

Protobuild.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ ignore_files = [
4141

4242
# Lock down runc config
4343
[[descriptors]]
44-
prefix = "github.com/containerd/containerd/linux/runcopts"
45-
target = "linux/runcopts/next.pb.txt"
44+
prefix = "github.com/containerd/containerd/linux/runctypes"
45+
target = "linux/runctypes/next.pb.txt"
4646
ignore_files = [
4747
"google/protobuf/descriptor.proto",
4848
"gogoproto/gogo.proto"

container_linux_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/containerd/cgroups"
1919
"github.com/containerd/containerd/containers"
2020
"github.com/containerd/containerd/errdefs"
21-
"github.com/containerd/containerd/linux/runcopts"
21+
"github.com/containerd/containerd/linux/runctypes"
2222
specs "github.com/opencontainers/runtime-spec/specs-go"
2323
"github.com/pkg/errors"
2424
"golang.org/x/sys/unix"
@@ -146,7 +146,7 @@ func TestShimInCgroup(t *testing.T) {
146146
defer cg.Delete()
147147

148148
task, err := container.NewTask(ctx, empty(), func(_ context.Context, client *Client, r *TaskInfo) error {
149-
r.Options = &runcopts.CreateOptions{
149+
r.Options = &runctypes.CreateOptions{
150150
ShimCgroup: path,
151151
}
152152
return nil
@@ -887,7 +887,7 @@ func TestContainerRuntimeOptions(t *testing.T) {
887887
ctx, id,
888888
WithNewSpec(withImageConfig(image), withExitStatus(7)),
889889
withNewSnapshot(id, image),
890-
WithRuntime("io.containerd.runtime.v1.linux", &runcopts.RuncOptions{Runtime: "no-runc"}),
890+
WithRuntime("io.containerd.runtime.v1.linux", &runctypes.RuncOptions{Runtime: "no-runc"}),
891891
)
892892
if err != nil {
893893
t.Error(err)
@@ -1040,7 +1040,7 @@ func testUserNamespaces(t *testing.T, readonlyRootFS bool) {
10401040
defer container.Delete(ctx, WithSnapshotCleanup)
10411041

10421042
task, err := container.NewTask(ctx, Stdio, func(_ context.Context, client *Client, r *TaskInfo) error {
1043-
r.Options = &runcopts.CreateOptions{
1043+
r.Options = &runctypes.CreateOptions{
10441044
IoUid: 1000,
10451045
IoGid: 1000,
10461046
}

linux/bundle.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"path/filepath"
1111

1212
"github.com/containerd/containerd/events/exchange"
13-
"github.com/containerd/containerd/linux/runcopts"
13+
"github.com/containerd/containerd/linux/runctypes"
1414
"github.com/containerd/containerd/linux/shim"
1515
"github.com/containerd/containerd/linux/shim/client"
1616
"github.com/pkg/errors"
@@ -72,32 +72,32 @@ type bundle struct {
7272
}
7373

7474
// ShimOpt specifies shim options for initialization and connection
75-
type ShimOpt func(*bundle, string, *runcopts.RuncOptions) (shim.Config, client.Opt)
75+
type ShimOpt func(*bundle, string, *runctypes.RuncOptions) (shim.Config, client.Opt)
7676

7777
// ShimRemote is a ShimOpt for connecting and starting a remote shim
7878
func ShimRemote(shimBinary, daemonAddress, cgroup string, nonewns, debug bool, exitHandler func()) ShimOpt {
79-
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.Opt) {
79+
return func(b *bundle, ns string, ropts *runctypes.RuncOptions) (shim.Config, client.Opt) {
8080
return b.shimConfig(ns, ropts),
8181
client.WithStart(shimBinary, b.shimAddress(ns), daemonAddress, cgroup, nonewns, debug, exitHandler)
8282
}
8383
}
8484

8585
// ShimLocal is a ShimOpt for using an in process shim implementation
8686
func ShimLocal(exchange *exchange.Exchange) ShimOpt {
87-
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.Opt) {
87+
return func(b *bundle, ns string, ropts *runctypes.RuncOptions) (shim.Config, client.Opt) {
8888
return b.shimConfig(ns, ropts), client.WithLocal(exchange)
8989
}
9090
}
9191

9292
// ShimConnect is a ShimOpt for connecting to an existing remote shim
9393
func ShimConnect() ShimOpt {
94-
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.Opt) {
94+
return func(b *bundle, ns string, ropts *runctypes.RuncOptions) (shim.Config, client.Opt) {
9595
return b.shimConfig(ns, ropts), client.WithConnect(b.shimAddress(ns))
9696
}
9797
}
9898

9999
// NewShimClient connects to the shim managing the bundle and tasks creating it if needed
100-
func (b *bundle) NewShimClient(ctx context.Context, namespace string, getClientOpts ShimOpt, runcOpts *runcopts.RuncOptions) (*client.Client, error) {
100+
func (b *bundle) NewShimClient(ctx context.Context, namespace string, getClientOpts ShimOpt, runcOpts *runctypes.RuncOptions) (*client.Client, error) {
101101
cfg, opt := getClientOpts(b, namespace, runcOpts)
102102
return client.New(ctx, cfg, opt)
103103
}
@@ -120,7 +120,7 @@ func (b *bundle) shimAddress(namespace string) string {
120120
return filepath.Join(string(filepath.Separator), "containerd-shim", namespace, b.id, "shim.sock")
121121
}
122122

123-
func (b *bundle) shimConfig(namespace string, runcOptions *runcopts.RuncOptions) shim.Config {
123+
func (b *bundle) shimConfig(namespace string, runcOptions *runctypes.RuncOptions) shim.Config {
124124
var (
125125
criuPath string
126126
runtimeRoot string
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
file {
2-
name: "github.com/containerd/containerd/linux/runcopts/runc.proto"
2+
name: "github.com/containerd/containerd/linux/runctypes/runc.proto"
33
package: "containerd.linux.runc"
44
dependency: "gogoproto/gogo.proto"
55
message_type {
@@ -176,7 +176,7 @@ file {
176176
}
177177
}
178178
options {
179-
go_package: "github.com/containerd/containerd/linux/runcopts;runcopts"
179+
go_package: "github.com/containerd/containerd/linux/runctypes;runctypes"
180180
}
181181
syntax: "proto3"
182182
}
Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package containerd.linux.runc;
44

55
import "gogoproto/gogo.proto";
66

7-
option go_package = "github.com/containerd/containerd/linux/runcopts;runcopts";
7+
option go_package = "github.com/containerd/containerd/linux/runctypes;runctypes";
88

99
message RuncOptions {
1010
string runtime = 1;

linux/runtime.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/containerd/containerd/errdefs"
1818
"github.com/containerd/containerd/events/exchange"
1919
"github.com/containerd/containerd/identifiers"
20-
"github.com/containerd/containerd/linux/runcopts"
20+
"github.com/containerd/containerd/linux/runctypes"
2121
client "github.com/containerd/containerd/linux/shim"
2222
shim "github.com/containerd/containerd/linux/shim/v1"
2323
"github.com/containerd/containerd/log"
@@ -193,7 +193,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
193193
if err != nil {
194194
return nil, err
195195
}
196-
cgroup = v.(*runcopts.CreateOptions).ShimCgroup
196+
cgroup = v.(*runctypes.CreateOptions).ShimCgroup
197197
}
198198
exitHandler := func() {
199199
log.G(ctx).WithField("id", id).Info("shim reaped")
@@ -493,7 +493,7 @@ func (r *Runtime) getRuntime(ctx context.Context, ns, id string) (*runc.Runc, er
493493
}, nil
494494
}
495495

496-
func (r *Runtime) getRuncOptions(ctx context.Context, id string) (*runcopts.RuncOptions, error) {
496+
func (r *Runtime) getRuncOptions(ctx context.Context, id string) (*runctypes.RuncOptions, error) {
497497
var container containers.Container
498498

499499
if err := r.db.View(func(tx *bolt.Tx) error {
@@ -510,7 +510,7 @@ func (r *Runtime) getRuncOptions(ctx context.Context, id string) (*runcopts.Runc
510510
if err != nil {
511511
return nil, err
512512
}
513-
ropts, ok := v.(*runcopts.RuncOptions)
513+
ropts, ok := v.(*runctypes.RuncOptions)
514514
if !ok {
515515
return nil, errors.New("invalid runtime options format")
516516
}

linux/shim/init.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
"github.com/containerd/console"
1818
"github.com/containerd/containerd/identifiers"
19-
"github.com/containerd/containerd/linux/runcopts"
19+
"github.com/containerd/containerd/linux/runctypes"
2020
shimapi "github.com/containerd/containerd/linux/shim/v1"
2121
"github.com/containerd/containerd/log"
2222
"github.com/containerd/containerd/mount"
@@ -67,13 +67,13 @@ func (s *Service) newInitProcess(context context.Context, r *shimapi.CreateTaskR
6767
if err := identifiers.Validate(r.ID); err != nil {
6868
return nil, errors.Wrapf(err, "invalid task id")
6969
}
70-
var options runcopts.CreateOptions
70+
var options runctypes.CreateOptions
7171
if r.Options != nil {
7272
v, err := typeurl.UnmarshalAny(r.Options)
7373
if err != nil {
7474
return nil, err
7575
}
76-
options = *v.(*runcopts.CreateOptions)
76+
options = *v.(*runctypes.CreateOptions)
7777
}
7878

7979
rootfs := filepath.Join(s.config.Path, "rootfs")
@@ -332,13 +332,13 @@ func (p *initProcess) Stdin() io.Closer {
332332
}
333333

334334
func (p *initProcess) checkpoint(context context.Context, r *shimapi.CheckpointTaskRequest) error {
335-
var options runcopts.CheckpointOptions
335+
var options runctypes.CheckpointOptions
336336
if r.Options != nil {
337337
v, err := typeurl.UnmarshalAny(r.Options)
338338
if err != nil {
339339
return err
340340
}
341-
options = *v.(*runcopts.CheckpointOptions)
341+
options = *v.(*runctypes.CheckpointOptions)
342342
}
343343
var actions []runc.CheckpointAction
344344
if !options.Exit {

linux/shim/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/containerd/containerd/api/types/task"
1616
"github.com/containerd/containerd/errdefs"
1717
"github.com/containerd/containerd/events"
18-
"github.com/containerd/containerd/linux/runcopts"
18+
"github.com/containerd/containerd/linux/runctypes"
1919
shimapi "github.com/containerd/containerd/linux/shim/v1"
2020
"github.com/containerd/containerd/log"
2121
"github.com/containerd/containerd/namespaces"
@@ -364,7 +364,7 @@ func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*sh
364364
}
365365
for _, p := range s.processes {
366366
if p.Pid() == int(pid) {
367-
d := &runcopts.ProcessDetails{
367+
d := &runctypes.ProcessDetails{
368368
ExecID: p.ID(),
369369
}
370370
a, err := typeurl.MarshalAny(d)

task_opts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"syscall"
66

77
"github.com/containerd/containerd/errdefs"
8-
"github.com/containerd/containerd/linux/runcopts"
8+
"github.com/containerd/containerd/linux/runctypes"
99
"github.com/containerd/containerd/mount"
1010
)
1111

@@ -22,7 +22,7 @@ func WithRootFS(mounts []mount.Mount) NewTaskOpts {
2222

2323
// WithExit causes the task to exit after a successful checkpoint
2424
func WithExit(r *CheckpointTaskInfo) error {
25-
r.Options = &runcopts.CheckpointOptions{
25+
r.Options = &runctypes.CheckpointOptions{
2626
Exit: true,
2727
}
2828
return nil

0 commit comments

Comments
 (0)
X Tutup