aboutsummaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index d53a863c0..604b5fe10 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -11,6 +11,7 @@ import (
"syscall"
"time"
+ "github.com/containerd/cgroups"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/docker/docker/daemon/caps"
@@ -55,6 +56,9 @@ const (
artifactsDir = "artifacts"
)
+// CGroupParent is the prefix to a cgroup path in libpod
+var CGroupParent = "/libpod_parent"
+
// Container is a single OCI container
type Container struct {
config *ContainerConfig
@@ -577,7 +581,7 @@ func (c *Container) Init() (err error) {
// With the spec complete, do an OCI create
// TODO set cgroup parent in a sane fashion
- if err := c.runtime.ociRuntime.createContainer(c, "/libpod_parent"); err != nil {
+ if err := c.runtime.ociRuntime.createContainer(c, CGroupParent); err != nil {
return err
}
@@ -1044,3 +1048,8 @@ func (c *Container) cleanupStorage() error {
return c.save()
}
+
+// CGroupPath returns a cgroups "path" for a given container.
+func (c *Container) CGroupPath() cgroups.Path {
+ return cgroups.StaticPath(filepath.Join(CGroupParent, fmt.Sprintf("libpod-conmon-%s", c.ID())))
+}