Merge pull request #474 from crosbymichael/revert-cgroups-change

Revert "cgroups: only return path when subsystem really mounted
This commit is contained in:
Michael Crosby 2015-03-23 14:09:04 -07:00
commit fd0087d3ac
5 changed files with 9 additions and 28 deletions

View File

@ -17,13 +17,9 @@ type BlkioGroup struct {
func (s *BlkioGroup) Apply(d *data) error { func (s *BlkioGroup) Apply(d *data) error {
dir, err := d.join("blkio") dir, err := d.join("blkio")
if err != nil { if err != nil && !cgroups.IsNotFound(err) {
if cgroups.IsNotFound(err) {
return nil
} else {
return err return err
} }
}
if err := s.Set(dir, d.c); err != nil { if err := s.Set(dir, d.c); err != nil {
return err return err

View File

@ -18,12 +18,8 @@ func (s *CpuGroup) Apply(d *data) error {
// on a container basis // on a container basis
dir, err := d.join("cpu") dir, err := d.join("cpu")
if err != nil { if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err return err
} }
}
if err := s.Set(dir, d.c); err != nil { if err := s.Set(dir, d.c); err != nil {
return err return err

View File

@ -11,12 +11,8 @@ type DevicesGroup struct {
func (s *DevicesGroup) Apply(d *data) error { func (s *DevicesGroup) Apply(d *data) error {
dir, err := d.join("devices") dir, err := d.join("devices")
if err != nil { if err != nil {
if cgroups.IsNotFound(err) {
return nil
} else {
return err return err
} }
}
if err := s.Set(dir, d.c); err != nil { if err := s.Set(dir, d.c); err != nil {
return err return err

View File

@ -13,13 +13,9 @@ type FreezerGroup struct {
func (s *FreezerGroup) Apply(d *data) error { func (s *FreezerGroup) Apply(d *data) error {
dir, err := d.join("freezer") dir, err := d.join("freezer")
if err != nil { if err != nil && !cgroups.IsNotFound(err) {
if cgroups.IsNotFound(err) {
return nil
} else {
return err return err
} }
}
if err := s.Set(dir, d.c); err != nil { if err := s.Set(dir, d.c); err != nil {
return err return err

View File

@ -16,13 +16,10 @@ type MemoryGroup struct {
func (s *MemoryGroup) Apply(d *data) error { func (s *MemoryGroup) Apply(d *data) error {
dir, err := d.join("memory") dir, err := d.join("memory")
if err != nil { // only return an error for memory if it was specified
if cgroups.IsNotFound(err) { if err != nil && (d.c.Memory != 0 || d.c.MemoryReservation != 0 || d.c.MemorySwap != 0) {
return nil
} else {
return err return err
} }
}
defer func() { defer func() {
if err != nil { if err != nil {
os.RemoveAll(dir) os.RemoveAll(dir)