Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-28357

[2189463] [4.12]preallocation is always applied when importing image to block storage

XMLWordPrintable

    • Storage Core Sprint 236
    • Medium
    • None

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

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

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

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

              rh-ee-alromero Alvaro Romero
              rh-ee-alromero Alvaro Romero
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: