Bug 2001041 - [4.9.0] Importer attempts to shrink an image in certain situations
Summary: [4.9.0] 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.9.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.9.0
Assignee: Alexander Wels
QA Contact: Jenia Peimer
URL:
Whiteboard:
Depends On: 2001038
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-03 15:42 UTC by Adam Litke
Modified: 2021-11-02 16:01 UTC (History)
4 users (show)

Fixed In Version: v4.9.0-194
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2001038
Environment:
Last Closed: 2021-11-02 16:01:09 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-07 14:50:14 UTC
Github kubevirt containerized-data-importer pull 1928 0 None None None 2021-09-07 15:22:02 UTC
Red Hat Product Errata RHSA-2021:4104 0 None None None 2021-11-02 16:01:30 UTC

Description Adam Litke 2021-09-03 15:42:32 UTC
+++ This bug was initially created as a clone of Bug #2001038 +++

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


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