Setting the cgroup config after applying pid

This commit is contained in:
Diptanu Choudhury 2016-04-02 01:36:31 -07:00
parent d9afcc1293
commit 6778f29513

View file

@ -58,12 +58,21 @@ func (e *UniversalExecutor) applyLimits(pid int) error {
// Entering the process in the cgroup
manager := getCgroupManager(e.groups, nil)
if err := manager.Apply(pid); err != nil {
e.logger.Printf("[ERR] executor: error applying pid to cgroup: %v", err)
if er := e.removeChrootMounts(); er != nil {
e.logger.Printf("[ERR] executor: error removing chroot: %v", er)
}
return err
}
e.cgPaths = manager.GetPaths()
cgConfig := cgroupConfig.Config{Cgroup: 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)
}
return err
}
return nil
}