mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-12 05:08:50 +00:00
update cadvisor godeps to v0.33.0
This commit is contained in:
29
vendor/github.com/google/cadvisor/container/common/fsHandler.go
generated
vendored
29
vendor/github.com/google/cadvisor/container/common/fsHandler.go
generated
vendored
@@ -51,7 +51,6 @@ type realFsHandler struct {
|
||||
}
|
||||
|
||||
const (
|
||||
timeout = 2 * time.Minute
|
||||
maxBackoffFactor = 20
|
||||
)
|
||||
|
||||
@@ -74,17 +73,16 @@ func NewFsHandler(period time.Duration, rootfs, extraDir string, fsInfo fs.FsInf
|
||||
|
||||
func (fh *realFsHandler) update() error {
|
||||
var (
|
||||
baseUsage, extraDirUsage, inodeUsage uint64
|
||||
rootDiskErr, rootInodeErr, extraDiskErr error
|
||||
rootUsage, extraUsage fs.UsageInfo
|
||||
rootErr, extraErr error
|
||||
)
|
||||
// TODO(vishh): Add support for external mounts.
|
||||
if fh.rootfs != "" {
|
||||
baseUsage, rootDiskErr = fh.fsInfo.GetDirDiskUsage(fh.rootfs, timeout)
|
||||
inodeUsage, rootInodeErr = fh.fsInfo.GetDirInodeUsage(fh.rootfs, timeout)
|
||||
rootUsage, rootErr = fh.fsInfo.GetDirUsage(fh.rootfs)
|
||||
}
|
||||
|
||||
if fh.extraDir != "" {
|
||||
extraDirUsage, extraDiskErr = fh.fsInfo.GetDirDiskUsage(fh.extraDir, timeout)
|
||||
extraUsage, extraErr = fh.fsInfo.GetDirUsage(fh.extraDir)
|
||||
}
|
||||
|
||||
// Wait to handle errors until after all operartions are run.
|
||||
@@ -92,18 +90,17 @@ func (fh *realFsHandler) update() error {
|
||||
fh.Lock()
|
||||
defer fh.Unlock()
|
||||
fh.lastUpdate = time.Now()
|
||||
if rootInodeErr == nil && fh.rootfs != "" {
|
||||
fh.usage.InodeUsage = inodeUsage
|
||||
if fh.rootfs != "" && rootErr == nil {
|
||||
fh.usage.InodeUsage = rootUsage.Inodes
|
||||
fh.usage.TotalUsageBytes = rootUsage.Bytes + extraUsage.Bytes
|
||||
}
|
||||
if rootDiskErr == nil && fh.rootfs != "" {
|
||||
fh.usage.TotalUsageBytes = baseUsage + extraDirUsage
|
||||
}
|
||||
if extraDiskErr == nil && fh.extraDir != "" {
|
||||
fh.usage.BaseUsageBytes = baseUsage
|
||||
if fh.extraDir != "" && extraErr == nil {
|
||||
fh.usage.BaseUsageBytes = rootUsage.Bytes
|
||||
}
|
||||
|
||||
// Combine errors into a single error to return
|
||||
if rootDiskErr != nil || rootInodeErr != nil || extraDiskErr != nil {
|
||||
return fmt.Errorf("rootDiskErr: %v, rootInodeErr: %v, extraDiskErr: %v", rootDiskErr, rootInodeErr, extraDiskErr)
|
||||
if rootErr != nil || extraErr != nil {
|
||||
return fmt.Errorf("rootDiskErr: %v, extraDiskErr: %v", rootErr, extraErr)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -132,7 +129,7 @@ func (fh *realFsHandler) trackUsage() {
|
||||
// if the long duration is persistent either because of slow
|
||||
// disk or lots of containers.
|
||||
longOp = longOp + time.Second
|
||||
klog.V(2).Infof("du and find on following dirs took %v: %v; will not log again for this container unless duration exceeds %v", duration, []string{fh.rootfs, fh.extraDir}, longOp)
|
||||
klog.V(2).Infof("fs: disk usage and inodes count on following dirs took %v: %v; will not log again for this container unless duration exceeds %v", duration, []string{fh.rootfs, fh.extraDir}, longOp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/github.com/google/cadvisor/container/common/helpers.go
generated
vendored
2
vendor/github.com/google/cadvisor/container/common/helpers.go
generated
vendored
@@ -134,7 +134,7 @@ func readString(dirpath string, file string) string {
|
||||
if err != nil {
|
||||
// Ignore non-existent files
|
||||
if !os.IsNotExist(err) {
|
||||
klog.Errorf("readString: Failed to read %q: %s", cgroupFile, err)
|
||||
klog.Warningf("readString: Failed to read %q: %s", cgroupFile, err)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user