From 275b3ed653eacfc0d78713f23640abe467cc2fe6 Mon Sep 17 00:00:00 2001 From: Rohit Jnagal Date: Wed, 24 Dec 2014 00:25:11 +0000 Subject: [PATCH] Don't use state.json from libcontainer to get cgroup paths. This confuses cadvisor on systems where cadvisor doesn't see cgroup mounts at the same place as root namespace view. --- container/docker/handler.go | 2 +- container/libcontainer/helpers.go | 4 ++-- container/raw/handler.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/container/docker/handler.go b/container/docker/handler.go index 4ee762b2..76f0cf74 100644 --- a/container/docker/handler.go +++ b/container/docker/handler.go @@ -295,7 +295,7 @@ func (self *dockerContainerHandler) GetStats() (stats *info.ContainerStats, err return } - stats, err = containerLibcontainer.GetStats(state) + stats, err = containerLibcontainer.GetStats(self.cgroupPaths, state) if err != nil { return } diff --git a/container/libcontainer/helpers.go b/container/libcontainer/helpers.go index 742f640f..25e595b6 100644 --- a/container/libcontainer/helpers.go +++ b/container/libcontainer/helpers.go @@ -73,12 +73,12 @@ var supportedSubsystems map[string]struct{} = map[string]struct{}{ } // Get stats of the specified container -func GetStats(state *libcontainer.State) (*info.ContainerStats, error) { +func GetStats(cgroupPaths map[string]string, state *libcontainer.State) (*info.ContainerStats, error) { // TODO(vmarmol): Use libcontainer's Stats() in the new API when that is ready. stats := &libcontainer.ContainerStats{} var err error - stats.CgroupStats, err = cgroupfs.GetStats(state.CgroupPaths) + stats.CgroupStats, err = cgroupfs.GetStats(cgroupPaths) if err != nil { return &info.ContainerStats{}, err } diff --git a/container/raw/handler.go b/container/raw/handler.go index 650049c5..df999690 100644 --- a/container/raw/handler.go +++ b/container/raw/handler.go @@ -273,7 +273,7 @@ func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) { } } - stats, err := libcontainer.GetStats(&state) + stats, err := libcontainer.GetStats(self.cgroupPaths, &state) if err != nil { return nil, err }