summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-05-16 12:45:09 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-17 23:10:12 +0000
commit7e1ea9d26dff92c346bb11640fdab523d513e867 (patch)
tree28fca87c36fa1ddf5c357c61e2677626ed27835a /libpod/options.go
parent018d2c6b1d23acf7fe67e809498bc354eaf6becf (diff)
downloadpodman-7e1ea9d26dff92c346bb11640fdab523d513e867.tar.gz
podman-7e1ea9d26dff92c346bb11640fdab523d513e867.tar.bz2
podman-7e1ea9d26dff92c346bb11640fdab523d513e867.zip
Add per-pod CGroups
Pods can now create their own (cgroupfs) cgroups which containers in them can (optionally) use. This presently only works with CGroupFS, systemd cgroups are still WIP Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #784 Approved by: rhatdan
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 1af788e46..34bde3211 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -944,3 +944,32 @@ func WithPodLabels(labels map[string]string) PodCreateOption {
return nil
}
}
+
+// WithPodCgroupParent sets the Cgroup Parent of the pod.
+func WithPodCgroupParent(path string) PodCreateOption {
+ return func(pod *Pod) error {
+ if pod.valid {
+ return ErrPodFinalized
+ }
+
+ pod.config.CgroupParent = path
+
+ return nil
+ }
+}
+
+// WithPodCgroups tells containers in this pod to use the cgroup created for
+// this pod.
+// This can still be overridden at the container level by explicitly specifying
+// a CGroup parent.
+func WithPodCgroups() PodCreateOption {
+ return func(pod *Pod) error {
+ if pod.valid {
+ return ErrPodFinalized
+ }
+
+ pod.config.UsePodCgroup = true
+
+ return nil
+ }
+}