Bug 2001047

Summary: Automatic size detection may not request a PVC that is large enough for an import
Product: Container Native Virtualization (CNV) Reporter: Adam Litke <alitke>
Component: StorageAssignee: Bartosz Rybacki <brybacki>
Status: CLOSED ERRATA QA Contact: Jenia Peimer <jpeimer>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.9.0CC: cnv-qe-bugs, ycui
Target Milestone: ---   
Target Release: 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v4.9.0-194 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2001069 (view as bug list) Environment:
Last Closed: 2021-11-02 16:01:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2001069    

Description Adam Litke 2021-09-03 15:55:55 UTC
Description of problem:

When the user creates a DV using the DV.spec.storage section to indicate the image size, our logic may not create a PVC with enough space after factoring in FS overhead.

Version-Release number of selected component (if applicable): 4.9.0


How reproducible: Always with certain numbers


Steps to Reproduce:
0. Use the default fs overhead setting of 5.5%
1. Create a DV with spec.storage.requests.storage = 44384169 bytes and set it to import an image with a virtualsize of 41350695 bytes

Actual results: The import fails because there is not enough space on the PVC once FS overhead is factored in

Expected results: The import should succeed


Additional info:
We need to make the following adjustments to the logic that chooses the PVC size:
* Start with the value in DV.spec.storage.requests.storage (VS)
* Round VS up to the next 1MB to get an aligned size (AS)
* Perform  FS overhead calculation on AS to get requested size (RS)
  * RS = AS / (1 - fs-overhead-from-cdiconfig)
  * Convert RS to an integer by rounding up
* RS should be used as the PVC size

Comment 4 errata-xmlrpc 2021-11-02 16:01:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Virtualization 4.9.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4104