Skip to content

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

Merged
rene merged 1 commit into
lf-edge:17.0-stablefrom
andrewd-zededa:pr6154-17.0-stable
Oct 17, 2026
Merged

rene merged 1 commit into
lf-edge:17.0-stablefrom
andrewd-zededa:pr6154-17.0-stable

Conversation

@andrewd-zededa

@andrewd-zededa andrewd-zededa commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport of #6154

fillImgInfo() never set ImgInfo.VirtualSize for ZFS zvols, so every
zvol-backed volume reported a provisioned size of 0: AppDiskMetric
ProvisionedBytes and the volume resource MaxSizeBytes were both 0.
This reads the zvol volsize property and sets VirtualSize from it,
best-effort, so filesystem datasets without a volsize keep reporting 0.

Scope of this backport

Only the pkg/pillar/zfs/zfs.go change is backported.
The evetest half of #6154, the TestZVolProvisionedSizeReported regression test and the EdgeDeviceConfig.AddBlankVolume builder, is not part of this PR. It reaches 17.0-stable in a newer form through #6833, which syncs evetest with master. Picking it here as well would collide with #6833 on evetest/devconfig.go and evetest/tests/storage/zvol_provisioned_size_test.go.

How to test and validate this PR

Once #6833 is merged, the regression test from #6154 is available on this branch:

cd evetest
make build-container
cd ../
EVETEST_EVE_VERSION=<build of this PR> make evetest NAME=TestZVolProvisionedSizeReported

Until then, validate by hand as described below.

On an HV=kvm device with a ZFS persist pool, deploy an app with a
zvol-backed volume, then compare:

zfs get -Hp -o value volsize <pool>/<volume>
cat /run/volumemgr/AppDiskMetric/*.json   # ProvisionedBytes

ProvisionedBytes must match the zvol volsize, not 0. The volume's
MaxSizeBytes reported to the controller must match too.

Changelog notes

Report provisioned/virtual size for ZFS persist AppDiskMetrics

PR Backports

This is the backport

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.

Please, check the boxes above after submitting the PR in interactive mode.

🤖 Generated with Claude Code

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.

Backport note: only the pkg/pillar/zfs/zfs.go change is backported. The
original commit's evetest regression test (TestZVolProvisionedSizeReported)
and the EdgeDeviceConfig.AddBlankVolume builder are omitted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 24ef315)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrew Durbin <andrewd@zededa.com>
@andrewd-zededa andrewd-zededa added the next-17.0.x-rc PR must be present in the next 17.0.x-lts release label Oct 16, 2026

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.04%. Comparing base (da1f212) to head (bcd95bd).
⚠️ Report is 12 commits behind head on 17.0-stable.

Files with missing lines Patch % Lines
pkg/pillar/zfs/zfs.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           17.0-stable    #6835      +/-   ##
===============================================
+ Coverage        22.70%   23.04%   +0.34%     
===============================================
  Files              512      522      +10     
  Lines            94725    96426    +1701     
===============================================
+ Hits             21504    22221     +717     
- Misses           71387    72191     +804     
- Partials          1834     2014     +180     

☔ 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.

@rene
rene merged commit 5572e50 into lf-edge:17.0-stable Oct 17, 2026
62 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next-17.0.x-rc PR must be present in the next 17.0.x-lts release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants