Bug 2001038 - Importer attempts to shrink an image in certain situations
Summary: Importer attempts to shrink an image in certain situations
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Storage
Version: 4.8.1
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.8.2
Assignee: Alexander Wels
QA Contact: Jenia Peimer
URL:
Whiteboard:
Depends On:
Blocks: 2001041
TreeView+ depends on / blocked
 
Reported: 2021-09-03 15:41 UTC by Adam Litke
Modified: 2021-09-21 11:08 UTC (History)
3 users (show)

Fixed In Version: v4.8.2-16
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2001041 (view as bug list)
Environment:
Last Closed: 2021-09-21 11:08:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt containerized-data-importer pull 1926 0 None None None 2021-09-08 09:25:18 UTC
Github kubevirt containerized-data-importer pull 1927 0 None None None 2021-09-08 09:25:20 UTC
Red Hat Product Errata RHSA-2021:3598 0 None None None 2021-09-21 11:08:54 UTC

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


Note You need to log in before you can comment on or make changes to this bug.