cleanup
Signed-off-by: Jess Frazelle <jess@mesosphere.com>
This commit is contained in:
parent
61704ab871
commit
2105320daf
13 changed files with 90 additions and 112 deletions
24
vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go
generated
vendored
24
vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go
generated
vendored
|
@ -15,7 +15,6 @@ import (
|
|||
"github.com/Sirupsen/logrus"
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
"github.com/opencontainers/runc/libcontainer/user"
|
||||
libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils"
|
||||
)
|
||||
|
||||
|
@ -111,14 +110,11 @@ func (m *Manager) Apply(pid int) (err error) {
|
|||
|
||||
var c = m.Cgroups
|
||||
|
||||
logrus.Debugf("pre get cgroups data: %#v", c)
|
||||
d, err := getCgroupData(m.Cgroups, pid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Debugf("cgroups data: %#v, config: %#v", d, d.config)
|
||||
|
||||
if c.Paths != nil {
|
||||
paths := make(map[string]string)
|
||||
for name, path := range c.Paths {
|
||||
|
@ -132,7 +128,6 @@ func (m *Manager) Apply(pid int) (err error) {
|
|||
paths[name] = path
|
||||
}
|
||||
m.Paths = paths
|
||||
logrus.Debugf("cgroups apply paths: %#v", m.Paths)
|
||||
return cgroups.EnterPid(m.Paths, pid)
|
||||
}
|
||||
|
||||
|
@ -140,7 +135,6 @@ func (m *Manager) Apply(pid int) (err error) {
|
|||
defer m.mu.Unlock()
|
||||
paths := make(map[string]string)
|
||||
for _, sys := range subsystems {
|
||||
logrus.Debugf("applying cgroups to subsystem %#v", sys)
|
||||
if err := sys.Apply(d); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -358,25 +352,9 @@ func writeFile(dir, file, data string) error {
|
|||
if dir == "" {
|
||||
return fmt.Errorf("no such directory for %s", file)
|
||||
}
|
||||
// get the current user
|
||||
u, err := user.CurrentUser()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.Lchown(dir, u.Uid, u.Gid); err != nil {
|
||||
return fmt.Errorf("failed to chown to %d:%d -> %v", u.Uid, u.Gid, err)
|
||||
}
|
||||
logrus.Debugf("chown dir %s to %d:%d", dir, u.Uid, u.Gid)
|
||||
|
||||
if err := os.Lchown(filepath.Join(dir, file), u.Uid, u.Gid); err != nil {
|
||||
return fmt.Errorf("failed to chown to %d:%d -> %v", u.Uid, u.Gid, err)
|
||||
}
|
||||
logrus.Debugf("chown %s to %d:%d", filepath.Join(dir, file), u.Uid, u.Gid)
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700); err != nil {
|
||||
//return fmt.Errorf("failed to write %v to %v: %v", data, file, err)
|
||||
logrus.Debugf("failed to write %v to %v: %v", data, file, err)
|
||||
//return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
3
vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go
generated
vendored
3
vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go
generated
vendored
|
@ -10,7 +10,6 @@ import (
|
|||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils"
|
||||
|
@ -28,7 +27,6 @@ func (s *CpusetGroup) Apply(d *cgroupData) error {
|
|||
if err != nil && !cgroups.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
logrus.Debugf("apply cpuset dir is %s", dir)
|
||||
return s.ApplyDir(dir, d.config, d.pid)
|
||||
}
|
||||
|
||||
|
@ -67,7 +65,6 @@ func (s *CpusetGroup) ApplyDir(dir string, cgroup *configs.Cgroup, pid int) erro
|
|||
if err := s.ensureParent(dir, root); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// because we are not using d.join we need to place the pid into the procs file
|
||||
// unlike the other subsystems
|
||||
if err := writeFile(dir, "cgroup.procs", strconv.Itoa(pid)); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue