summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-03 11:35:13 -0700
committerGitHub <noreply@github.com>2018-10-03 11:35:13 -0700
commit3750b35ae2a22e7f7bc0070c5c2dadf1ef437074 (patch)
treec5eee413a0cd57375f464084581704fc6bd22b00 /libpod/util.go
parent2a3e3e7f25d9a7bbe5e6f3f35027ccbe6521961f (diff)
parent14473270d7af520dae006605ab798ad9db34f184 (diff)
downloadpodman-3750b35ae2a22e7f7bc0070c5c2dadf1ef437074.tar.gz
podman-3750b35ae2a22e7f7bc0070c5c2dadf1ef437074.tar.bz2
podman-3750b35ae2a22e7f7bc0070c5c2dadf1ef437074.zip
Merge pull request #1578 from baude/addubuntuci
Add Ubuntu-18.04 to CI testing
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/libpod/util.go b/libpod/util.go
index 17325f6e4..3b51e4fcc 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -9,8 +9,10 @@ import (
"strings"
"time"
+ "github.com/containerd/cgroups"
"github.com/containers/image/signature"
"github.com/containers/image/types"
+ "github.com/containers/libpod/pkg/util"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
@@ -160,3 +162,26 @@ func validPodNSOption(p *Pod, ctrPod string) error {
}
return nil
}
+
+// GetV1CGroups gets the V1 cgroup subsystems and then "filters"
+// out any subsystems that are provided by the caller. Passing nil
+// for excludes will return the subsystems unfiltered.
+//func GetV1CGroups(excludes []string) ([]cgroups.Subsystem, error) {
+func GetV1CGroups(excludes []string) cgroups.Hierarchy {
+ return func() ([]cgroups.Subsystem, error) {
+ var filtered []cgroups.Subsystem
+
+ subSystem, err := cgroups.V1()
+ if err != nil {
+ return nil, err
+ }
+ for _, s := range subSystem {
+ // If the name of the subsystem is not in the list of excludes, then
+ // add it as a keeper.
+ if !util.StringInSlice(string(s.Name()), excludes) {
+ filtered = append(filtered, s)
+ }
+ }
+ return filtered, nil
+ }
+}