open-nomad/client/driver/executor/resource_container_linux.go
Sean Chittenden 5dbc0bf382
Rename resourceContainer.cleanup() to executorCleanup()
Not to be confused with the imminent ClientCleanup().
2016-07-09 23:25:33 -07:00

33 lines
734 B
Go

package executor
import (
"os"
"sync"
dstructs "github.com/hashicorp/nomad/client/driver/structs"
cgroupConfig "github.com/opencontainers/runc/libcontainer/configs"
)
type resourceContainer struct {
groups *cgroupConfig.Cgroup
cgPaths map[string]string
cgLock sync.Mutex
}
// cleanup removes this host's Cgroup from within an Executor's context
func (rc *resourceContainer) executorCleanup() error {
rc.cgLock.Lock()
defer rc.cgLock.Unlock()
if err := DestroyCgroup(rc.groups, rc.cgPaths, os.Getpid()); err != nil {
return err
}
return nil
}
func (rc *resourceContainer) getIsolationConfig() *dstructs.IsolationConfig {
return &dstructs.IsolationConfig{
Cgroup: rc.groups,
CgroupPaths: rc.cgPaths,
}
}