[9.4-stable] Check allocated vs provisioned file size in metrics. #3880
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thin allocated/sparse files will report full virtual/max size in ls but allocated in du. Comparable stat output is in %s and %b respectively. Populate DiskMetric.UsedBytes with file allocated bytes to avoid rolling over negative when eve node is populated with persistent volume instances with little data allocated. For example an empty system with a single unattached 1GB persistent volume instance defined would see the following in
publishMetrics() of handlemetrics.go:
persistUsage = ~1 MB
persistAppUsage = 1 GB
runtimeStorageOverhead = (persistUsage-persistAppUsage)
= ~17592186042378 MB
ls vs du:
ls -l /persist/clear/volumes/9599c42f-42b0-4807-96a7-2d01cb424e8f#0.raw -rw-r--r-- 1 root root 1073741824 Apr 19 17:31 /persist/clear/volumes/... du -h /persist/clear/volumes/9599c42f-42b0-4807-96a7-2d01cb424e8f#0.raw 4.0K /persist/clear/volumes/9599c42f-42b0-4807-96a7-2d01cb424e8f#0.raw
stat virt vs. allocated:
stat -c '%s' /persist/clear/volumes/9599c42f-42b0-4807-96a7-2d01cb424e8f#0.raw 1073741824
stat -c '%b' /persist/clear/volumes/9599c42f-42b0-4807-96a7-2d01cb424e8f#0.raw 8
Signed-off-by: Andrew Durbin andrewd@zededa.com
(cherry picked from commit 8be1999)