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