mirror of
https://github.com/containers/podman.git
synced 2025-05-25 02:57:21 +08:00
vendor containerd/cgroups
We need to vendor in the latest containerd/cgroups for a fix related to slice delegation and systemd <= 239. The opencontainer/runtime-spec is brought along for the ride. Signed-off-by: baude <bbaude@redhat.com> Closes: #1414 Approved by: mheon
This commit is contained in:
@ -60,7 +60,7 @@ func TestPostDeleteHooks(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stateRegexp := `{"ociVersion":"1\.0\.0","id":"123abc","status":"stopped","bundle":"` + strings.TrimSuffix(os.TempDir(), "/") + `/libpod_test_[0-9]*","annotations":{"a":"b"}}`
|
stateRegexp := `{"ociVersion":"1\.0\.1-dev","id":"123abc","status":"stopped","bundle":"` + strings.TrimSuffix(os.TempDir(), "/") + `/libpod_test_[0-9]*","annotations":{"a":"b"}}`
|
||||||
for _, path := range []string{statePath, copyPath} {
|
for _, path := range []string{statePath, copyPath} {
|
||||||
t.Run(path, func(t *testing.T) {
|
t.Run(path, func(t *testing.T) {
|
||||||
content, err := ioutil.ReadFile(path)
|
content, err := ioutil.ReadFile(path)
|
||||||
|
@ -6,7 +6,7 @@ github.com/Microsoft/hcsshim 43f9725307998e09f2e3816c2c0c36dc98f0c982
|
|||||||
github.com/blang/semver v3.5.0
|
github.com/blang/semver v3.5.0
|
||||||
github.com/boltdb/bolt master
|
github.com/boltdb/bolt master
|
||||||
github.com/buger/goterm 2f8dfbc7dbbff5dd1d391ed91482c24df243b2d3
|
github.com/buger/goterm 2f8dfbc7dbbff5dd1d391ed91482c24df243b2d3
|
||||||
github.com/containerd/cgroups 77e628511d924b13a77cebdc73b757a47f6d751b
|
github.com/containerd/cgroups 58556f5ad8448d99a6f7bea69ea4bdb7747cfeb0
|
||||||
github.com/containerd/continuity master
|
github.com/containerd/continuity master
|
||||||
github.com/containernetworking/cni v0.7.0-alpha1
|
github.com/containernetworking/cni v0.7.0-alpha1
|
||||||
github.com/containernetworking/plugins 1562a1e60ed101aacc5e08ed9dbeba8e9f3d4ec1
|
github.com/containernetworking/plugins 1562a1e60ed101aacc5e08ed9dbeba8e9f3d4ec1
|
||||||
@ -48,7 +48,7 @@ github.com/mtrmac/gpgme b2432428689ca58c2b8e8dea9449d3295cf96fc9
|
|||||||
github.com/opencontainers/go-digest v1.0.0-rc0
|
github.com/opencontainers/go-digest v1.0.0-rc0
|
||||||
github.com/opencontainers/image-spec v1.0.0
|
github.com/opencontainers/image-spec v1.0.0
|
||||||
github.com/opencontainers/runc b4e2ecb452d9ee4381137cc0a7e6715b96bed6de
|
github.com/opencontainers/runc b4e2ecb452d9ee4381137cc0a7e6715b96bed6de
|
||||||
github.com/opencontainers/runtime-spec v1.0.0
|
github.com/opencontainers/runtime-spec d810dbc60d8c5aeeb3d054bd1132fab2121968ce
|
||||||
github.com/opencontainers/runtime-tools master
|
github.com/opencontainers/runtime-tools master
|
||||||
github.com/opencontainers/selinux b6fa367ed7f534f9ba25391cc2d467085dbb445a
|
github.com/opencontainers/selinux b6fa367ed7f534f9ba25391cc2d467085dbb445a
|
||||||
github.com/ostreedev/ostree-go master
|
github.com/ostreedev/ostree-go master
|
||||||
|
16
vendor/github.com/containerd/cgroups/blkio.go
generated
vendored
16
vendor/github.com/containerd/cgroups/blkio.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
46
vendor/github.com/containerd/cgroups/cgroup.go
generated
vendored
46
vendor/github.com/containerd/cgroups/cgroup.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -121,6 +137,36 @@ func (c *cgroup) add(process Process) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddTask moves the provided tasks (threads) into the new cgroup
|
||||||
|
func (c *cgroup) AddTask(process Process) error {
|
||||||
|
if process.Pid <= 0 {
|
||||||
|
return ErrInvalidPid
|
||||||
|
}
|
||||||
|
c.mu.Lock()
|
||||||
|
defer c.mu.Unlock()
|
||||||
|
if c.err != nil {
|
||||||
|
return c.err
|
||||||
|
}
|
||||||
|
return c.addTask(process)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cgroup) addTask(process Process) error {
|
||||||
|
for _, s := range pathers(c.subsystems) {
|
||||||
|
p, err := c.path(s.Name())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := ioutil.WriteFile(
|
||||||
|
filepath.Join(s.Path(p), cgroupTasks),
|
||||||
|
[]byte(strconv.Itoa(process.Pid)),
|
||||||
|
defaultFilePerm,
|
||||||
|
); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Delete will remove the control group from each of the subsystems registered
|
// Delete will remove the control group from each of the subsystems registered
|
||||||
func (c *cgroup) Delete() error {
|
func (c *cgroup) Delete() error {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
|
21
vendor/github.com/containerd/cgroups/control.go
generated
vendored
21
vendor/github.com/containerd/cgroups/control.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -8,6 +24,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
cgroupProcs = "cgroup.procs"
|
cgroupProcs = "cgroup.procs"
|
||||||
|
cgroupTasks = "tasks"
|
||||||
defaultDirPerm = 0755
|
defaultDirPerm = 0755
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,8 +49,10 @@ type Process struct {
|
|||||||
type Cgroup interface {
|
type Cgroup interface {
|
||||||
// New creates a new cgroup under the calling cgroup
|
// New creates a new cgroup under the calling cgroup
|
||||||
New(string, *specs.LinuxResources) (Cgroup, error)
|
New(string, *specs.LinuxResources) (Cgroup, error)
|
||||||
// Add adds a process to the cgroup
|
// Add adds a process to the cgroup (cgroup.procs)
|
||||||
Add(Process) error
|
Add(Process) error
|
||||||
|
// AddTask adds a process to the cgroup (tasks)
|
||||||
|
AddTask(Process) error
|
||||||
// Delete removes the cgroup as a whole
|
// Delete removes the cgroup as a whole
|
||||||
Delete() error
|
Delete() error
|
||||||
// MoveTo moves all the processes under the calling cgroup to the provided one
|
// MoveTo moves all the processes under the calling cgroup to the provided one
|
||||||
|
16
vendor/github.com/containerd/cgroups/cpu.go
generated
vendored
16
vendor/github.com/containerd/cgroups/cpu.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/cpuacct.go
generated
vendored
16
vendor/github.com/containerd/cgroups/cpuacct.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
20
vendor/github.com/containerd/cgroups/cpuset.go
generated
vendored
20
vendor/github.com/containerd/cgroups/cpuset.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -66,6 +82,10 @@ func (c *cpusetController) Create(path string, resources *specs.LinuxResources)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cpusetController) Update(path string, resources *specs.LinuxResources) error {
|
||||||
|
return c.Create(path, resources)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *cpusetController) getValues(path string) (cpus []byte, mems []byte, err error) {
|
func (c *cpusetController) getValues(path string) (cpus []byte, mems []byte, err error) {
|
||||||
if cpus, err = ioutil.ReadFile(filepath.Join(path, "cpuset.cpus")); err != nil && !os.IsNotExist(err) {
|
if cpus, err = ioutil.ReadFile(filepath.Join(path, "cpuset.cpus")); err != nil && !os.IsNotExist(err) {
|
||||||
return
|
return
|
||||||
|
25
vendor/github.com/containerd/cgroups/devices.go
generated
vendored
25
vendor/github.com/containerd/cgroups/devices.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -42,6 +58,9 @@ func (d *devicesController) Create(path string, resources *specs.LinuxResources)
|
|||||||
if device.Allow {
|
if device.Allow {
|
||||||
file = allowDeviceFile
|
file = allowDeviceFile
|
||||||
}
|
}
|
||||||
|
if device.Type == "" {
|
||||||
|
device.Type = "a"
|
||||||
|
}
|
||||||
if err := ioutil.WriteFile(
|
if err := ioutil.WriteFile(
|
||||||
filepath.Join(d.Path(path), file),
|
filepath.Join(d.Path(path), file),
|
||||||
[]byte(deviceString(device)),
|
[]byte(deviceString(device)),
|
||||||
@ -58,11 +77,11 @@ func (d *devicesController) Update(path string, resources *specs.LinuxResources)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deviceString(device specs.LinuxDeviceCgroup) string {
|
func deviceString(device specs.LinuxDeviceCgroup) string {
|
||||||
return fmt.Sprintf("%c %s:%s %s",
|
return fmt.Sprintf("%s %s:%s %s",
|
||||||
&device.Type,
|
device.Type,
|
||||||
deviceNumber(device.Major),
|
deviceNumber(device.Major),
|
||||||
deviceNumber(device.Minor),
|
deviceNumber(device.Minor),
|
||||||
&device.Access,
|
device.Access,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
vendor/github.com/containerd/cgroups/errors.go
generated
vendored
16
vendor/github.com/containerd/cgroups/errors.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/freezer.go
generated
vendored
16
vendor/github.com/containerd/cgroups/freezer.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/hierarchy.go
generated
vendored
16
vendor/github.com/containerd/cgroups/hierarchy.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
// Hierarchy enableds both unified and split hierarchy for cgroups
|
// Hierarchy enableds both unified and split hierarchy for cgroups
|
||||||
|
16
vendor/github.com/containerd/cgroups/hugetlb.go
generated
vendored
16
vendor/github.com/containerd/cgroups/hugetlb.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/memory.go
generated
vendored
16
vendor/github.com/containerd/cgroups/memory.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
437
vendor/github.com/containerd/cgroups/metrics.pb.go
generated
vendored
437
vendor/github.com/containerd/cgroups/metrics.pb.go
generated
vendored
@ -19,6 +19,8 @@
|
|||||||
MemoryEntry
|
MemoryEntry
|
||||||
BlkIOStat
|
BlkIOStat
|
||||||
BlkIOEntry
|
BlkIOEntry
|
||||||
|
RdmaStat
|
||||||
|
RdmaEntry
|
||||||
*/
|
*/
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
@ -49,6 +51,7 @@ type Metrics struct {
|
|||||||
CPU *CPUStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"`
|
CPU *CPUStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"`
|
||||||
Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"`
|
Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"`
|
||||||
Blkio *BlkIOStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"`
|
Blkio *BlkIOStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"`
|
||||||
|
Rdma *RdmaStat `protobuf:"bytes,6,opt,name=rdma" json:"rdma,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Metrics) Reset() { *m = Metrics{} }
|
func (m *Metrics) Reset() { *m = Metrics{} }
|
||||||
@ -187,6 +190,25 @@ func (m *BlkIOEntry) Reset() { *m = BlkIOEntry{} }
|
|||||||
func (*BlkIOEntry) ProtoMessage() {}
|
func (*BlkIOEntry) ProtoMessage() {}
|
||||||
func (*BlkIOEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{9} }
|
func (*BlkIOEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{9} }
|
||||||
|
|
||||||
|
type RdmaStat struct {
|
||||||
|
Current []*RdmaEntry `protobuf:"bytes,1,rep,name=current" json:"current,omitempty"`
|
||||||
|
Limit []*RdmaEntry `protobuf:"bytes,2,rep,name=limit" json:"limit,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RdmaStat) Reset() { *m = RdmaStat{} }
|
||||||
|
func (*RdmaStat) ProtoMessage() {}
|
||||||
|
func (*RdmaStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{10} }
|
||||||
|
|
||||||
|
type RdmaEntry struct {
|
||||||
|
Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
|
||||||
|
HcaHandles uint32 `protobuf:"varint,2,opt,name=hca_handles,json=hcaHandles,proto3" json:"hca_handles,omitempty"`
|
||||||
|
HcaObjects uint32 `protobuf:"varint,3,opt,name=hca_objects,json=hcaObjects,proto3" json:"hca_objects,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RdmaEntry) Reset() { *m = RdmaEntry{} }
|
||||||
|
func (*RdmaEntry) ProtoMessage() {}
|
||||||
|
func (*RdmaEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{11} }
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v1.Metrics")
|
proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v1.Metrics")
|
||||||
proto.RegisterType((*HugetlbStat)(nil), "io.containerd.cgroups.v1.HugetlbStat")
|
proto.RegisterType((*HugetlbStat)(nil), "io.containerd.cgroups.v1.HugetlbStat")
|
||||||
@ -198,6 +220,8 @@ func init() {
|
|||||||
proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v1.MemoryEntry")
|
proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v1.MemoryEntry")
|
||||||
proto.RegisterType((*BlkIOStat)(nil), "io.containerd.cgroups.v1.BlkIOStat")
|
proto.RegisterType((*BlkIOStat)(nil), "io.containerd.cgroups.v1.BlkIOStat")
|
||||||
proto.RegisterType((*BlkIOEntry)(nil), "io.containerd.cgroups.v1.BlkIOEntry")
|
proto.RegisterType((*BlkIOEntry)(nil), "io.containerd.cgroups.v1.BlkIOEntry")
|
||||||
|
proto.RegisterType((*RdmaStat)(nil), "io.containerd.cgroups.v1.RdmaStat")
|
||||||
|
proto.RegisterType((*RdmaEntry)(nil), "io.containerd.cgroups.v1.RdmaEntry")
|
||||||
}
|
}
|
||||||
func (m *Metrics) Marshal() (dAtA []byte, err error) {
|
func (m *Metrics) Marshal() (dAtA []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
@ -266,6 +290,16 @@ func (m *Metrics) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
i += n4
|
i += n4
|
||||||
}
|
}
|
||||||
|
if m.Rdma != nil {
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
i++
|
||||||
|
i = encodeVarintMetrics(dAtA, i, uint64(m.Rdma.Size()))
|
||||||
|
n5, err := m.Rdma.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n5
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,6 +766,7 @@ func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
|
||||||
if m.Limit != 0 {
|
if m.Limit != 0 {
|
||||||
dAtA[i] = 0x8
|
dAtA[i] = 0x8
|
||||||
i++
|
i++
|
||||||
@ -914,6 +949,82 @@ func (m *BlkIOEntry) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *RdmaStat) 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 *RdmaStat) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
var i int
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Current) > 0 {
|
||||||
|
for _, msg := range m.Current {
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
i++
|
||||||
|
i = encodeVarintMetrics(dAtA, i, uint64(msg.Size()))
|
||||||
|
n, err := msg.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.Limit) > 0 {
|
||||||
|
for _, msg := range m.Limit {
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
i++
|
||||||
|
i = encodeVarintMetrics(dAtA, i, uint64(msg.Size()))
|
||||||
|
n, err := msg.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RdmaEntry) 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 *RdmaEntry) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
var i int
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Device) > 0 {
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
i++
|
||||||
|
i = encodeVarintMetrics(dAtA, i, uint64(len(m.Device)))
|
||||||
|
i += copy(dAtA[i:], m.Device)
|
||||||
|
}
|
||||||
|
if m.HcaHandles != 0 {
|
||||||
|
dAtA[i] = 0x10
|
||||||
|
i++
|
||||||
|
i = encodeVarintMetrics(dAtA, i, uint64(m.HcaHandles))
|
||||||
|
}
|
||||||
|
if m.HcaObjects != 0 {
|
||||||
|
dAtA[i] = 0x18
|
||||||
|
i++
|
||||||
|
i = encodeVarintMetrics(dAtA, i, uint64(m.HcaObjects))
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int {
|
func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int {
|
||||||
dAtA[offset] = uint8(v)
|
dAtA[offset] = uint8(v)
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
dAtA[offset+1] = uint8(v >> 8)
|
||||||
@ -966,6 +1077,10 @@ func (m *Metrics) Size() (n int) {
|
|||||||
l = m.Blkio.Size()
|
l = m.Blkio.Size()
|
||||||
n += 1 + l + sovMetrics(uint64(l))
|
n += 1 + l + sovMetrics(uint64(l))
|
||||||
}
|
}
|
||||||
|
if m.Rdma != nil {
|
||||||
|
l = m.Rdma.Size()
|
||||||
|
n += 1 + l + sovMetrics(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1264,6 +1379,40 @@ func (m *BlkIOEntry) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *RdmaStat) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Current) > 0 {
|
||||||
|
for _, e := range m.Current {
|
||||||
|
l = e.Size()
|
||||||
|
n += 1 + l + sovMetrics(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.Limit) > 0 {
|
||||||
|
for _, e := range m.Limit {
|
||||||
|
l = e.Size()
|
||||||
|
n += 1 + l + sovMetrics(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RdmaEntry) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Device)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovMetrics(uint64(l))
|
||||||
|
}
|
||||||
|
if m.HcaHandles != 0 {
|
||||||
|
n += 1 + sovMetrics(uint64(m.HcaHandles))
|
||||||
|
}
|
||||||
|
if m.HcaObjects != 0 {
|
||||||
|
n += 1 + sovMetrics(uint64(m.HcaObjects))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func sovMetrics(x uint64) (n int) {
|
func sovMetrics(x uint64) (n int) {
|
||||||
for {
|
for {
|
||||||
n++
|
n++
|
||||||
@ -1287,6 +1436,7 @@ func (this *Metrics) String() string {
|
|||||||
`CPU:` + strings.Replace(fmt.Sprintf("%v", this.CPU), "CPUStat", "CPUStat", 1) + `,`,
|
`CPU:` + strings.Replace(fmt.Sprintf("%v", this.CPU), "CPUStat", "CPUStat", 1) + `,`,
|
||||||
`Memory:` + strings.Replace(fmt.Sprintf("%v", this.Memory), "MemoryStat", "MemoryStat", 1) + `,`,
|
`Memory:` + strings.Replace(fmt.Sprintf("%v", this.Memory), "MemoryStat", "MemoryStat", 1) + `,`,
|
||||||
`Blkio:` + strings.Replace(fmt.Sprintf("%v", this.Blkio), "BlkIOStat", "BlkIOStat", 1) + `,`,
|
`Blkio:` + strings.Replace(fmt.Sprintf("%v", this.Blkio), "BlkIOStat", "BlkIOStat", 1) + `,`,
|
||||||
|
`Rdma:` + strings.Replace(fmt.Sprintf("%v", this.Rdma), "RdmaStat", "RdmaStat", 1) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -1440,6 +1590,29 @@ func (this *BlkIOEntry) String() string {
|
|||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
func (this *RdmaStat) String() string {
|
||||||
|
if this == nil {
|
||||||
|
return "nil"
|
||||||
|
}
|
||||||
|
s := strings.Join([]string{`&RdmaStat{`,
|
||||||
|
`Current:` + strings.Replace(fmt.Sprintf("%v", this.Current), "RdmaEntry", "RdmaEntry", 1) + `,`,
|
||||||
|
`Limit:` + strings.Replace(fmt.Sprintf("%v", this.Limit), "RdmaEntry", "RdmaEntry", 1) + `,`,
|
||||||
|
`}`,
|
||||||
|
}, "")
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
func (this *RdmaEntry) String() string {
|
||||||
|
if this == nil {
|
||||||
|
return "nil"
|
||||||
|
}
|
||||||
|
s := strings.Join([]string{`&RdmaEntry{`,
|
||||||
|
`Device:` + fmt.Sprintf("%v", this.Device) + `,`,
|
||||||
|
`HcaHandles:` + fmt.Sprintf("%v", this.HcaHandles) + `,`,
|
||||||
|
`HcaObjects:` + fmt.Sprintf("%v", this.HcaObjects) + `,`,
|
||||||
|
`}`,
|
||||||
|
}, "")
|
||||||
|
return s
|
||||||
|
}
|
||||||
func valueToStringMetrics(v interface{}) string {
|
func valueToStringMetrics(v interface{}) string {
|
||||||
rv := reflect.ValueOf(v)
|
rv := reflect.ValueOf(v)
|
||||||
if rv.IsNil() {
|
if rv.IsNil() {
|
||||||
@ -1451,6 +1624,7 @@ func valueToStringMetrics(v interface{}) string {
|
|||||||
func (m *Metrics) Unmarshal(dAtA []byte) error {
|
func (m *Metrics) Unmarshal(dAtA []byte) error {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
|
||||||
for iNdEx < l {
|
for iNdEx < l {
|
||||||
preIndex := iNdEx
|
preIndex := iNdEx
|
||||||
var wire uint64
|
var wire uint64
|
||||||
@ -1640,6 +1814,39 @@ func (m *Metrics) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Rdma", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthMetrics
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if m.Rdma == nil {
|
||||||
|
m.Rdma = &RdmaStat{}
|
||||||
|
}
|
||||||
|
if err := m.Rdma.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipMetrics(dAtA[iNdEx:])
|
skippy, err := skipMetrics(dAtA[iNdEx:])
|
||||||
@ -3656,6 +3863,236 @@ func (m *BlkIOEntry) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *RdmaStat) 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 ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
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: RdmaStat: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: RdmaStat: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthMetrics
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Current = append(m.Current, &RdmaEntry{})
|
||||||
|
if err := m.Current[len(m.Current)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthMetrics
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Limit = append(m.Limit, &RdmaEntry{})
|
||||||
|
if err := m.Limit[len(m.Limit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipMetrics(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if skippy < 0 {
|
||||||
|
return ErrInvalidLengthMetrics
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *RdmaEntry) 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 ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
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: RdmaEntry: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: RdmaEntry: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthMetrics
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Device = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field HcaHandles", wireType)
|
||||||
|
}
|
||||||
|
m.HcaHandles = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.HcaHandles |= (uint32(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field HcaObjects", wireType)
|
||||||
|
}
|
||||||
|
m.HcaObjects = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowMetrics
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.HcaObjects |= (uint32(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipMetrics(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if skippy < 0 {
|
||||||
|
return ErrInvalidLengthMetrics
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func skipMetrics(dAtA []byte) (n int, err error) {
|
func skipMetrics(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
12
vendor/github.com/containerd/cgroups/metrics.proto
generated
vendored
12
vendor/github.com/containerd/cgroups/metrics.proto
generated
vendored
@ -10,6 +10,7 @@ message Metrics {
|
|||||||
CPUStat cpu = 3 [(gogoproto.customname) = "CPU"];
|
CPUStat cpu = 3 [(gogoproto.customname) = "CPU"];
|
||||||
MemoryStat memory = 4;
|
MemoryStat memory = 4;
|
||||||
BlkIOStat blkio = 5;
|
BlkIOStat blkio = 5;
|
||||||
|
RdmaStat rdma = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message HugetlbStat {
|
message HugetlbStat {
|
||||||
@ -109,3 +110,14 @@ message BlkIOEntry {
|
|||||||
uint64 minor = 4;
|
uint64 minor = 4;
|
||||||
uint64 value = 5;
|
uint64 value = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RdmaStat {
|
||||||
|
repeated RdmaEntry current = 1;
|
||||||
|
repeated RdmaEntry limit = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RdmaEntry {
|
||||||
|
string device = 1;
|
||||||
|
uint32 hca_handles = 2;
|
||||||
|
uint32 hca_objects = 3;
|
||||||
|
}
|
||||||
|
16
vendor/github.com/containerd/cgroups/named.go
generated
vendored
16
vendor/github.com/containerd/cgroups/named.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
|
16
vendor/github.com/containerd/cgroups/net_cls.go
generated
vendored
16
vendor/github.com/containerd/cgroups/net_cls.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/net_prio.go
generated
vendored
16
vendor/github.com/containerd/cgroups/net_prio.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/paths.go
generated
vendored
16
vendor/github.com/containerd/cgroups/paths.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
16
vendor/github.com/containerd/cgroups/perf_event.go
generated
vendored
16
vendor/github.com/containerd/cgroups/perf_event.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
|
16
vendor/github.com/containerd/cgroups/pids.go
generated
vendored
16
vendor/github.com/containerd/cgroups/pids.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
153
vendor/github.com/containerd/cgroups/rdma.go
generated
vendored
Normal file
153
vendor/github.com/containerd/cgroups/rdma.go
generated
vendored
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cgroups
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"math"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
type rdmaController struct {
|
||||||
|
root string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *rdmaController) Name() Name {
|
||||||
|
return Rdma
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *rdmaController) Path(path string) string {
|
||||||
|
return filepath.Join(p.root, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRdma(root string) *rdmaController {
|
||||||
|
return &rdmaController{
|
||||||
|
root: filepath.Join(root, string(Rdma)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func createCmdString(device string, limits *specs.LinuxRdma) string {
|
||||||
|
var cmdString string
|
||||||
|
|
||||||
|
cmdString = device
|
||||||
|
if limits.HcaHandles != nil {
|
||||||
|
cmdString = cmdString + " " + "hca_handle=" + strconv.FormatUint(uint64(*limits.HcaHandles), 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
if limits.HcaObjects != nil {
|
||||||
|
cmdString = cmdString + " " + "hca_object=" + strconv.FormatUint(uint64(*limits.HcaObjects), 10)
|
||||||
|
}
|
||||||
|
return cmdString
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *rdmaController) Create(path string, resources *specs.LinuxResources) error {
|
||||||
|
if err := os.MkdirAll(p.Path(path), defaultDirPerm); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for device, limit := range resources.Rdma {
|
||||||
|
if device != "" && (limit.HcaHandles != nil || limit.HcaObjects != nil) {
|
||||||
|
return ioutil.WriteFile(
|
||||||
|
filepath.Join(p.Path(path), "rdma.max"),
|
||||||
|
[]byte(createCmdString(device, &limit)),
|
||||||
|
defaultFilePerm,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *rdmaController) Update(path string, resources *specs.LinuxResources) error {
|
||||||
|
return p.Create(path, resources)
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseRdmaKV(raw string, entry *RdmaEntry) {
|
||||||
|
var value uint64
|
||||||
|
var err error
|
||||||
|
|
||||||
|
parts := strings.Split(raw, "=")
|
||||||
|
switch len(parts) {
|
||||||
|
case 2:
|
||||||
|
if parts[1] == "max" {
|
||||||
|
value = math.MaxUint32
|
||||||
|
} else {
|
||||||
|
value, err = parseUint(parts[1], 10, 32)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if parts[0] == "hca_handle" {
|
||||||
|
entry.HcaHandles = uint32(value)
|
||||||
|
} else if parts[0] == "hca_object" {
|
||||||
|
entry.HcaObjects = uint32(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func toRdmaEntry(strEntries []string) []*RdmaEntry {
|
||||||
|
var rdmaEntries []*RdmaEntry
|
||||||
|
for i := range strEntries {
|
||||||
|
parts := strings.Fields(strEntries[i])
|
||||||
|
switch len(parts) {
|
||||||
|
case 3:
|
||||||
|
entry := new(RdmaEntry)
|
||||||
|
entry.Device = parts[0]
|
||||||
|
parseRdmaKV(parts[1], entry)
|
||||||
|
parseRdmaKV(parts[2], entry)
|
||||||
|
|
||||||
|
rdmaEntries = append(rdmaEntries, entry)
|
||||||
|
default:
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rdmaEntries
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *rdmaController) Stat(path string, stats *Metrics) error {
|
||||||
|
|
||||||
|
currentData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "rdma.current"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
currentPerDevices := strings.Split(string(currentData), "\n")
|
||||||
|
|
||||||
|
maxData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "rdma.max"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
maxPerDevices := strings.Split(string(maxData), "\n")
|
||||||
|
|
||||||
|
// If device got removed between reading two files, ignore returning
|
||||||
|
// stats.
|
||||||
|
if len(currentPerDevices) != len(maxPerDevices) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
currentEntries := toRdmaEntry(currentPerDevices)
|
||||||
|
maxEntries := toRdmaEntry(maxPerDevices)
|
||||||
|
|
||||||
|
stats.Rdma = &RdmaStat{
|
||||||
|
Current: currentEntries,
|
||||||
|
Limit: maxEntries,
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
16
vendor/github.com/containerd/cgroups/state.go
generated
vendored
16
vendor/github.com/containerd/cgroups/state.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
// State is a type that represents the state of the current cgroup
|
// State is a type that represents the state of the current cgroup
|
||||||
|
18
vendor/github.com/containerd/cgroups/subsystem.go
generated
vendored
18
vendor/github.com/containerd/cgroups/subsystem.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -22,6 +38,7 @@ const (
|
|||||||
Cpuacct Name = "cpuacct"
|
Cpuacct Name = "cpuacct"
|
||||||
Memory Name = "memory"
|
Memory Name = "memory"
|
||||||
Blkio Name = "blkio"
|
Blkio Name = "blkio"
|
||||||
|
Rdma Name = "rdma"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Subsystems returns a complete list of the default cgroups
|
// Subsystems returns a complete list of the default cgroups
|
||||||
@ -39,6 +56,7 @@ func Subsystems() []Name {
|
|||||||
Cpuacct,
|
Cpuacct,
|
||||||
Memory,
|
Memory,
|
||||||
Blkio,
|
Blkio,
|
||||||
|
Rdma,
|
||||||
}
|
}
|
||||||
if !isUserNS {
|
if !isUserNS {
|
||||||
n = append(n, Devices)
|
n = append(n, Devices)
|
||||||
|
49
vendor/github.com/containerd/cgroups/systemd.go
generated
vendored
49
vendor/github.com/containerd/cgroups/systemd.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -16,6 +32,11 @@ const (
|
|||||||
defaultSlice = "system.slice"
|
defaultSlice = "system.slice"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
canDelegate bool
|
||||||
|
once sync.Once
|
||||||
|
)
|
||||||
|
|
||||||
func Systemd() ([]Subsystem, error) {
|
func Systemd() ([]Subsystem, error) {
|
||||||
root, err := v1MountPoint()
|
root, err := v1MountPoint()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -38,7 +59,7 @@ func Slice(slice, name string) Path {
|
|||||||
slice = defaultSlice
|
slice = defaultSlice
|
||||||
}
|
}
|
||||||
return func(subsystem Name) (string, error) {
|
return func(subsystem Name) (string, error) {
|
||||||
return filepath.Join(slice, unitName(name)), nil
|
return filepath.Join(slice, name), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,15 +85,39 @@ func (s *SystemdController) Create(path string, resources *specs.LinuxResources)
|
|||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
slice, name := splitName(path)
|
slice, name := splitName(path)
|
||||||
|
// We need to see if systemd can handle the delegate property
|
||||||
|
// Systemd will return an error if it cannot handle delegate regardless
|
||||||
|
// of its bool setting.
|
||||||
|
checkDelegate := func() {
|
||||||
|
canDelegate = true
|
||||||
|
dlSlice := newProperty("Delegate", true)
|
||||||
|
if _, err := conn.StartTransientUnit(slice, "testdelegate", []systemdDbus.Property{dlSlice}, nil); err != nil {
|
||||||
|
if dbusError, ok := err.(dbus.Error); ok {
|
||||||
|
// Starting with systemd v237, Delegate is not even a property of slices anymore,
|
||||||
|
// so the D-Bus call fails with "InvalidArgs" error.
|
||||||
|
if strings.Contains(dbusError.Name, "org.freedesktop.DBus.Error.PropertyReadOnly") || strings.Contains(dbusError.Name, "org.freedesktop.DBus.Error.InvalidArgs") {
|
||||||
|
canDelegate = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
conn.StopUnit(slice, "testDelegate", nil)
|
||||||
|
}
|
||||||
|
once.Do(checkDelegate)
|
||||||
properties := []systemdDbus.Property{
|
properties := []systemdDbus.Property{
|
||||||
systemdDbus.PropDescription(fmt.Sprintf("cgroup %s", name)),
|
systemdDbus.PropDescription(fmt.Sprintf("cgroup %s", name)),
|
||||||
systemdDbus.PropWants(slice),
|
systemdDbus.PropWants(slice),
|
||||||
newProperty("DefaultDependencies", false),
|
newProperty("DefaultDependencies", false),
|
||||||
newProperty("Delegate", true),
|
|
||||||
newProperty("MemoryAccounting", true),
|
newProperty("MemoryAccounting", true),
|
||||||
newProperty("CPUAccounting", true),
|
newProperty("CPUAccounting", true),
|
||||||
newProperty("BlockIOAccounting", true),
|
newProperty("BlockIOAccounting", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we can delegate, we add the property back in
|
||||||
|
if canDelegate {
|
||||||
|
properties = append(properties, newProperty("Delegate", true))
|
||||||
|
}
|
||||||
|
|
||||||
ch := make(chan string)
|
ch := make(chan string)
|
||||||
_, err = conn.StartTransientUnit(name, "replace", properties, ch)
|
_, err = conn.StartTransientUnit(name, "replace", properties, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
16
vendor/github.com/containerd/cgroups/ticks.go
generated
vendored
16
vendor/github.com/containerd/cgroups/ticks.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
func getClockTicks() uint64 {
|
func getClockTicks() uint64 {
|
||||||
|
17
vendor/github.com/containerd/cgroups/utils.go
generated
vendored
17
vendor/github.com/containerd/cgroups/utils.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -64,6 +80,7 @@ func defaults(root string) ([]Subsystem, error) {
|
|||||||
NewCpuacct(root),
|
NewCpuacct(root),
|
||||||
NewMemory(root),
|
NewMemory(root),
|
||||||
NewBlkio(root),
|
NewBlkio(root),
|
||||||
|
NewRdma(root),
|
||||||
}
|
}
|
||||||
// only add the devices cgroup if we are not in a user namespace
|
// only add the devices cgroup if we are not in a user namespace
|
||||||
// because modifications are not allowed
|
// because modifications are not allowed
|
||||||
|
16
vendor/github.com/containerd/cgroups/v1.go
generated
vendored
16
vendor/github.com/containerd/cgroups/v1.go
generated
vendored
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package cgroups
|
package cgroups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
15
vendor/github.com/opencontainers/runtime-spec/README.md
generated
vendored
15
vendor/github.com/opencontainers/runtime-spec/README.md
generated
vendored
@ -22,12 +22,12 @@ To provide context for users the following section gives example use cases for e
|
|||||||
### Application Bundle Builders
|
### Application Bundle Builders
|
||||||
|
|
||||||
Application bundle builders can create a [bundle](bundle.md) directory that includes all of the files required for launching an application as a container.
|
Application bundle builders can create a [bundle](bundle.md) directory that includes all of the files required for launching an application as a container.
|
||||||
The bundle contains an OCI [configuration file](config.md) where the builder can specify host-independent details such as [which executable to launch](config.md#process) and host-specific settings such as [mount](config.md#mounts) locations, [hook](config.md#hooks) paths, Linux [namespaces](config-linux.md#namespaces) and [cgroups](config-linux.md#control-groups).
|
The bundle contains an OCI [configuration file](config.md) where the builder can specify host-independent details such as [which executable to launch](config.md#process) and host-specific settings such as [mount](config.md#mounts) locations, [hook](config.md#posix-platform-hooks) paths, Linux [namespaces](config-linux.md#namespaces) and [cgroups](config-linux.md#control-groups).
|
||||||
Because the configuration includes host-specific settings, application bundle directories copied between two hosts may require configuration adjustments.
|
Because the configuration includes host-specific settings, application bundle directories copied between two hosts may require configuration adjustments.
|
||||||
|
|
||||||
### Hook Developers
|
### Hook Developers
|
||||||
|
|
||||||
[Hook](config.md#hooks) developers can extend the functionality of an OCI-compliant runtime by hooking into a container's lifecycle with an external application.
|
[Hook](config.md#posix-platform-hooks) developers can extend the functionality of an OCI-compliant runtime by hooking into a container's lifecycle with an external application.
|
||||||
Example use cases include sophisticated network configuration, volume garbage collection, etc.
|
Example use cases include sophisticated network configuration, volume garbage collection, etc.
|
||||||
|
|
||||||
### Runtime Developers
|
### Runtime Developers
|
||||||
@ -52,17 +52,12 @@ It also guarantees that the design is sound before code is written; a GitHub pul
|
|||||||
Typos and grammatical errors can go straight to a pull-request.
|
Typos and grammatical errors can go straight to a pull-request.
|
||||||
When in doubt, start on the [mailing-list](#mailing-list).
|
When in doubt, start on the [mailing-list](#mailing-list).
|
||||||
|
|
||||||
### Weekly Call
|
### Meetings
|
||||||
|
|
||||||
The contributors and maintainers of all OCI projects have a weekly meeting on Wednesdays at:
|
|
||||||
|
|
||||||
* 8:00 AM (USA Pacific), during [odd weeks][iso-week].
|
|
||||||
* 2:00 PM (USA Pacific), during [even weeks][iso-week].
|
|
||||||
|
|
||||||
|
The contributors and maintainers of all OCI projects have monthly meetings, which are usually at 2:00 PM (USA Pacific) on the first Wednesday of every month.
|
||||||
There is an [iCalendar][rfc5545] format for the meetings [here](meeting.ics).
|
There is an [iCalendar][rfc5545] format for the meetings [here](meeting.ics).
|
||||||
|
|
||||||
Everyone is welcome to participate via [UberConference web][uberconference] or audio-only: +1 415 968 0849 (no PIN needed).
|
Everyone is welcome to participate via [UberConference web][uberconference] or audio-only: +1 415 968 0849 (no PIN needed).
|
||||||
An initial agenda will be posted to the [mailing list](#mailing-list) earlier in the week, and everyone is welcome to propose additional topics or suggest other agenda alterations there.
|
An initial agenda will be posted to the [mailing list](#mailing-list) in the week before each meeting, and everyone is welcome to propose additional topics or suggest other agenda alterations there.
|
||||||
Minutes are posted to the [mailing list](#mailing-list) and minutes from past calls are archived [here][minutes], with minutes from especially old meetings (September 2015 and earlier) archived [here][runtime-wiki].
|
Minutes are posted to the [mailing list](#mailing-list) and minutes from past calls are archived [here][minutes], with minutes from especially old meetings (September 2015 and earlier) archived [here][runtime-wiki].
|
||||||
|
|
||||||
### Mailing List
|
### Mailing List
|
||||||
|
66
vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
generated
vendored
66
vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
generated
vendored
@ -4,7 +4,7 @@ import "os"
|
|||||||
|
|
||||||
// Spec is the base configuration for the container.
|
// Spec is the base configuration for the container.
|
||||||
type Spec struct {
|
type Spec struct {
|
||||||
// Version of the Open Container Runtime Specification with which the bundle complies.
|
// Version of the Open Container Initiative Runtime Specification with which the bundle complies.
|
||||||
Version string `json:"ociVersion"`
|
Version string `json:"ociVersion"`
|
||||||
// Process configures the container process.
|
// Process configures the container process.
|
||||||
Process *Process `json:"process,omitempty"`
|
Process *Process `json:"process,omitempty"`
|
||||||
@ -25,6 +25,8 @@ type Spec struct {
|
|||||||
Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
|
Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
|
||||||
// Windows is platform-specific configuration for Windows based containers.
|
// Windows is platform-specific configuration for Windows based containers.
|
||||||
Windows *Windows `json:"windows,omitempty" platform:"windows"`
|
Windows *Windows `json:"windows,omitempty" platform:"windows"`
|
||||||
|
// VM specifies configuration for virtual-machine-based containers.
|
||||||
|
VM *VM `json:"vm,omitempty" platform:"vm"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process contains information to start a specific application inside the container.
|
// Process contains information to start a specific application inside the container.
|
||||||
@ -194,10 +196,10 @@ const (
|
|||||||
|
|
||||||
// LinuxIDMapping specifies UID/GID mappings
|
// LinuxIDMapping specifies UID/GID mappings
|
||||||
type LinuxIDMapping struct {
|
type LinuxIDMapping struct {
|
||||||
// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
|
|
||||||
HostID uint32 `json:"hostID"`
|
|
||||||
// ContainerID is the starting UID/GID in the container
|
// ContainerID is the starting UID/GID in the container
|
||||||
ContainerID uint32 `json:"containerID"`
|
ContainerID uint32 `json:"containerID"`
|
||||||
|
// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
|
||||||
|
HostID uint32 `json:"hostID"`
|
||||||
// Size is the number of IDs to be mapped
|
// Size is the number of IDs to be mapped
|
||||||
Size uint32 `json:"size"`
|
Size uint32 `json:"size"`
|
||||||
}
|
}
|
||||||
@ -320,6 +322,14 @@ type LinuxNetwork struct {
|
|||||||
Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
|
Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
|
||||||
|
type LinuxRdma struct {
|
||||||
|
// Maximum number of HCA handles that can be opened. Default is "no limit".
|
||||||
|
HcaHandles *uint32 `json:"hcaHandles,omitempty"`
|
||||||
|
// Maximum number of HCA objects that can be created. Default is "no limit".
|
||||||
|
HcaObjects *uint32 `json:"hcaObjects,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// LinuxResources has container runtime resource constraints
|
// LinuxResources has container runtime resource constraints
|
||||||
type LinuxResources struct {
|
type LinuxResources struct {
|
||||||
// Devices configures the device whitelist.
|
// Devices configures the device whitelist.
|
||||||
@ -336,6 +346,10 @@ type LinuxResources struct {
|
|||||||
HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
|
HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
|
||||||
// Network restriction configuration
|
// Network restriction configuration
|
||||||
Network *LinuxNetwork `json:"network,omitempty"`
|
Network *LinuxNetwork `json:"network,omitempty"`
|
||||||
|
// Rdma resource restriction configuration.
|
||||||
|
// Limits are a set of key value pairs that define RDMA resource limits,
|
||||||
|
// where the key is device name and value is resource limits.
|
||||||
|
Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LinuxDevice represents the mknod information for a Linux special device file
|
// LinuxDevice represents the mknod information for a Linux special device file
|
||||||
@ -419,6 +433,8 @@ type SolarisAnet struct {
|
|||||||
type Windows struct {
|
type Windows struct {
|
||||||
// LayerFolders contains a list of absolute paths to directories containing image layers.
|
// LayerFolders contains a list of absolute paths to directories containing image layers.
|
||||||
LayerFolders []string `json:"layerFolders"`
|
LayerFolders []string `json:"layerFolders"`
|
||||||
|
// Devices are the list of devices to be mapped into the container.
|
||||||
|
Devices []WindowsDevice `json:"devices,omitempty"`
|
||||||
// Resources contains information for handling resource constraints for the container.
|
// Resources contains information for handling resource constraints for the container.
|
||||||
Resources *WindowsResources `json:"resources,omitempty"`
|
Resources *WindowsResources `json:"resources,omitempty"`
|
||||||
// CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification.
|
// CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification.
|
||||||
@ -433,6 +449,14 @@ type Windows struct {
|
|||||||
Network *WindowsNetwork `json:"network,omitempty"`
|
Network *WindowsNetwork `json:"network,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WindowsDevice represents information about a host device to be mapped into the container.
|
||||||
|
type WindowsDevice struct {
|
||||||
|
// Device identifier: interface class GUID, etc.
|
||||||
|
ID string `json:"id"`
|
||||||
|
// Device identifier type: "class", etc.
|
||||||
|
IDType string `json:"idType"`
|
||||||
|
}
|
||||||
|
|
||||||
// WindowsResources has container runtime resource constraints for containers running on Windows.
|
// WindowsResources has container runtime resource constraints for containers running on Windows.
|
||||||
type WindowsResources struct {
|
type WindowsResources struct {
|
||||||
// Memory restriction configuration.
|
// Memory restriction configuration.
|
||||||
@ -487,6 +511,42 @@ type WindowsHyperV struct {
|
|||||||
UtilityVMPath string `json:"utilityVMPath,omitempty"`
|
UtilityVMPath string `json:"utilityVMPath,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VM contains information for virtual-machine-based containers.
|
||||||
|
type VM struct {
|
||||||
|
// Hypervisor specifies hypervisor-related configuration for virtual-machine-based containers.
|
||||||
|
Hypervisor VMHypervisor `json:"hypervisor,omitempty"`
|
||||||
|
// Kernel specifies kernel-related configuration for virtual-machine-based containers.
|
||||||
|
Kernel VMKernel `json:"kernel"`
|
||||||
|
// Image specifies guest image related configuration for virtual-machine-based containers.
|
||||||
|
Image VMImage `json:"image,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VMHypervisor contains information about the hypervisor to use for a virtual machine.
|
||||||
|
type VMHypervisor struct {
|
||||||
|
// Path is the host path to the hypervisor used to manage the virtual machine.
|
||||||
|
Path string `json:"path"`
|
||||||
|
// Parameters specifies parameters to pass to the hypervisor.
|
||||||
|
Parameters string `json:"parameters,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VMKernel contains information about the kernel to use for a virtual machine.
|
||||||
|
type VMKernel struct {
|
||||||
|
// Path is the host path to the kernel used to boot the virtual machine.
|
||||||
|
Path string `json:"path"`
|
||||||
|
// Parameters specifies parameters to pass to the kernel.
|
||||||
|
Parameters string `json:"parameters,omitempty"`
|
||||||
|
// InitRD is the host path to an initial ramdisk to be used by the kernel.
|
||||||
|
InitRD string `json:"initrd,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VMImage contains information about the virtual machine root image.
|
||||||
|
type VMImage struct {
|
||||||
|
// Path is the host path to the root image that the VM kernel would boot into.
|
||||||
|
Path string `json:"path"`
|
||||||
|
// Format is the root image format type (e.g. "qcow2", "raw", "vhd", etc).
|
||||||
|
Format string `json:"format"`
|
||||||
|
}
|
||||||
|
|
||||||
// LinuxSeccomp represents syscall restrictions
|
// LinuxSeccomp represents syscall restrictions
|
||||||
type LinuxSeccomp struct {
|
type LinuxSeccomp struct {
|
||||||
DefaultAction LinuxSeccompAction `json:"defaultAction"`
|
DefaultAction LinuxSeccompAction `json:"defaultAction"`
|
||||||
|
4
vendor/github.com/opencontainers/runtime-spec/specs-go/version.go
generated
vendored
4
vendor/github.com/opencontainers/runtime-spec/specs-go/version.go
generated
vendored
@ -8,10 +8,10 @@ const (
|
|||||||
// VersionMinor is for functionality in a backwards-compatible manner
|
// VersionMinor is for functionality in a backwards-compatible manner
|
||||||
VersionMinor = 0
|
VersionMinor = 0
|
||||||
// VersionPatch is for backwards-compatible bug fixes
|
// VersionPatch is for backwards-compatible bug fixes
|
||||||
VersionPatch = 0
|
VersionPatch = 1
|
||||||
|
|
||||||
// VersionDev indicates development branch. Releases will be empty string.
|
// VersionDev indicates development branch. Releases will be empty string.
|
||||||
VersionDev = ""
|
VersionDev = "-dev"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is the specification version that the package types support.
|
// Version is the specification version that the package types support.
|
||||||
|
Reference in New Issue
Block a user