Skip to content

doc: explain how filesystem overhead changes PVC and image size - #4318

Merged
kubevirt-prow[bot] merged 1 commit into
kubevirt:mainfrom
fjvbn2003:doc-fs-overhead-sizes
Oct 22, 2026
Merged

kubevirt-prow[bot] merged 1 commit into
kubevirt:mainfrom
fjvbn2003:doc-fs-overhead-sizes

Conversation

@fjvbn2003

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

doc/datavolumes.md says that with spec.storage CDI requests "a PVC big enough to fit both an image and the file system metadata", and doc/cdi-config.md describes filesystemOverhead as the share of a Filesystem volume to reserve. Neither page says what size the PVC and the disk image end up with. We sized VM root disks from these pages and expected a 10Gi request to give the guest about 9.4GiB. With spec.storage the guest disk is the full 10Gi, and the PVC is the one that grows.

Since #3779 the math is:

Checked on CDI v1.66.0 with the default overhead (0.06) on an NFS storage class (filesystem mode):

DataVolume spec.storage request PVC request (bytes) Equals
10Gi 11381663335 ceil(10737418240 * 1.06)
60Gi 68289980007 ceil(64424509440 * 1.06)
80Gi 91053306676 ceil(85899345920 * 1.06)

For the 10Gi volume, qemu-img info in the virt-launcher pod reports virtual size: 10 GiB (10737418240 bytes) for disk.img.

This PR adds the formula and the worked example to both pages, says that with spec.pvc the PVC is not inflated but the overhead is still reserved inside it (so the image comes out smaller than the request), and links #4024 for the case where the provisioned filesystem has less free space than requested.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Docs only. The spec.pvc sentence is based on the code paths above (import, upload and blank all size the image with GetUsableSpace); I did not measure that case.

Release note:

NONE

This change was drafted with AI assistance and reviewed by me.

🤖 Generated with Claude Code

The DataVolume docs say that with `spec.storage` CDI requests "a PVC big
enough to fit both an image and the file system metadata", and the CDI
config docs describe filesystemOverhead as the share of a Filesystem
volume to reserve. Neither says what size the PVC and the disk image
end up with, so it is easy to read the requested size as the PVC size
and expect a guest disk that is about 6% smaller, or the other way
around.

Since kubevirt#3779 the math is:

- PVC request = align(size, 1MiB) * (1 + overhead)   (GetRequiredSpace)
- image size  = min(free space, PVC request) / (1 + overhead), rounded
  down to 1MiB                                        (GetUsableSpace)

Document this with a worked example (10Gi -> 11381663335 bytes, image
of 10Gi), and note that with `spec.pvc` the PVC is not inflated but the
overhead is still reserved, so the image comes out smaller than the
request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: YoungjuKim <[email protected]>
@kubevirt-prow kubevirt-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Oct 16, 2026
@kubevirt-prow

kubevirt-prow Bot commented Oct 16, 2026

Copy link
Copy Markdown

Hi @fjvbn2003. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubevirt-prow kubevirt-prow Bot added the size/S label Oct 16, 2026
@kubevirt-prow
kubevirt-prow Bot requested review from Acedus and mhenriks October 16, 2026 15:51
@awels

awels commented Oct 22, 2026

Copy link
Copy Markdown
Member

/lgtm
/approve

@kubevirt-prow kubevirt-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 22, 2026
@kubevirt-prow

kubevirt-prow Bot commented Oct 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awels

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-prow kubevirt-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 50.286% (+0.07%) from 50.213% — fjvbn2003:doc-fs-overhead-sizes into kubevirt:main

@awels

awels commented Oct 22, 2026

Copy link
Copy Markdown
Member

/override pull-containerized-data-importer-e2e-ceph

@kubevirt-prow

kubevirt-prow Bot commented Oct 22, 2026

Copy link
Copy Markdown

@awels: Overrode contexts on behalf of awels: pull-containerized-data-importer-e2e-ceph

Details

In response to this:

/override pull-containerized-data-importer-e2e-ceph

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubevirt-prow
kubevirt-prow Bot merged commit 0bafeaa into kubevirt:main Oct 22, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants