Update cadvisor version to latest version

This commit is contained in:
Manjunath A Kumatagi
2017-04-04 13:20:20 -04:00
parent e36cca4b5d
commit 2b42d71a94
18 changed files with 594 additions and 106 deletions

View File

@@ -149,6 +149,31 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma
continue
}
// btrfs fix: following workaround fixes wrong btrfs Major and Minor Ids reported in /proc/self/mountinfo.
// instead of using values from /proc/self/mountinfo we use stat to get Ids from btrfs mount point
if mount.Fstype == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") {
buf := new(syscall.Stat_t)
err := syscall.Stat(mount.Source, buf)
if err != nil {
glog.Warningf("stat failed on %s with error: %s", mount.Source, err)
} else {
glog.Infof("btrfs mount %#v", mount)
if buf.Mode&syscall.S_IFMT == syscall.S_IFBLK {
err := syscall.Stat(mount.Mountpoint, buf)
if err != nil {
glog.Warningf("stat failed on %s with error: %s", mount.Mountpoint, err)
} else {
glog.Infof("btrfs dev major:minor %d:%d\n", int(major(buf.Dev)), int(minor(buf.Dev)))
glog.Infof("btrfs rdev major:minor %d:%d\n", int(major(buf.Rdev)), int(minor(buf.Rdev)))
mount.Major = int(major(buf.Dev))
mount.Minor = int(minor(buf.Dev))
}
}
}
}
partitions[mount.Source] = partition{
fsType: mount.Fstype,
mountpoint: mount.Mountpoint,