Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
sandbox: cgroup: prefix cgroup related methods
Browse files Browse the repository at this point in the history
rename to allow group in auto-generated docs.

Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
  • Loading branch information
jcvenegas committed Aug 29, 2019
1 parent 529ec25 commit caac68c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions virtcontainers/cgroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ func TestUpdateCgroups(t *testing.T) {
}

// empty path
err := s.updateCgroups()
err := s.cgroupsUpdate()
assert.NoError(err)

// path doesn't exist
s.state.CgroupPath = "/abc/123/rgb"
err = s.updateCgroups()
err = s.cgroupsUpdate()
assert.Error(err)

if os.Getuid() != 0 {
Expand All @@ -152,7 +152,7 @@ func TestUpdateCgroups(t *testing.T) {
s.hypervisor = &mockHypervisor{mockPid: 0}

// bad pid
err = s.updateCgroups()
err = s.cgroupsUpdate()
assert.Error(err)

// fake workload
Expand All @@ -161,7 +161,7 @@ func TestUpdateCgroups(t *testing.T) {
s.hypervisor = &mockHypervisor{mockPid: cmd.Process.Pid}

// no containers
err = s.updateCgroups()
err = s.cgroupsUpdate()
assert.NoError(err)

s.config = &SandboxConfig{}
Expand All @@ -186,11 +186,11 @@ func TestUpdateCgroups(t *testing.T) {
},
}

err = s.updateCgroups()
err = s.cgroupsUpdate()
assert.NoError(err)

// cleanup
assert.NoError(cmd.Process.Kill())
err = s.deleteCgroups()
err = s.cgroupsDelete()
assert.NoError(err)
}
12 changes: 6 additions & 6 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ func (s *Sandbox) Delete() error {
}
}

if err := s.deleteCgroups(); err != nil {
if err := s.cgroupsDelete(); err != nil {
return err
}

Expand Down Expand Up @@ -1148,7 +1148,7 @@ func (s *Sandbox) CreateContainer(contConfig ContainerConfig) (VCContainer, erro
return nil, err
}

if err = s.updateCgroups(); err != nil {
if err = s.cgroupsUpdate(); err != nil {
return nil, err
}

Expand Down Expand Up @@ -1325,7 +1325,7 @@ func (s *Sandbox) UpdateContainer(containerID string, resources specs.LinuxResou
return err
}

if err := s.updateCgroups(); err != nil {
if err := s.cgroupsUpdate(); err != nil {
return err
}

Expand Down Expand Up @@ -1416,7 +1416,7 @@ func (s *Sandbox) createContainers() error {
}
}

if err := s.updateCgroups(); err != nil {
if err := s.cgroupsUpdate(); err != nil {
return err
}
if err := s.storeSandbox(); err != nil {
Expand Down Expand Up @@ -1876,7 +1876,7 @@ func (s *Sandbox) GetHypervisorType() string {
return string(s.config.HypervisorType)
}

func (s *Sandbox) updateCgroups() error {
func (s *Sandbox) cgroupsUpdate() error {
if s.state.CgroupPath == "" {
s.Logger().Warn("sandbox's cgroup won't be updated: cgroup path is empty")
return nil
Expand Down Expand Up @@ -1908,7 +1908,7 @@ func (s *Sandbox) updateCgroups() error {
return nil
}

func (s *Sandbox) deleteCgroups() error {
func (s *Sandbox) cgroupsDelete() error {
s.Logger().Debug("Deleting sandbox cgroup")

path := cgroupNoConstraintsPath(s.state.CgroupPath)
Expand Down

0 comments on commit caac68c

Please sign in to comment.