Permalink
Browse files

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 <zhangwei555@huawei.com>
  • Loading branch information...
1 parent 27a67c9 commit 8eea644ccc37b2a766ebee095bfaa4f1d3e20769 @WeiZhang555 WeiZhang555 committed Dec 17, 2016
View
@@ -59,8 +59,8 @@
},
{
"ImportPath": "github.com/opencontainers/runtime-spec/specs-go",
- "Comment": "v1.0.0-rc2-38-g1c7c27d",
- "Rev": "1c7c27d043c2a5e513a44084d2b10d77d1402b8c"
+ "Comment": "v1.0.0-rc3",
+ "Rev": "794ca7ac88234607f9d2c76da8a6e9bbbade8cb9"
},
{
"ImportPath": "github.com/seccomp/libseccomp-golang",
Oops, something went wrong.
@@ -3,7 +3,7 @@ package specs
// State holds information about the runtime state of the container.
type State struct {
// Version is the version of the specification that is supported.
- Version string `json:"version"`
+ Version string `json:"ociVersion"`
// ID is the container ID
ID string `json:"id"`
// Status is the runtime state of the container.
@@ -11,7 +11,7 @@ const (
VersionPatch = 0
// VersionDev indicates development branch. Releases will be empty string.
- VersionDev = "-rc2-dev"
+ VersionDev = "-rc3"
)
// Version is the specification version that the package types support.
View
@@ -102,15 +102,15 @@ func setManageCgroupsMode(context *cli.Context, options *libcontainer.CriuOpts)
}
}
-var namespaceMapping = map[specs.NamespaceType]int{
+var namespaceMapping = map[specs.LinuxNamespaceType]int{
specs.NetworkNamespace: syscall.CLONE_NEWNET,
}
func setEmptyNsMask(context *cli.Context, options *libcontainer.CriuOpts) error {
var nsmask int
for _, ns := range context.StringSlice("empty-ns") {
- f, exists := namespaceMapping[specs.NamespaceType(ns)]
+ f, exists := namespaceMapping[specs.LinuxNamespaceType(ns)]
if !exists {
return fmt.Errorf("namespace %q is not supported", ns)
}
@@ -20,7 +20,7 @@ import (
const wildcard = -1
-var namespaceMapping = map[specs.NamespaceType]configs.NamespaceType{
+var namespaceMapping = map[specs.LinuxNamespaceType]configs.NamespaceType{
specs.PIDNamespace: configs.NEWPID,
specs.NetworkNamespace: configs.NEWNET,
specs.MountNamespace: configs.NEWNS,
@@ -377,8 +377,8 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*
c.Resources.CpusetMems = *r.CPU.Mems
}
}
- if r.Pids != nil && r.Pids.Limit != nil {
- c.Resources.PidsLimit = *r.Pids.Limit
+ if r.Pids != nil {
+ c.Resources.PidsLimit = r.Pids.Limit
}
if r.BlockIO != nil {
if r.BlockIO.Weight != nil {
@@ -402,52 +402,37 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*
}
if r.BlockIO.ThrottleReadBpsDevice != nil {
for _, td := range r.BlockIO.ThrottleReadBpsDevice {
- var rate uint64
- if td.Rate != nil {
- rate = *td.Rate
- }
+ rate := td.Rate
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
c.Resources.BlkioThrottleReadBpsDevice = append(c.Resources.BlkioThrottleReadBpsDevice, throttleDevice)
}
}
if r.BlockIO.ThrottleWriteBpsDevice != nil {
for _, td := range r.BlockIO.ThrottleWriteBpsDevice {
- var rate uint64
- if td.Rate != nil {
- rate = *td.Rate
- }
+ rate := td.Rate
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
c.Resources.BlkioThrottleWriteBpsDevice = append(c.Resources.BlkioThrottleWriteBpsDevice, throttleDevice)
}
}
if r.BlockIO.ThrottleReadIOPSDevice != nil {
for _, td := range r.BlockIO.ThrottleReadIOPSDevice {
- var rate uint64
- if td.Rate != nil {
- rate = *td.Rate
- }
+ rate := td.Rate
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
c.Resources.BlkioThrottleReadIOPSDevice = append(c.Resources.BlkioThrottleReadIOPSDevice, throttleDevice)
}
}
if r.BlockIO.ThrottleWriteIOPSDevice != nil {
for _, td := range r.BlockIO.ThrottleWriteIOPSDevice {
- var rate uint64
- if td.Rate != nil {
- rate = *td.Rate
- }
+ rate := td.Rate
throttleDevice := configs.NewThrottleDevice(td.Major, td.Minor, rate)
c.Resources.BlkioThrottleWriteIOPSDevice = append(c.Resources.BlkioThrottleWriteIOPSDevice, throttleDevice)
}
}
}
for _, l := range r.HugepageLimits {
- if l.Pagesize == nil || l.Limit == nil {
- return nil, fmt.Errorf("pagesize and limit can not be empty")
- }
c.Resources.HugetlbLimit = append(c.Resources.HugetlbLimit, &configs.HugepageLimit{
- Pagesize: *l.Pagesize,
- Limit: *l.Limit,
+ Pagesize: l.Pagesize,
+ Limit: l.Limit,
})
}
if r.DisableOOMKiller != nil {
@@ -574,7 +559,7 @@ func setupUserNamespace(spec *specs.Spec, config *configs.Config) error {
if len(spec.Linux.UIDMappings) == 0 {
return nil
}
- create := func(m specs.IDMapping) configs.IDMap {
+ create := func(m specs.LinuxIDMapping) configs.IDMap {
return configs.IDMap{
HostID: int(m.HostID),
ContainerID: int(m.ContainerID),
@@ -682,7 +667,7 @@ func parseMountOptions(options []string) (int, []int, string, int) {
return flag, pgflag, strings.Join(data, ","), extFlags
}
-func setupSeccomp(config *specs.Seccomp) (*configs.Seccomp, error) {
+func setupSeccomp(config *specs.LinuxSeccomp) (*configs.Seccomp, error) {
if config == nil {
return nil, nil
}
@@ -42,7 +42,7 @@ func TestLinuxCgroupsPathNotSpecified(t *testing.T) {
func TestDupNamespaces(t *testing.T) {
spec := &specs.Spec{
Linux: &specs.Linux{
- Namespaces: []specs.Namespace{
+ Namespaces: []specs.LinuxNamespace{
{
Type: "pid",
},
View
@@ -92,7 +92,7 @@ container on your host.`,
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
},
- Rlimits: []specs.Rlimit{
+ Rlimits: []specs.LinuxRlimit{
{
Type: "RLIMIT_NOFILE",
Hard: uint64(1024),
@@ -162,15 +162,15 @@ container on your host.`,
"/proc/sys",
"/proc/sysrq-trigger",
},
- Resources: &specs.Resources{
- Devices: []specs.DeviceCgroup{
+ Resources: &specs.LinuxResources{
+ Devices: []specs.LinuxDeviceCgroup{
{
Allow: false,
Access: sPtr("rwm"),
},
},
},
- Namespaces: []specs.Namespace{
+ Namespaces: []specs.LinuxNamespace{
{
Type: "pid",
},
@@ -246,7 +246,7 @@ func loadSpec(cPath string) (spec *specs.Spec, err error) {
return spec, validateProcessSpec(&spec.Process)
}
-func createLibContainerRlimit(rlimit specs.Rlimit) (configs.Rlimit, error) {
+func createLibContainerRlimit(rlimit specs.LinuxRlimit) (configs.Rlimit, error) {
rl, err := strToRlimit(rlimit.Type)
if err != nil {
return configs.Rlimit{}, err
View
@@ -114,15 +114,15 @@ other options are ignored.
return err
}
- r := specs.Resources{
- Memory: &specs.Memory{
+ r := specs.LinuxResources{
+ Memory: &specs.LinuxMemory{
Limit: u64Ptr(0),
Reservation: u64Ptr(0),
Swap: u64Ptr(0),
Kernel: u64Ptr(0),
KernelTCP: u64Ptr(0),
},
- CPU: &specs.CPU{
+ CPU: &specs.LinuxCPU{
Shares: u64Ptr(0),
Quota: u64Ptr(0),
Period: u64Ptr(0),
@@ -131,7 +131,7 @@ other options are ignored.
Cpus: sPtr(""),
Mems: sPtr(""),
},
- BlockIO: &specs.BlockIO{
+ BlockIO: &specs.LinuxBlockIO{
Weight: u16Ptr(0),
},
}

0 comments on commit 8eea644

Please sign in to comment.