Skip to content

Commit 8eea644

Browse files
committed
Bump runtime-spec to v1.0.0-rc3
* Bump underlying runtime-spec to version 1.0.0-rc3 * Fix related changed struct names in config.go Signed-off-by: Zhang Wei <[email protected]>
1 parent 27a67c9 commit 8eea644

File tree

9 files changed

+133
-148
lines changed

9 files changed

+133
-148
lines changed

Godeps/Godeps.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/github.com/opencontainers/runtime-spec/specs-go/config.go

Lines changed: 106 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/github.com/opencontainers/runtime-spec/specs-go/state.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/github.com/opencontainers/runtime-spec/specs-go/version.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checkpoint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ func setManageCgroupsMode(context *cli.Context, options *libcontainer.CriuOpts)
102102
}
103103
}
104104

105-
var namespaceMapping = map[specs.NamespaceType]int{
105+
var namespaceMapping = map[specs.LinuxNamespaceType]int{
106106
specs.NetworkNamespace: syscall.CLONE_NEWNET,
107107
}
108108

109109
func setEmptyNsMask(context *cli.Context, options *libcontainer.CriuOpts) error {
110110
var nsmask int
111111

112112
for _, ns := range context.StringSlice("empty-ns") {
113-
f, exists := namespaceMapping[specs.NamespaceType(ns)]
113+
f, exists := namespaceMapping[specs.LinuxNamespaceType(ns)]
114114
if !exists {
115115
return fmt.Errorf("namespace %q is not supported", ns)
116116
}

libcontainer/specconv/spec_linux.go

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
const wildcard = -1
2222

23-
var namespaceMapping = map[specs.NamespaceType]configs.NamespaceType{
23+
var namespaceMapping = map[specs.LinuxNamespaceType]configs.NamespaceType{
2424
specs.PIDNamespace: configs.NEWPID,
2525
specs.NetworkNamespace: configs.NEWNET,
2626
specs.MountNamespace: configs.NEWNS,
@@ -377,8 +377,8 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*
377377
c.Resources.CpusetMems = *r.CPU.Mems
378378
}
379379
}
380-
if r.Pids != nil && r.Pids.Limit != nil {
381-
c.Resources.PidsLimit = *r.Pids.Limit
380+
if r.Pids != nil {
381+
c.Resources.PidsLimit = r.Pids.Limit
382382
}
383383
if r.BlockIO != nil {
384384
if r.BlockIO.Weight != nil {
@@ -402,52 +402,37 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*
402402
}
403403
if r.BlockIO.ThrottleReadBpsDevice != nil {
404404
for _, td := range r.BlockIO.ThrottleReadBpsDevice {
405-
var rate uint64
406-
if td.Rate != nil {
407-
rate = *td.Rate
408-
}
405+
rate := td.Rate
409406
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
410407
c.Resources.BlkioThrottleReadBpsDevice = append(c.Resources.BlkioThrottleReadBpsDevice, throttleDevice)
411408
}
412409
}
413410
if r.BlockIO.ThrottleWriteBpsDevice != nil {
414411
for _, td := range r.BlockIO.ThrottleWriteBpsDevice {
415-
var rate uint64
416-
if td.Rate != nil {
417-
rate = *td.Rate
418-
}
412+
rate := td.Rate
419413
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
420414
c.Resources.BlkioThrottleWriteBpsDevice = append(c.Resources.BlkioThrottleWriteBpsDevice, throttleDevice)
421415
}
422416
}
423417
if r.BlockIO.ThrottleReadIOPSDevice != nil {
424418
for _, td := range r.BlockIO.ThrottleReadIOPSDevice {
425-
var rate uint64
426-
if td.Rate != nil {
427-
rate = *td.Rate
428-
}
419+
rate := td.Rate
429420
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
430421
c.Resources.BlkioThrottleReadIOPSDevice = append(c.Resources.BlkioThrottleReadIOPSDevice, throttleDevice)
431422
}
432423
}
433424
if r.BlockIO.ThrottleWriteIOPSDevice != nil {
434425
for _, td := range r.BlockIO.ThrottleWriteIOPSDevice {
435-
var rate uint64
436-
if td.Rate != nil {
437-
rate = *td.Rate
438-
}
426+
rate := td.Rate
439427
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
440428
c.Resources.BlkioThrottleWriteIOPSDevice = append(c.Resources.BlkioThrottleWriteIOPSDevice, throttleDevice)
441429
}
442430
}
443431
}
444432
for _, l := range r.HugepageLimits {
445-
if l.Pagesize == nil || l.Limit == nil {
446-
return nil, fmt.Errorf("pagesize and limit can not be empty")
447-
}
448433
c.Resources.HugetlbLimit = append(c.Resources.HugetlbLimit, &configs.HugepageLimit{
449-
Pagesize: *l.Pagesize,
450-
Limit: *l.Limit,
434+
Pagesize: l.Pagesize,
435+
Limit: l.Limit,
451436
})
452437
}
453438
if r.DisableOOMKiller != nil {
@@ -574,7 +559,7 @@ func setupUserNamespace(spec *specs.Spec, config *configs.Config) error {
574559
if len(spec.Linux.UIDMappings) == 0 {
575560
return nil
576561
}
577-
create := func(m specs.IDMapping) configs.IDMap {
562+
create := func(m specs.LinuxIDMapping) configs.IDMap {
578563
return configs.IDMap{
579564
HostID: int(m.HostID),
580565
ContainerID: int(m.ContainerID),
@@ -682,7 +667,7 @@ func parseMountOptions(options []string) (int, []int, string, int) {
682667
return flag, pgflag, strings.Join(data, ","), extFlags
683668
}
684669

685-
func setupSeccomp(config *specs.Seccomp) (*configs.Seccomp, error) {
670+
func setupSeccomp(config *specs.LinuxSeccomp) (*configs.Seccomp, error) {
686671
if config == nil {
687672
return nil, nil
688673
}

libcontainer/specconv/spec_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestLinuxCgroupsPathNotSpecified(t *testing.T) {
4242
func TestDupNamespaces(t *testing.T) {
4343
spec := &specs.Spec{
4444
Linux: &specs.Linux{
45-
Namespaces: []specs.Namespace{
45+
Namespaces: []specs.LinuxNamespace{
4646
{
4747
Type: "pid",
4848
},

spec.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ container on your host.`,
9292
"CAP_KILL",
9393
"CAP_NET_BIND_SERVICE",
9494
},
95-
Rlimits: []specs.Rlimit{
95+
Rlimits: []specs.LinuxRlimit{
9696
{
9797
Type: "RLIMIT_NOFILE",
9898
Hard: uint64(1024),
@@ -162,15 +162,15 @@ container on your host.`,
162162
"/proc/sys",
163163
"/proc/sysrq-trigger",
164164
},
165-
Resources: &specs.Resources{
166-
Devices: []specs.DeviceCgroup{
165+
Resources: &specs.LinuxResources{
166+
Devices: []specs.LinuxDeviceCgroup{
167167
{
168168
Allow: false,
169169
Access: sPtr("rwm"),
170170
},
171171
},
172172
},
173-
Namespaces: []specs.Namespace{
173+
Namespaces: []specs.LinuxNamespace{
174174
{
175175
Type: "pid",
176176
},
@@ -246,7 +246,7 @@ func loadSpec(cPath string) (spec *specs.Spec, err error) {
246246
return spec, validateProcessSpec(&spec.Process)
247247
}
248248

249-
func createLibContainerRlimit(rlimit specs.Rlimit) (configs.Rlimit, error) {
249+
func createLibContainerRlimit(rlimit specs.LinuxRlimit) (configs.Rlimit, error) {
250250
rl, err := strToRlimit(rlimit.Type)
251251
if err != nil {
252252
return configs.Rlimit{}, err

update.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ other options are ignored.
114114
return err
115115
}
116116

117-
r := specs.Resources{
118-
Memory: &specs.Memory{
117+
r := specs.LinuxResources{
118+
Memory: &specs.LinuxMemory{
119119
Limit: u64Ptr(0),
120120
Reservation: u64Ptr(0),
121121
Swap: u64Ptr(0),
122122
Kernel: u64Ptr(0),
123123
KernelTCP: u64Ptr(0),
124124
},
125-
CPU: &specs.CPU{
125+
CPU: &specs.LinuxCPU{
126126
Shares: u64Ptr(0),
127127
Quota: u64Ptr(0),
128128
Period: u64Ptr(0),
@@ -131,7 +131,7 @@ other options are ignored.
131131
Cpus: sPtr(""),
132132
Mems: sPtr(""),
133133
},
134-
BlockIO: &specs.BlockIO{
134+
BlockIO: &specs.LinuxBlockIO{
135135
Weight: u16Ptr(0),
136136
},
137137
}

0 commit comments

Comments
 (0)