Setting the cg path after application of pid

This commit is contained in:
Diptanu Choudhury
2016-04-02 01:51:17 -07:00
parent 339cb0b750
commit 36d8c7e831
3 changed files with 9 additions and 3 deletions

4
Godeps/Godeps.json generated
View File

@@ -7,6 +7,10 @@
"ImportPath": "github.com/StackExchange/wmi",
"Rev": "f3e2bae1e0cb5aef83e319133eabfee30013a4a5"
},
{
"ImportPath": "github.com/Sirupsen/logrus",
"Rev": "4b6ea7319e214d98c938f12692336f7ca9348d6b"
},
{
"ImportPath": "github.com/armon/circbuf",
"Rev": "bbbad097214e2918d8543d5201d12bfd7bca254d"

View File

@@ -375,8 +375,7 @@ func (e *UniversalExecutor) Exit() error {
}
if e.command != nil && e.command.ResourceLimits {
e.cgLock.Lock()
err := DestroyCgroup(e.groups, e.cgPaths)
if err != nil {
if err := DestroyCgroup(e.groups, e.cgPaths); err != nil {
merr.Errors = append(merr.Errors, err)
}
e.cgLock.Unlock()

View File

@@ -65,12 +65,15 @@ func (e *UniversalExecutor) applyLimits(pid int) error {
return err
}
e.cgPaths = manager.GetPaths()
cgConfig := cgroupConfig.Config{Cgroup: e.groups}
cgConfig := cgroupConfig.Config{Cgroups: e.groups}
if err := manager.Set(&cgConfig); err != nil {
e.logger.Printf("[ERR] executor: error setting cgroup config: %v", err)
if er := DestroyCgroup(e.groups, e.cgPaths); er != nil {
e.logger.Printf("[ERR] executor: error destroying cgroup: %v", er)
}
if er := e.removeChrootMounts(); er != nil {
e.logger.Printf("[ERR] executor: error removing chroot: %v", er)
}
return err
}
return nil