From 869cc9fbdab560a1c5eaaf4793020053f802cfbd Mon Sep 17 00:00:00 2001 From: Vishnu kannan Date: Thu, 3 Dec 2015 16:03:56 -0800 Subject: [PATCH] Update cadvisor to v0.19.3.1. Signed-off-by: Vishnu kannan --- Godeps/Godeps.json | 72 +++++++++---------- .../cadvisor/container/docker/factory.go | 9 ++- .../container/libcontainer/helpers.go | 32 ++++----- .../google/cadvisor/version/VERSION | 2 +- 4 files changed, 56 insertions(+), 59 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index e605cdb37715..b3c492294241 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -434,93 +434,93 @@ }, { "ImportPath": "github.com/google/cadvisor/api", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/cache/memory", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/collector", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/container", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/events", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/fs", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/healthz", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/http", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/info/v1", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/info/v2", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/manager", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/metrics", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/pages", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/storage", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/summary", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/utils", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/validate", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/cadvisor/version", - "Comment": "v0.19.2", - "Rev": "aa6f80814bc6fdb43a0ed12719658225420ffb7d" + "Comment": "v0.19.3-3-g3bfcb1e", + "Rev": "3bfcb1e7cfc7de5fe42bba028aaacf2512100cb9" }, { "ImportPath": "github.com/google/gofuzz", diff --git a/Godeps/_workspace/src/github.com/google/cadvisor/container/docker/factory.go b/Godeps/_workspace/src/github.com/google/cadvisor/container/docker/factory.go index ebf2399a6f2f..9e5083e85791 100644 --- a/Godeps/_workspace/src/github.com/google/cadvisor/container/docker/factory.go +++ b/Godeps/_workspace/src/github.com/google/cadvisor/container/docker/factory.go @@ -46,6 +46,8 @@ var dockerRunDir = flag.String("docker_run", "/var/run/docker", "Absolute path t // --cgroup-parent have another prefix than 'docker' var dockerCgroupRegexp = regexp.MustCompile(`.+-([a-z0-9]{64})\.scope$`) +var noSystemd = flag.Bool("nosystemd", false, "Explicitly disable systemd support for Docker containers") + // TODO(vmarmol): Export run dir too for newer Dockers. // Directory holding Docker container state information. func DockerStateDir() string { @@ -53,13 +55,14 @@ func DockerStateDir() string { } // Whether the system is using Systemd. -var useSystemd bool +var useSystemd = false var check = sync.Once{} func UseSystemd() bool { check.Do(func() { - useSystemd = false - + if *noSystemd { + return + } // Check for system.slice in systemd and cpu cgroup. for _, cgroupType := range []string{"name=systemd", "cpu"} { mnt, err := cgroups.FindCgroupMountpoint(cgroupType) diff --git a/Godeps/_workspace/src/github.com/google/cadvisor/container/libcontainer/helpers.go b/Godeps/_workspace/src/github.com/google/cadvisor/container/libcontainer/helpers.go index 534ad87c84d4..acf02796a902 100644 --- a/Godeps/_workspace/src/github.com/google/cadvisor/container/libcontainer/helpers.go +++ b/Godeps/_workspace/src/github.com/google/cadvisor/container/libcontainer/helpers.go @@ -18,6 +18,7 @@ import ( "bufio" "fmt" "io/ioutil" + "os" "path" "regexp" "strconv" @@ -135,7 +136,6 @@ func networkStatsFromProc(rootFs string, pid int) ([]info.InterfaceStats, error) var ( ignoredDevicePrefixes = []string{"lo", "veth", "docker"} - netStatLineRE = regexp.MustCompile("[ ]*(.+):([ ]+[0-9]+){16}") ) func isIgnoredDevice(ifName string) bool { @@ -147,6 +147,8 @@ func isIgnoredDevice(ifName string) bool { return false } +const netstatsLine = `%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d` + func scanInterfaceStats(netStatsFile string) ([]info.InterfaceStats, error) { var ( bkt uint64 @@ -154,34 +156,26 @@ func scanInterfaceStats(netStatsFile string) ([]info.InterfaceStats, error) { stats := []info.InterfaceStats{} - data, err := ioutil.ReadFile(netStatsFile) + file, err := os.Open(netStatsFile) if err != nil { return stats, fmt.Errorf("failure opening %s: %v", netStatsFile, err) } + defer file.Close() - reader := strings.NewReader(string(data)) - scanner := bufio.NewScanner(reader) - - scanner.Split(bufio.ScanLines) + scanner := bufio.NewScanner(file) for scanner.Scan() { line := scanner.Text() - if netStatLineRE.MatchString(line) { - line = strings.Replace(line, ":", "", -1) - - i := info.InterfaceStats{} + line = strings.Replace(line, ":", "", -1) - _, err := fmt.Sscanf(line, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", - &i.Name, &i.RxBytes, &i.RxPackets, &i.RxErrors, &i.RxDropped, &bkt, &bkt, &bkt, - &bkt, &i.TxBytes, &i.TxPackets, &i.TxErrors, &i.TxDropped, &bkt, &bkt, &bkt, &bkt) + i := info.InterfaceStats{} - if err != nil { - return stats, fmt.Errorf("failure opening %s: %v", netStatsFile, err) - } + _, err := fmt.Sscanf(line, netstatsLine, + &i.Name, &i.RxBytes, &i.RxPackets, &i.RxErrors, &i.RxDropped, &bkt, &bkt, &bkt, + &bkt, &i.TxBytes, &i.TxPackets, &i.TxErrors, &i.TxDropped, &bkt, &bkt, &bkt, &bkt) - if !isIgnoredDevice(i.Name) { - stats = append(stats, i) - } + if err == nil && !isIgnoredDevice(i.Name) { + stats = append(stats, i) } } diff --git a/Godeps/_workspace/src/github.com/google/cadvisor/version/VERSION b/Godeps/_workspace/src/github.com/google/cadvisor/version/VERSION index 7f786826109e..b759f9dc2468 100644 --- a/Godeps/_workspace/src/github.com/google/cadvisor/version/VERSION +++ b/Godeps/_workspace/src/github.com/google/cadvisor/version/VERSION @@ -1 +1 @@ -0.19.2 \ No newline at end of file +0.19.3.1