mirror of
https://github.com/containers/podman.git
synced 2025-11-29 09:37:38 +08:00
update github.com/opencontainers/cgroups to v0.0.6
Includes one small fix for a breaking change in a type. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
2
go.mod
2
go.mod
@@ -49,7 +49,7 @@ require (
|
|||||||
github.com/nxadm/tail v1.4.11
|
github.com/nxadm/tail v1.4.11
|
||||||
github.com/onsi/ginkgo/v2 v2.27.2
|
github.com/onsi/ginkgo/v2 v2.27.2
|
||||||
github.com/onsi/gomega v1.38.2
|
github.com/onsi/gomega v1.38.2
|
||||||
github.com/opencontainers/cgroups v0.0.5
|
github.com/opencontainers/cgroups v0.0.6
|
||||||
github.com/opencontainers/go-digest v1.0.0
|
github.com/opencontainers/go-digest v1.0.0
|
||||||
github.com/opencontainers/image-spec v1.1.1
|
github.com/opencontainers/image-spec v1.1.1
|
||||||
github.com/opencontainers/runtime-spec v1.2.1
|
github.com/opencontainers/runtime-spec v1.2.1
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -300,8 +300,8 @@ github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns
|
|||||||
github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
|
github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
|
||||||
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
|
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
|
||||||
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
|
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
|
||||||
github.com/opencontainers/cgroups v0.0.5 h1:DRITAqcOnY0uSBzIpt1RYWLjh5DPDiqUs4fY6Y0ktls=
|
github.com/opencontainers/cgroups v0.0.6 h1:tfZFWTIIGaUUFImTyuTg+Mr5x8XRiSdZESgEBW7UxuI=
|
||||||
github.com/opencontainers/cgroups v0.0.5/go.mod h1:oWVzJsKK0gG9SCRBfTpnn16WcGEqDI8PAcpMGbqWxcs=
|
github.com/opencontainers/cgroups v0.0.6/go.mod h1:oWVzJsKK0gG9SCRBfTpnn16WcGEqDI8PAcpMGbqWxcs=
|
||||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||||
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
|
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ func GetLimits(resource *spec.LinuxResources) (runcconfig.Resources, error) {
|
|||||||
|
|
||||||
// Pids
|
// Pids
|
||||||
if resource.Pids != nil {
|
if resource.Pids != nil {
|
||||||
final.PidsLimit = resource.Pids.Limit
|
final.PidsLimit = &resource.Pids.Limit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Networking
|
// Networking
|
||||||
|
|||||||
4
vendor/github.com/opencontainers/cgroups/config_linux.go
generated
vendored
4
vendor/github.com/opencontainers/cgroups/config_linux.go
generated
vendored
@@ -90,8 +90,8 @@ type Resources struct {
|
|||||||
// Cgroup's SCHED_IDLE value.
|
// Cgroup's SCHED_IDLE value.
|
||||||
CPUIdle *int64 `json:"cpu_idle,omitempty"`
|
CPUIdle *int64 `json:"cpu_idle,omitempty"`
|
||||||
|
|
||||||
// Process limit; set <= `0' to disable limit.
|
// Process limit; set < `0' to disable limit. `nil` means "keep current limit".
|
||||||
PidsLimit int64 `json:"pids_limit,omitempty"`
|
PidsLimit *int64 `json:"pids_limit,omitempty"`
|
||||||
|
|
||||||
// Specifies per cgroup weight, range is from 10 to 1000.
|
// Specifies per cgroup weight, range is from 10 to 1000.
|
||||||
BlkioWeight uint16 `json:"blkio_weight,omitempty"`
|
BlkioWeight uint16 `json:"blkio_weight,omitempty"`
|
||||||
|
|||||||
12
vendor/github.com/opencontainers/cgroups/fs/cpuacct.go
generated
vendored
12
vendor/github.com/opencontainers/cgroups/fs/cpuacct.go
generated
vendored
@@ -129,12 +129,16 @@ func getPercpuUsageInModes(path string) ([]uint64, []uint64, error) {
|
|||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
|
|
||||||
scanner := bufio.NewScanner(fd)
|
scanner := bufio.NewScanner(fd)
|
||||||
scanner.Scan() // skipping header line
|
scanner.Scan() // Read header line.
|
||||||
|
const want = "cpu user system"
|
||||||
|
if hdr := scanner.Text(); !strings.HasPrefix(hdr, want) {
|
||||||
|
return nil, nil, malformedLine(path, file, hdr)
|
||||||
|
}
|
||||||
|
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
// Each line is: cpu user system
|
// Each line is: cpu user system. Keep N at 4 to ignore extra fields.
|
||||||
fields := strings.SplitN(scanner.Text(), " ", 3)
|
fields := strings.SplitN(scanner.Text(), " ", 4)
|
||||||
if len(fields) != 3 {
|
if len(fields) < 3 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
vendor/github.com/opencontainers/cgroups/fs/pids.go
generated
vendored
23
vendor/github.com/opencontainers/cgroups/fs/pids.go
generated
vendored
@@ -19,19 +19,24 @@ func (s *PidsGroup) Apply(path string, _ *cgroups.Resources, pid int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *PidsGroup) Set(path string, r *cgroups.Resources) error {
|
func (s *PidsGroup) Set(path string, r *cgroups.Resources) error {
|
||||||
if r.PidsLimit != 0 {
|
if r.PidsLimit == nil {
|
||||||
// "max" is the fallback value.
|
return nil
|
||||||
limit := "max"
|
|
||||||
|
|
||||||
if r.PidsLimit > 0 {
|
|
||||||
limit = strconv.FormatInt(r.PidsLimit, 10)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cgroups.WriteFile(path, "pids.max", limit); err != nil {
|
// "max" is the fallback value.
|
||||||
|
val := "max"
|
||||||
|
if limit := *r.PidsLimit; limit > 0 {
|
||||||
|
val = strconv.FormatInt(limit, 10)
|
||||||
|
} else if limit == 0 {
|
||||||
|
// systemd doesn't support setting pids.max to "0", so when setting
|
||||||
|
// TasksMax we need to remap it to "1". We do the same thing here to
|
||||||
|
// avoid flip-flop behaviour between the fs and systemd drivers. In
|
||||||
|
// practice, the pids cgroup behaviour is basically identical.
|
||||||
|
val = "1"
|
||||||
|
}
|
||||||
|
if err := cgroups.WriteFile(path, "pids.max", val); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
19
vendor/github.com/opencontainers/cgroups/fs2/io.go
generated
vendored
19
vendor/github.com/opencontainers/cgroups/fs2/io.go
generated
vendored
@@ -165,11 +165,22 @@ func statIo(dirPath string, stats *cgroups.Stats) error {
|
|||||||
case "wios":
|
case "wios":
|
||||||
op = "Write"
|
op = "Write"
|
||||||
targetTable = &parsedStats.IoServicedRecursive
|
targetTable = &parsedStats.IoServicedRecursive
|
||||||
|
|
||||||
|
case "cost.usage":
|
||||||
|
op = "Count"
|
||||||
|
targetTable = &parsedStats.IoCostUsage
|
||||||
|
case "cost.wait":
|
||||||
|
op = "Count"
|
||||||
|
targetTable = &parsedStats.IoCostWait
|
||||||
|
case "cost.indebt":
|
||||||
|
op = "Count"
|
||||||
|
targetTable = &parsedStats.IoCostIndebt
|
||||||
|
case "cost.indelay":
|
||||||
|
op = "Count"
|
||||||
|
targetTable = &parsedStats.IoCostIndelay
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Skip over entries we cannot map to cgroupv1 stats for now.
|
logrus.Debugf("cgroupv2 io stats: unknown entry %s", item)
|
||||||
// In the future we should expand the stats struct to include
|
|
||||||
// them.
|
|
||||||
logrus.Debugf("cgroupv2 io stats: skipping over unmappable %s entry", item)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
vendor/github.com/opencontainers/cgroups/fs2/pids.go
generated
vendored
16
vendor/github.com/opencontainers/cgroups/fs2/pids.go
generated
vendored
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
@@ -13,19 +14,26 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func isPidsSet(r *cgroups.Resources) bool {
|
func isPidsSet(r *cgroups.Resources) bool {
|
||||||
return r.PidsLimit != 0
|
return r.PidsLimit != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setPids(dirPath string, r *cgroups.Resources) error {
|
func setPids(dirPath string, r *cgroups.Resources) error {
|
||||||
if !isPidsSet(r) {
|
if !isPidsSet(r) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if val := numToStr(r.PidsLimit); val != "" {
|
val := "max"
|
||||||
|
if limit := *r.PidsLimit; limit > 0 {
|
||||||
|
val = strconv.FormatInt(limit, 10)
|
||||||
|
} else if limit == 0 {
|
||||||
|
// systemd doesn't support setting pids.max to "0", so when setting
|
||||||
|
// TasksMax we need to remap it to "1". We do the same thing here to
|
||||||
|
// avoid flip-flop behaviour between the fs and systemd drivers. In
|
||||||
|
// practice, the pids cgroup behaviour is basically identical.
|
||||||
|
val = "1"
|
||||||
|
}
|
||||||
if err := cgroups.WriteFile(dirPath, "pids.max", val); err != nil {
|
if err := cgroups.WriteFile(dirPath, "pids.max", val); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
vendor/github.com/opencontainers/cgroups/stats.go
generated
vendored
4
vendor/github.com/opencontainers/cgroups/stats.go
generated
vendored
@@ -159,6 +159,10 @@ type BlkioStats struct {
|
|||||||
IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitempty"`
|
IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitempty"`
|
||||||
SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitempty"`
|
SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitempty"`
|
||||||
PSI *PSIStats `json:"psi,omitempty"`
|
PSI *PSIStats `json:"psi,omitempty"`
|
||||||
|
IoCostUsage []BlkioStatEntry `json:"io_cost_usage,omitempty"`
|
||||||
|
IoCostWait []BlkioStatEntry `json:"io_cost_wait,omitempty"`
|
||||||
|
IoCostIndebt []BlkioStatEntry `json:"io_cost_indebt,omitempty"`
|
||||||
|
IoCostIndelay []BlkioStatEntry `json:"io_cost_indelay,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HugetlbStats struct {
|
type HugetlbStats struct {
|
||||||
|
|||||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -519,7 +519,7 @@ github.com/onsi/gomega/matchers/support/goraph/edge
|
|||||||
github.com/onsi/gomega/matchers/support/goraph/node
|
github.com/onsi/gomega/matchers/support/goraph/node
|
||||||
github.com/onsi/gomega/matchers/support/goraph/util
|
github.com/onsi/gomega/matchers/support/goraph/util
|
||||||
github.com/onsi/gomega/types
|
github.com/onsi/gomega/types
|
||||||
# github.com/opencontainers/cgroups v0.0.5
|
# github.com/opencontainers/cgroups v0.0.6
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.23.0
|
||||||
github.com/opencontainers/cgroups
|
github.com/opencontainers/cgroups
|
||||||
github.com/opencontainers/cgroups/devices/config
|
github.com/opencontainers/cgroups/devices/config
|
||||||
|
|||||||
Reference in New Issue
Block a user