Skip to content

Commit

Permalink
Skip getVfsStats when file does not exist
Browse files Browse the repository at this point in the history
There are a lot of spurious exceptions in the kubernetes kubelet logs
like:
E1018 21:03:09.616581   22780 fs.go:332] Stat fs failed. Error: no such
file or directory

Since we know that calling syscall.Statfs will just fail when the path
does not exist, we should just skip making the call.

NOTE: fixing 2017->2018 problems in build by running `./build/jenkins_e2e.sh`
  • Loading branch information
dims committed Jan 2, 2018
1 parent 9ffa373 commit 5f8eea9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/docker/docker/pkg/mount"
"github.com/golang/glog"
"github.com/google/cadvisor/devicemapper"
"github.com/google/cadvisor/utils"
dockerutil "github.com/google/cadvisor/utils/docker"
zfs "github.com/mistifyio/go-zfs"
)
Expand Down Expand Up @@ -409,10 +410,14 @@ func (self *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}) ([]Fs, er
fs.Type = ZFS
default:
var inodes, inodesFree uint64
fs.Capacity, fs.Free, fs.Available, inodes, inodesFree, err = getVfsStats(partition.mountpoint)
fs.Inodes = &inodes
fs.InodesFree = &inodesFree
fs.Type = VFS
if utils.FileExists(partition.mountpoint) {
fs.Capacity, fs.Free, fs.Available, inodes, inodesFree, err = getVfsStats(partition.mountpoint)
fs.Inodes = &inodes
fs.InodesFree = &inodesFree
fs.Type = VFS
} else {
glog.V(4).Infof("unable to determine file system type, partition mountpoint does not exist: %v", partition.mountpoint)
}
}
if err != nil {
glog.Errorf("Stat fs failed. Error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion pages/static/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pages/templates.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f8eea9

Please sign in to comment.