Skip to content

Commit

Permalink
fix issue:containerd@5fe29ea
Browse files Browse the repository at this point in the history
  • Loading branch information
KubrickLiu committed Aug 8, 2022
1 parent 02d51e5 commit 39a2709
Show file tree
Hide file tree
Showing 27 changed files with 56 additions and 42 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Checkout cgroups
uses: actions/checkout@v2
with:
path: src/github.com/containerd/cgroups
path: src/github.com/KubrickLiu/cgroups
fetch-depth: 25

- name: Checkout common project repo
Expand All @@ -66,7 +66,7 @@ jobs:
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }}
DCO_VERBOSITY: "-q"
DCO_RANGE: ""
working-directory: src/github.com/containerd/cgroups
working-directory: src/github.com/KubrickLiu/cgroups
run: |
set -x
if [ -z "${GITHUB_COMMIT_URL}" ]; then
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Headers
run: ../project/script/validate/fileheader ../project/
working-directory: src/github.com/containerd/cgroups
working-directory: src/github.com/KubrickLiu/cgroups

test:
name: Test cgroups
Expand All @@ -105,10 +105,10 @@ jobs:
- name: Checkout cgroups
uses: actions/checkout@v2
with:
path: src/github.com/containerd/cgroups
path: src/github.com/KubrickLiu/cgroups

- name: Run cgroup tests
run: |
sudo -E PATH=$PATH GOPATH=$GOPATH \
$(command -v go) test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
working-directory: src/github.com/containerd/cgroups
working-directory: src/github.com/KubrickLiu/cgroups
4 changes: 2 additions & 2 deletions Protobuild.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ plugins = ["grpc"]

# Aggregrate the API descriptors to lock down API changes.
[[descriptors]]
prefix = "github.com/containerd/cgroups/stats/v1"
prefix = "github.com/KubrickLiu/cgroups/stats/v1"
target = "stats/v1/metrics.pb.txt"
ignore_files = [
"google/protobuf/descriptor.proto",
"gogoproto/gogo.proto"
]
[[descriptors]]
prefix = "github.com/containerd/cgroups/v2/stats"
prefix = "github.com/KubrickLiu/cgroups/v2/stats"
target = "v2/stats/metrics.pb.txt"
ignore_files = [
"google/protobuf/descriptor.proto",
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# cgroups

[![Build Status](https://github.com/containerd/cgroups/workflows/CI/badge.svg)](https://github.com/containerd/cgroups/actions?query=workflow%3ACI)
[![Build Status](https://github.com/KubrickLiu/cgroups/workflows/CI/badge.svg)](https://github.com/KubrickLiu/cgroups/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/containerd/cgroups/branch/main/graph/badge.svg)](https://codecov.io/gh/containerd/cgroups)
[![GoDoc](https://godoc.org/github.com/containerd/cgroups?status.svg)](https://godoc.org/github.com/containerd/cgroups)
[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/cgroups)](https://goreportcard.com/report/github.com/containerd/cgroups)
[![GoDoc](https://godoc.org/github.com/KubrickLiu/cgroups?status.svg)](https://godoc.org/github.com/KubrickLiu/cgroups)
[![Go Report Card](https://goreportcard.com/badge/github.com/KubrickLiu/cgroups)](https://goreportcard.com/report/github.com/KubrickLiu/cgroups)

Go package for creating, managing, inspecting, and destroying cgroups.
The resources format for settings on the cgroup uses the OCI runtime-spec found
Expand Down Expand Up @@ -153,13 +153,13 @@ so the resulting slice would be located here on disk:

```go
import (
cgroupsv2 "github.com/containerd/cgroups/v2"
cgroupsv2 "github.com/KubrickLiu/cgroups/v2"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

res := cgroupsv2.Resources{}
// dummy PID of -1 is used for creating a "general slice" to be used as a parent cgroup.
// see https://github.com/containerd/cgroups/blob/1df78138f1e1e6ee593db155c6b369466f577651/v2/manager.go#L732-L735
// see https://github.com/KubrickLiu/cgroups/blob/1df78138f1e1e6ee593db155c6b369466f577651/v2/manager.go#L732-L735
m, err := cgroupsv2.NewSystemd("/", "my-cgroup-abc.slice", -1, &res)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion blkio.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions blkio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"
"testing"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
)

const data = `major minor #blocks name
Expand All @@ -45,7 +45,7 @@ func TestGetDevices(t *testing.T) {
t.Fatal(err)
}
for dev, expected := range map[deviceKey]string{
deviceKey{7, 0}: "/dev/loop0",
deviceKey{7, 0}: "/dev/loop0",
deviceKey{259, 0}: "/dev/nvme0n1",
deviceKey{259, 1}: "/dev/nvme0n1p1",
} {
Expand Down
4 changes: 2 additions & 2 deletions cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"strings"
"sync"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"

"github.com/opencontainers/runtime-spec/specs-go"
)
Expand Down Expand Up @@ -84,7 +84,7 @@ func Load(hierarchy Hierarchy, path Path, opts ...InitOpts) (Cgroup, error) {
for _, s := range pathers(subsystems) {
p, err := path(s.Name())
if err != nil {
if errors.Is(err, os.ErrNotExist) {
if errors.Is(err, os.ErrNotExist) {
return nil, ErrCgroupDeleted
}
if err == ErrControllerNotActive {
Expand Down
4 changes: 2 additions & 2 deletions cmd/cgctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"os"
"strconv"

"github.com/containerd/cgroups"
v2 "github.com/containerd/cgroups/v2"
"github.com/KubrickLiu/cgroups"
v2 "github.com/KubrickLiu/cgroups/v2"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/containerd/cgroups/cmd
module github.com/KubrickLiu/cgroups/cmd

go 1.16

replace github.com/containerd/cgroups => ../
replace github.com/KubrickLiu/cgroups => ../

require (
github.com/containerd/cgroups v0.0.0-00010101000000-000000000000
github.com/KubrickLiu/cgroups v0.0.0-00010101000000-000000000000
github.com/sirupsen/logrus v1.8.1
github.com/urfave/cli v1.22.5
)
2 changes: 1 addition & 1 deletion control.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package cgroups
import (
"os"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"path/filepath"
"strconv"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion cpuacct.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
)

const nanosecondsInSecond = 1000000000
Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/containerd/cgroups
module github.com/KubrickLiu/cgroups

go 1.17

Expand All @@ -16,7 +16,11 @@ require (
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/urfave/cli v1.22.9 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/cilium/ebpf v0.4.0 h1:QlHdikaxALkqWasW8hAC1mfR0jdmvbfaBdBPFmRSglA=
github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -27,6 +30,10 @@ github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNia
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -36,6 +43,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/urfave/cli v1.22.9 h1:cv3/KhXGBGjEXLC4bH0sLuJ9BewaAbpk5oyMOveu4pw=
github.com/urfave/cli v1.22.9/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
Expand Down Expand Up @@ -86,6 +95,7 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion hugetlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/sys/unix"
)
Expand Down
2 changes: 1 addition & 1 deletion memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"testing"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
)

const memoryData = `cache 1
Expand Down
2 changes: 1 addition & 1 deletion pids.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion pids_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strconv"
"testing"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
"github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion rdma.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions stats/v1/metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stats/v1/metrics.pb.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file {
name: "github.com/containerd/cgroups/stats/v1/metrics.proto"
name: "github.com/KubrickLiu/cgroups/stats/v1/metrics.proto"
package: "io.containerd.cgroups.v1"
dependency: "gogoproto/gogo.proto"
message_type {
Expand Down
2 changes: 1 addition & 1 deletion subsystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"os"

v1 "github.com/containerd/cgroups/stats/v1"
v1 "github.com/KubrickLiu/cgroups/stats/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion ticks.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func getClockTicks() uint64 {
// The value comes from `C.sysconf(C._SC_CLK_TCK)`, and
// on Linux it's a constant which is safe to be hard coded,
// so we can avoid using cgo here.
// See https://github.com/containerd/cgroups/pull/12 for
// See https://github.com/KubrickLiu/cgroups/pull/12 for
// more details.
return 100
}
2 changes: 1 addition & 1 deletion v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"syscall"
"time"

"github.com/containerd/cgroups/v2/stats"
"github.com/KubrickLiu/cgroups/v2/stats"

systemdDbus "github.com/coreos/go-systemd/v22/dbus"
"github.com/godbus/dbus/v5"
Expand Down
4 changes: 2 additions & 2 deletions v2/stats/metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/stats/metrics.pb.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file {
name: "github.com/containerd/cgroups/v2/stats/metrics.proto"
name: "github.com/KubrickLiu/cgroups/v2/stats/metrics.proto"
package: "io.containerd.cgroups.v2"
dependency: "gogoproto/gogo.proto"
message_type {
Expand Down
2 changes: 1 addition & 1 deletion v2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"strings"
"time"

"github.com/containerd/cgroups/v2/stats"
"github.com/KubrickLiu/cgroups/v2/stats"

"github.com/godbus/dbus/v5"
"github.com/opencontainers/runtime-spec/specs-go"
Expand Down

0 comments on commit 39a2709

Please sign in to comment.