Update cgroups to e6d1aa8c71c6103624b2c6e6f4be0863

This bumps the cgroups package with various fixes to logging and net_cls
changes.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-08-21 16:17:18 -04:00
parent 873a34649a
commit 77836a6c27
4 changed files with 9 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ func (n *netclsController) Create(path string, resources *specs.LinuxResources)
}
if resources.Network != nil && resources.Network.ClassID != nil && *resources.Network.ClassID > 0 {
return ioutil.WriteFile(
filepath.Join(n.Path(path), "net_cls_classid_u"),
filepath.Join(n.Path(path), "net_cls.classid"),
[]byte(strconv.FormatUint(uint64(*resources.Network.ClassID), 10)),
defaultFilePerm,
)

View File

@@ -3,6 +3,8 @@ package cgroups
import (
"fmt"
"path/filepath"
"github.com/pkg/errors"
)
type Path func(subsystem Name) (string, error)
@@ -31,9 +33,10 @@ func NestedPath(suffix string) Path {
// PidPath will return the correct cgroup paths for an existing process running inside a cgroup
// This is commonly used for the Load function to restore an existing container
func PidPath(pid int) Path {
paths, err := parseCgroupFile(fmt.Sprintf("/proc/%d/cgroup", pid))
p := fmt.Sprintf("/proc/%d/cgroup", pid)
paths, err := parseCgroupFile(p)
if err != nil {
return errorPath(err)
return errorPath(errors.Wrapf(err, "parse cgroup file %s", p))
}
return existingPath(paths, "")
}

View File

@@ -81,8 +81,8 @@ func defaults(root string) ([]Subsystem, error) {
// remove will remove a cgroup path handling EAGAIN and EBUSY errors and
// retrying the remove after a exp timeout
func remove(path string) error {
delay := 10 * time.Millisecond
for i := 0; i < 5; i++ {
delay := 10 * time.Millisecond
if i != 0 {
time.Sleep(delay)
delay *= 2
@@ -204,7 +204,7 @@ func parseCgroupFromReader(r io.Reader) (map[string]string, error) {
parts = strings.SplitN(text, ":", 3)
)
if len(parts) < 3 {
return nil, fmt.Errorf("invalid cgroup entry: must contain at least two colons: %v", text)
return nil, fmt.Errorf("invalid cgroup entry: %q", text)
}
for _, subs := range strings.Split(parts[1], ",") {
if subs != "" {