summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2017-12-04 15:06:06 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-13 21:15:09 +0000
commit9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538 (patch)
tree9736c47af7246c93e2e2b6d6d246653ca57cc316 /libpod/container.go
parent61f606e192ad67b4819a909a6f1b18c41e33db2d (diff)
downloadpodman-9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538.tar.gz
podman-9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538.tar.bz2
podman-9cc0c8ae143070c4d4ee691cab6a0fd0ebcaa538.zip
kpod stats
Move kpod stats to the libpod backend. Signed-off-by: baude <bbaude@redhat.com> Closes: #113 Approved by: baude
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())))
+}