Skip to content

[13.4-stable] zfs: report zvol provisioned size (volsize) in volume metrics - #6902

Merged
eriknordmark merged 1 commit into
lf-edge:13.4-stablefrom
milan-zededa:13.4-backport-6154-zvol-volsize
Oct 26, 2026
Merged

eriknordmark merged 1 commit into
lf-edge:13.4-stablefrom
milan-zededa:13.4-backport-6154-zvol-volsize

Conversation

@milan-zededa

Copy link
Copy Markdown
Contributor

Description

Backport of #6154 to 13.4-stable.

Partial backport, clean cherry-pick with -x from d80e69ac2f, no conflicts. Only the pillar part (zfs.go) of the PR is backported; its evetest changes are part of the evetest backport (#6899).

Without this fix TestZVolProvisionedSizeReported fails: every ZFS zvol reports a provisioned size of 0.

PR dependencies

None.

How to test and validate this PR

Covered by the evetest test TestZVolProvisionedSizeReported (added to 13.4-stable by #6899):

EVETEST_EVE_VERSION=<13.4-stable build with this PR> make evetest NAME=TestZVolProvisionedSizeReported

Changelog notes

ZFS zvol-backed volumes now report their provisioned size (volsize) instead of 0.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

For backport PRs (remove it if it's not a backport):

  • I've added a reference link to the original PR
  • PR's title follows the template

And the last but not least:

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

fillImgInfo() populated ImgInfo.ActualSize (from the zfs "usedbydataset"
property) but never set ImgInfo.VirtualSize. volumeHandlerZVol's
GetVolumeDetails() returns imgInfo.VirtualSize as the volume's max size,
so every ZFS zvol reported a provisioned size of 0: AppDiskMetric
ProvisionedBytes was 0, and volume resource MaxSizeBytes was 0, for all
zvol-backed volumes -- even though the zvol has a non-zero volsize
(e.g. `zfs get volsize` reports 5G while ProvisionedBytes was 0).

Read the "volsize" property and set VirtualSize from it. This is
best-effort: fillImgInfo also runs on every dataset via
GetAllZFSVolumeInfo (including filesystem datasets and the pool root,
which have no volsize), so a missing or non-numeric value leaves
VirtualSize at 0 rather than returning an error, to avoid dropping
non-volume datasets from the results.

Add an evetest regression test (TestZVolProvisionedSizeReported) on a
KVM + ZFS device. It declares a single standalone empty block-device
(VCOT_BLANK) volume -- no application, no image download, no data I/O,
since the provisioned size is fixed at zvol creation and independent of
usage -- then waits for volumemgr to create it and asserts the reported
provisioned size is the zvol volsize (~1 GiB), not 0, at all three
layers: ZInfoVolume.Resources.MaxSizeBytes, ZMetricVolume.TotalBytes,
and volumemgr's AppDiskMetric.ProvisionedBytes pubsub object. This also
adds the EdgeDeviceConfig.AddBlankVolume builder, since evetest
previously had no way to declare an empty block-device volume.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrew Durbin <andrewd@zededa.com>
(cherry picked from commit d80e69a)
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.66%. Comparing base (8077a3d) to head (db2aa26).
⚠️ Report is 328 commits behind head on 13.4-stable.

Additional details and impacted files
@@               Coverage Diff               @@
##           13.4-stable    #6902      +/-   ##
===============================================
+ Coverage        24.78%   32.66%   +7.88%     
===============================================
  Files                8        9       +1     
  Lines             1138     1090      -48     
===============================================
+ Hits               282      356      +74     
+ Misses             788      654     -134     
- Partials            68       80      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eriknordmark
eriknordmark merged commit 865e6a1 into lf-edge:13.4-stable Oct 26, 2026
45 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.

4 participants