Skip to content

fix(vi): unpacked size#2227

Draft
danilrwx wants to merge 2 commits intomainfrom
fix/vi/unpacked-size
Draft

fix(vi): unpacked size#2227
danilrwx wants to merge 2 commits intomainfrom
fix/vi/unpacked-size

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Apr 16, 2026

Description

Fix unpacked size detection for VirtualImage and ClusterVirtualImage created from VirtualDiskSnapshot via PVC.

The change updates the PVC-backed VirtualImage ready flow to use the requested PVC size as the unpacked size instead of the bound PVC capacity. This avoids reporting inflated unpacked size when the storage backend rounds PVC capacity up.

Also added unit tests for:

  • unpacked size selection logic for PVC-backed snapshot refs;
  • size propagation from VirtualImage to ClusterVirtualImage.

Why do we need it, and what problem does it solve?

When a VirtualImage is created from VirtualDiskSnapshot on PVC storage, the controller previously used pvc.status.capacity for both stored and unpacked size.

On some storage backends, status.capacity can be greater than the requested restore size. As a result, .status.size.unpacked was reported incorrectly for VirtualImage and then propagated further to ClusterVirtualImage.

This change makes unpacked size reflect the requested PVC size, which matches the logical image size and prevents incorrect size reporting in VI/CVI status.

What is the expected result?

  1. Create a VirtualImage from VirtualDiskSnapshot using PVC storage.
  2. Use a case where PVC capacity is larger than the requested restore size.
  3. Verify that:
    • status.size.stored matches the actual PVC capacity;
    • status.size.unpacked matches the requested PVC size;
    • ClusterVirtualImage created from that VirtualImage preserves the same unpacked size.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: core
type: fix
summary: "Fix unpacked size reporting for VI/CVI created from VirtualDiskSnapshot via PVC."
impact_level: low

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vi/unpacked-size branch from 1e387a0 to 3938798 Compare April 16, 2026 14:53
@danilrwx danilrwx added this to the v1.8.0 milestone Apr 16, 2026
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.

1 participant