Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #474 from crosbymichael/revert-cgroups-change
Browse files Browse the repository at this point in the history
Revert "cgroups: only return path when subsystem really mounted
  • Loading branch information
crosbymichael committed Mar 23, 2015
2 parents f8daab8 + c5eef90 commit fd0087d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 28 deletions.
8 changes: 2 additions & 6 deletions cgroups/fs/blkio.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ type BlkioGroup struct {

func (s *BlkioGroup) Apply(d *data) error {
dir, err := d.join("blkio")
if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err
}
if err != nil && !cgroups.IsNotFound(err) {
return err
}

if err := s.Set(dir, d.c); err != nil {
Expand Down
6 changes: 1 addition & 5 deletions cgroups/fs/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ func (s *CpuGroup) Apply(d *data) error {
// on a container basis
dir, err := d.join("cpu")
if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err
}
return err
}

if err := s.Set(dir, d.c); err != nil {
Expand Down
6 changes: 1 addition & 5 deletions cgroups/fs/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ type DevicesGroup struct {
func (s *DevicesGroup) Apply(d *data) error {
dir, err := d.join("devices")
if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err
}
return err
}

if err := s.Set(dir, d.c); err != nil {
Expand Down
8 changes: 2 additions & 6 deletions cgroups/fs/freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ type FreezerGroup struct {

func (s *FreezerGroup) Apply(d *data) error {
dir, err := d.join("freezer")
if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err
}
if err != nil && !cgroups.IsNotFound(err) {
return err
}

if err := s.Set(dir, d.c); err != nil {
Expand Down
9 changes: 3 additions & 6 deletions cgroups/fs/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ type MemoryGroup struct {

func (s *MemoryGroup) Apply(d *data) error {
dir, err := d.join("memory")
if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err
}
// only return an error for memory if it was specified
if err != nil && (d.c.Memory != 0 || d.c.MemoryReservation != 0 || d.c.MemorySwap != 0) {
return err
}
defer func() {
if err != nil {
Expand Down

0 comments on commit fd0087d

Please sign in to comment.