+++ This bug was initially created as a clone of Bug #2168165 +++ Description of problem: When we create a datavolume by importing an image via http url, preallocation is being applied .We tried setting preallocation to false, but still preallocation is being applied. storage class name : ocs-external-storagecluster-ceph-rbd Version-Release number of selected component (if applicable): Server Version: 4.12.1 OpenShift Virtualization 4.12.0 How reproducible: 100% Steps to Reproduce: 1.Used below image to create our volume, actual size of this image is 747MB #qemu-img info rhel-8.5-update-2-x86_64-kvm.qcow2 image: rhel-8.5-update-2-x86_64-kvm.qcow2 file format: qcow2 virtual size: 10 GiB (10737418240 bytes) disk size: 747 MiB cluster_size: 65536 Format specific information: compat: 0.10 refcount bits: 16 2. Created datavol.yaml with preallocation: false # cat datavol.yaml apiVersion: cdi.kubevirt.io/v1beta1 kind: DataVolume metadata: name: preallocation-false2 spec: preallocation: false storage: resources: requests: storage: 20Gi storageClassName: ocs-external-storagecluster-ceph-rbd volumeMode: Block source: http: url: http://10.74.128.145/rhel-8.5-update-2-x86_64-kvm.qcow2 2. Created a dv from the above yaml file # oc apply -f datavol.yaml datavolume.cdi.kubevirt.io/preallocation-false2 created #oc logs -f importer-preallocation-false2 I0208 10:06:15.478140 1 importer.go:104] Starting importer I0208 10:06:15.479217 1 importer.go:171] begin import process I0208 10:06:15.481932 1 data-processor.go:379] Calculating available size I0208 10:06:15.483183 1 data-processor.go:387] Checking out block volume size. I0208 10:06:15.483201 1 data-processor.go:399] Request image size not empty. I0208 10:06:15.483210 1 data-processor.go:404] Target size 21474836480. I0208 10:06:15.483618 1 nbdkit.go:303] Waiting for nbdkit PID. I0208 10:06:15.990529 1 nbdkit.go:324] nbdkit ready. I0208 10:06:15.990584 1 data-processor.go:282] New phase: Convert I0208 10:06:15.990597 1 data-processor.go:288] Validating image I0208 10:06:16.165295 1 qemu.go:332] Adding preallocation method: [-o preallocation=falloc] I0208 10:06:16.170468 1 qemu.go:259] 0.00 The used size of the image is equal to the virtual size of the image. # rbd du csi-vol-35cc672d-a798-11ed-8a89-0a580a80001a NAME PROVISIONED USED csi-vol-35cc672d-a798-11ed-8a89-0a580a80001a 20 GiB 10 GiB Actual results: On checking the pod logs for the created volume, we could see that preallocation is being applied and it consumed 10GB from the CEPH end (logs provided in the above step) Expected results: Since we applied preallocation to false in the datavol.yaml file , the created volume size should consume only 747MiB which is actually the disk size of the img we are using.
Test on CNV-v4.12.3-59, issue has been fixed. $ qemu-img info rhel-85.raw image: rhel-85.raw file format: raw virtual size: 10 GiB (10737418240 bytes) disk size: 1.68 GiB sh-4.4$ rbd ls ocs-storagecluster-cephblockpool csi-vol-0f7646be-3f56-4261-84db-d2ceea81ec1d sh-4.4$ rbd du ocs-storagecluster-cephblockpool/csi-vol-0f7646be-3f56-4261-84db-d2ceea81ec1d NAME PROVISIONED USED csi-vol-0f7646be-3f56-4261-84db-d2ceea81ec1d 20 GiB 1.7 GiB
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 (OpenShift Virtualization 4.12.3 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-2023:3283