Description of problem: Cant preallocate regular Block DV (imported from HTTP, for instance) Version-Release number of selected component (if applicable): CNV 2.6.0 How reproducible: 100% Steps to Reproduce: 1. Create a regular HTTP import DV with preallocate: true Actual results: E0215 09:37:41.288907 1 prlimit.go:176] qemu-img: /dev/cdi-block-volume: error while converting raw: Unsupported preallocation mode 'falloc' Expected results: Success Additional info: [cnv-qe-jenkins@stg01-alex-rjlb7-executor prealloc-block-volmode-bugs]$ cat http_block_dv.yaml apiVersion: cdi.kubevirt.io/v1beta1 kind: DataVolume metadata: name: cnv-5512 spec: source: http: url: http://.../rhel-82.qcow2 pvc: accessModes: - ReadWriteMany resources: requests: storage: 20Gi storageClassName: ocs-storagecluster-ceph-rbd volumeMode: Block preallocation: true
Tested with hco-v2.6.1-114, I've got the following result. [cnv-qe-jenkins@stg05-qixuan-5slqf-executor ~]$ oc logs -f importer-cnv-5512 I0331 13:27:15.514917 1 importer.go:52] Starting importer I0331 13:27:15.517186 1 importer.go:134] begin import process I0331 13:27:15.829851 1 data-processor.go:357] Calculating available size I0331 13:27:15.830875 1 data-processor.go:365] Checking out block volume size. I0331 13:27:15.830890 1 data-processor.go:377] Request image size not empty. I0331 13:27:15.830905 1 data-processor.go:382] Target size 20Gi. I0331 13:27:15.830951 1 data-processor.go:239] New phase: Convert I0331 13:27:15.830970 1 data-processor.go:245] Validating image I0331 13:27:15.875641 1 qemu.go:297] Added preallocation I0331 13:27:15.882142 1 qemu.go:237] 0.00 E0331 13:27:15.901734 1 prlimit.go:174] qemu-img failed output is: E0331 13:27:15.901764 1 prlimit.go:175] (0.00/100%) E0331 13:27:15.901774 1 prlimit.go:176] qemu-img: /dev/cdi-block-volume: error while converting raw: Unsupported preallocation mode 'falloc' I0331 13:27:15.901809 1 qemu.go:303] Unsupported preallocation mode. Retrying with [-o preallocation=full] I0331 13:27:15.901824 1 qemu.go:297] Added preallocation I0331 13:27:15.909547 1 qemu.go:237] 0.00 E0331 13:27:15.931761 1 prlimit.go:174] qemu-img failed output is: E0331 13:27:15.931785 1 prlimit.go:175] (0.00/100%) E0331 13:27:15.931791 1 prlimit.go:176] qemu-img: /dev/cdi-block-volume: error while converting raw: Unsupported preallocation mode 'full' I0331 13:27:15.931808 1 qemu.go:303] Unsupported preallocation mode. Retrying with [-S 0] I0331 13:27:15.931818 1 qemu.go:297] Added preallocation I0331 13:27:15.939046 1 qemu.go:237] 0.00 I0331 13:27:18.016448 1 qemu.go:237] 1.00 [...] I0331 13:34:40.528865 1 qemu.go:237] 97.46 I0331 13:34:42.323560 1 qemu.go:237] 98.49 I0331 13:34:43.950721 1 qemu.go:237] 99.51 I0331 13:34:45.392050 1 data-processor.go:239] New phase: Resize I0331 13:34:45.393327 1 data-processor.go:239] New phase: Complete I0331 13:34:45.393434 1 importer.go:212] Import Complete, Preallocation applied It seems retried preallocation falloc and full, if not support, it will try qemu-img with [-S 0]. Q1: preallocaiton has 4 modes (off, metadata, falloc, full). Take disk performance into account, falloc is faster than full, and both of them will make a non-sparse image. We don't have to care about preallocation=metadata that will make a sparse image, do we? Q2: qemu-img manual says "'-S' indicates the consecutive number of bytes (defaults to 4k) that must contain only zeros for qemu-img to create a sparse image during conversion. If the number of bytes is 0, the source will not be scanned for unallocated or zero sectors, and the destination image will always be fully allocated". Does it count as a preallocation policy?
Q1: Metadata preallocation is not supported for 'raw' images, which we use. Q2: The answer is more tricky than 'yes' or 'no'. It depends on image format, filesystem type and storage type. However, for raw image format and for most filesystems, it actually preallocates space for the image.
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 (CNV 2.6.1 Images), 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/RHEA-2021:1126