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

Commit

Permalink
cgroups: container: rename functions
Browse files Browse the repository at this point in the history
prefix cgroup related methods with cgroups,
make easy to group together in auto-generated docs.

Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
  • Loading branch information
jcvenegas committed Aug 29, 2019
1 parent a1e0a4c commit d804c39
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions virtcontainers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ func (c *Container) create() (err error) {
}
c.process = *process

if err = c.newCgroups(); err != nil {
if err = c.cgroupsCreate(); err != nil {
return
}

Expand Down Expand Up @@ -908,7 +908,7 @@ func (c *Container) delete() error {
return err
}

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

Expand Down Expand Up @@ -1200,7 +1200,7 @@ func (c *Container) update(resources specs.LinuxResources) error {
return err
}

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

Expand Down Expand Up @@ -1422,8 +1422,8 @@ func (c *Container) detachDevices() error {
return nil
}

// creates a new cgroup and return the cgroups path
func (c *Container) newCgroups() (err error) {
// cgroupsCreate creates cgroups on the host for the associated container
func (c *Container) cgroupsCreate() (err error) {
ann := c.GetAnnotations()

config, ok := ann[annotations.ConfigJSONKey]
Expand Down Expand Up @@ -1469,7 +1469,8 @@ func (c *Container) newCgroups() (err error) {
return nil
}

func (c *Container) deleteCgroups() error {
// cgroupsDelete deletes the cgroups on the host for the associated container
func (c *Container) cgroupsDelete() error {
cgroup, err := cgroupsLoadFunc(cgroups.V1,
cgroups.StaticPath(c.state.CgroupPath))

Expand Down Expand Up @@ -1503,7 +1504,8 @@ func (c *Container) deleteCgroups() error {
return nil
}

func (c *Container) updateCgroups(resources specs.LinuxResources) error {
// cgroupsUpdate updates cgroups on the host for the associated container
func (c *Container) cgroupsUpdate(resources specs.LinuxResources) error {
cgroup, err := cgroupsLoadFunc(cgroups.V1,
cgroups.StaticPath(c.state.CgroupPath))
if err != nil {
Expand Down

0 comments on commit d804c39

Please sign in to comment.