Skip to content

Commit

Permalink
cgroupv2: bypass RequireDevices check
Browse files Browse the repository at this point in the history
  • Loading branch information
shankerwangmiao committed Jul 26, 2021
1 parent c26e9fb commit 1bc0285
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tunasync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Run Additional Unit tests.
run: |
make build-test-worker
sudo cgexec -g "*:/" -g cpu,memory:tunasync bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $USER env USECURCGROUP=1 ./worker.test -test.v -test.coverprofile profile.cov -test.run TestCgroup"
sudo cgexec -g "*:/" bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $USER env USECURCGROUP=1 cgexec -g cpu,memory:tunasync ./worker.test -test.v -test.coverprofile profile.cov -test.run TestCgroup"
- name: Convert coverage to lcov
uses: jandelgado/[email protected]
Expand Down
5 changes: 4 additions & 1 deletion worker/cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ func initCgroup(cfg *cgroupConfig) (error) {
}
logger.Infof("Loading cgroup")
var err error
if cfg.cgMgrV1, err = cgv1.Load(cgv1.V1, pather); err != nil {
if cfg.cgMgrV1, err = cgv1.Load(cgv1.V1, pather, func(cfg *cgv1.InitConfig) error{
cfg.InitCheck = cgv1.AllowAny
return nil
}); err != nil {
return err
}
logger.Debugf("Available subsystems:")
Expand Down
5 changes: 4 additions & 1 deletion worker/cgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ sleep 30
return path, err
}
})(cgv1.NestedPath(""))
wkrMgr, err := cgv1.Load(cgv1.V1, pather)
wkrMgr, err := cgv1.Load(cgv1.V1, pather, func(cfg *cgv1.InitConfig) error{
cfg.InitCheck = cgv1.AllowAny
return nil
})
So(err, ShouldBeNil)
origMgr := cgcf.cgMgrV1
for _, subsys := range(wkrMgr.Subsystems()){
Expand Down

0 comments on commit 1bc0285

Please sign in to comment.