summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-01-10 16:21:54 -0500
committerMatthew Heon <matthew.heon@gmail.com>2018-01-10 16:21:54 -0500
commit04e0687da14070ea3ff208687d4f749d5dc319a0 (patch)
tree1611f45b3b996e204af0409d4d29e2e749a1b267 /libpod/options.go
parente6be800ec633342aef656e0a2ed0bdc4519796d9 (diff)
downloadpodman-04e0687da14070ea3ff208687d4f749d5dc319a0.tar.gz
podman-04e0687da14070ea3ff208687d4f749d5dc319a0.tar.bz2
podman-04e0687da14070ea3ff208687d4f749d5dc319a0.zip
Add ability to set CGroup Parent via API
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 199bf9ee9..75ad7acfb 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -465,6 +465,23 @@ func WithNetNS(portMappings []ocicni.PortMapping) CtrCreateOption {
}
}
+// WithCgroupParent sets the Cgroup Parent of the new container
+func WithCgroupParent(parent string) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return ErrCtrFinalized
+ }
+
+ if parent == "" {
+ return errors.Wrapf(ErrInvalidArg, "cgroup parent cannot be empty")
+ }
+
+ ctr.config.CgroupParent = parent
+
+ return nil
+ }
+}
+
// Pod Creation Options
// WithPodName sets the name of the pod