Bug 2001038

Summary: Importer attempts to shrink an image in certain situations
Product: Container Native Virtualization (CNV) Reporter: Adam Litke <alitke>
Component: StorageAssignee: Alexander Wels <awels>
Status: CLOSED ERRATA QA Contact: Jenia Peimer <jpeimer>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.8.1CC: brybacki, cnv-qe-bugs, ycui
Target Milestone: ---   
Target Release: 4.8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v4.8.2-16 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2001041 (view as bug list) Environment:
Last Closed: 2021-09-21 11:08:02 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: 2001041    

Description Adam Litke 2021-09-03 15:41:03 UTC
Description of problem: Due to an off by one rounding error, we may determine that there is not enough space to contain a disk image in a PVC with filesystem overhead.  Additionally, we may call 'qemu-img resize' with a smaller value than the current image size.


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


How reproducible: Always


Steps to Reproduce:
1. Create a DV with a size that is barely too small to fit its source disk image

Actual results:
the following appears in the importer logs:
E0901 16:10:54.345673       1 prlimit.go:176] qemu-img: Use the --shrink option to perform a shrink operation.
qemu-img: warning: Shrinking an image will delete all data beyond the shrunken image's end. Before performing such an operation, make sure there is no important data there.

Expected results:
A clearer message indicating that the PVC is not big enough for this image should be printed.


Additional info:

We need to enhance CDI's validation and resize logic in the following two ways:
1. When calculating available space in a PVC, round up to the next integer and then align down to the nearest MB.
2. Before calling qemu-img resize, validate that the target size is >= the current image virtualsize.

Comment 7 errata-xmlrpc 2021-09-21 11:08:02 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.8.2 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:3598