Skip to content

Commit

Permalink
volumemgr: report large files in /persist to controller
Browse files Browse the repository at this point in the history
Signed-off-by: eriknordmark <[email protected]>
  • Loading branch information
eriknordmark committed Dec 25, 2023
1 parent 9ccb76f commit 701d78f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/pillar/cmd/volumemgr/handlediskmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,26 @@ func createOrUpdateDiskMetrics(ctx *volumemgrContext, wdName string) {

diskMetricList = append(diskMetricList, metric)
}
// Walk all of /persist and look for files above 1 Mbyte in size which
// are not under one of the paths already reported.
var excludeDirs []string
excludeDirs = append(excludeDirs, types.ReportDirPaths...)
excludeDirs = append(excludeDirs, types.AppPersistPaths...)
list, err := diskmetrics.FindLargeFiles(types.PersistDir, 1024*1024,
excludeDirs)
if err != nil {
log.Errorf("FindLargeFiles Failed: %s", err)
} else {
for _, item := range list {
metric := &(types.DiskMetric{
DiskPath: item.Path,
UsedBytes: uint64(item.Size),
IsDir: false,
})
diskMetricList = append(diskMetricList, metric)
}

Check warning on line 270 in pkg/pillar/cmd/volumemgr/handlediskmetrics.go

View check run for this annotation

Codecov / codecov/patch

pkg/pillar/cmd/volumemgr/handlediskmetrics.go#L255-L270

Added lines #L255 - L270 were not covered by tests
}

publishDiskMetrics(ctx, diskMetricList...)
for _, volumeStatus := range getAllVolumeStatus(ctx) {
ctx.ps.StillRunning(wdName, warningTime, errorTime)
Expand Down

0 comments on commit 701d78f

Please sign in to comment.