Skip to content

Fix clone to filesystem PVC sizing when storageProfile minimum applies#4098

Open
arnongilboa wants to merge 2 commits into
kubevirt:mainfrom
arnongilboa:clone_to_file_min_size_fix
Open

Fix clone to filesystem PVC sizing when storageProfile minimum applies#4098
arnongilboa wants to merge 2 commits into
kubevirt:mainfrom
arnongilboa:clone_to_file_min_size_fix

Conversation

@arnongilboa

@arnongilboa arnongilboa commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:
When cloning to filesystem, apply the storageProfile effective volume size (minimum supported PVC size) before inflating with filesystem overhead. It helps on cloning from block to filesystem where both have minimum supported size but the target also needs filesystem overhead on top of that, otherwise the pre-clone checks fail.

jira-ticket: https://redhat.atlassian.net/browse/CNV-79503

Release note:

Fix clone to filesystem PVC sizing when storageProfile minimum applies

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Apr 20, 2026
@kubevirt-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign aglitke for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@arnongilboa arnongilboa force-pushed the clone_to_file_min_size_fix branch from 7fdfe12 to e80bdad Compare April 20, 2026 13:46
@coveralls

coveralls commented Apr 20, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 49.611% (+0.03%) from 49.581% — arnongilboa:clone_to_file_min_size_fix into kubevirt:main

@Acedus

Acedus commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

fyi @arnongilboa #3901

@Acedus

Acedus commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

/cc @akalenyu

@kubevirt-bot kubevirt-bot requested a review from akalenyu April 20, 2026 14:46
@arnongilboa

Copy link
Copy Markdown
Collaborator Author

/hold

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2026
@arnongilboa arnongilboa reopened this May 13, 2026
@arnongilboa arnongilboa force-pushed the clone_to_file_min_size_fix branch from e80bdad to 7d431d1 Compare May 14, 2026 15:24
@arnongilboa

Copy link
Copy Markdown
Collaborator Author

/hold

@arnongilboa arnongilboa changed the title Fix clone to filesystem PVC sizing when storageProfile minimum applies WIP: Fix clone to filesystem PVC sizing when storageProfile minimum applies May 14, 2026
@kubevirt-bot kubevirt-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 14, 2026
@arnongilboa arnongilboa force-pushed the clone_to_file_min_size_fix branch from 7d431d1 to 67e56b2 Compare May 17, 2026 14:38
@arnongilboa arnongilboa changed the title WIP: Fix clone to filesystem PVC sizing when storageProfile minimum applies Fix clone to filesystem PVC sizing when storageProfile minimum applies May 17, 2026
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 17, 2026
@arnongilboa arnongilboa force-pushed the clone_to_file_min_size_fix branch from 67e56b2 to 1cc1766 Compare May 18, 2026 13:52
@arnongilboa

Copy link
Copy Markdown
Collaborator Author

/unhold

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 18, 2026

@noamasu noamasu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks! for clone to fs, make sense to to add fsoverhead after effective size.
added some comments

Comment thread tests/cloner_test.go Outdated
Entry("[test_id:12423] empty", "", false),
)

It("[test_id:XXXXX] Block volumeMode clone to filesystem, using storageProfile with minPvcSize annotation", Serial, func() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

need to add real test_id here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No need, removing.

Comment thread tests/smartclone_test.go Outdated
}

func verifyPVCRequestedSize(dataVolume *cdiv1.DataVolume, f *framework.Framework, size string) {
func verifyPVCRequestedSize(dataVolume *cdiv1.DataVolume, f *framework.Framework, minSize, comparator string) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe worth just adding another function like verifyPVCRequestedSizeExceeds for ">" instead of passing comparator?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agree

Comment thread tests/cloner_test.go
}

By(fmt.Sprintf("Create source block DataVolume %s", dataVolumeName))
sc := createStorageWithMinimumSupportedPVCSize(f, "4Gi")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what if actual min size of the sc is larger than 4Gi?
for example if actual min size of the storage backend is 10Gi, this test will fail?

@arnongilboa arnongilboa May 19, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You mean if the storage creates 10Gi in case of a smaller requested size (without using our annotation)? it will fail in the pre-clone check as the target will be too small, but I see no problem with such failure as we don't want to "guess" the backend behavior before the pvc is created. However, in a real use case, explicitly setting the minimum annotation to be aligned with the backup minimum size will solve this issue.

Comment thread tests/smartclone_test.go Outdated
f.ExpectEvent(dataVolume.Namespace).Should(ContainSubstring(controller.CloneSucceeded))

verifyPVCRequestedSize(dataVolume, f, testMinPvcSize)
verifyPVCRequestedSize(dataVolume, f, testMinPvcSize, "==")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

With the new logic for filesystem clones (minimum applied first, then overhead), shouldn't the resulting PVC size be greater than the minimum rather than equal to it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sure, but this test is for block.

When cloning to filesystem, apply the storageProfile effective volume
size (minimum supported PVC size) before inflating with filesystem
overhead. It helps on cloning from block to filesystem where both have
minimum supported size but the target also needs filesystem overhead on
top of that, otherwise the pre-clone checks fail.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@arnongilboa arnongilboa force-pushed the clone_to_file_min_size_fix branch from 1cc1766 to ebd0461 Compare May 19, 2026 11:55
Compute testMinPvcSize in BeforeEach as max("4Gi", originalMinPvcSize)
instead of a hardcoded constant, to avoid test failures on environments
where the storage profile already has a minimum larger than 4Gi.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Ahmad-Hafe

Copy link
Copy Markdown

/lgtm

@kubevirt-bot

Copy link
Copy Markdown
Contributor

@Ahmad-Hafe: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

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-bot

Copy link
Copy Markdown
Contributor

There has been no activity on this PR for 45 days.
To protect limited CI resources, it has been automatically labelled 'stale'.
This PR will automatically rot after an additional 14 days of inactivity, and will be closed shortly after that.

What you can do:

  • If the PR is waiting on you to respond to a question or feedback and/or update the PR, please do so.
  • You can mark the PR as fresh and remove the label with the following command: /remove-lifecycle stale
  • If this PR is safe to close now, please help the project by closing it with: /close
  • If you need attention on this PR from a reviewer, you can raise it on the agenda of the relevant SIG meeting or KubeVirt Community meeting, or ping the kubevirt-dev slack channel.

/lifecycle stale

@kubevirt-prow kubevirt-prow Bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants