Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.4-stable] Check allocated vs provisioned file size in metrics. #3880

Conversation

andrewd-zededa
Copy link
Contributor

@andrewd-zededa andrewd-zededa commented Apr 23, 2024

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)

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the cheery-picked reference to the commit message and the pr description for this and the other two backport PRs of the same fix.

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)
@andrewd-zededa andrewd-zededa force-pushed the andrewd-9.4-stable-alloc-bytes-calc branch from 75349bc to ef3b393 Compare April 29, 2024 13:45
@andrewd-zededa
Copy link
Contributor Author

@eriknordmark commit overwritten with cherry-pick -x process and PR description matched

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@eriknordmark eriknordmark merged commit 6b07850 into lf-edge:9.4-stable Apr 30, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants