Bug 1927746

Summary: Preallocation is not requested if DataVolume doesn't specify it on spec while it is enabled globally
Product: Container Native Virtualization (CNV) Reporter: Qixuan Wang <qixuan.wang>
Component: StorageAssignee: Tomasz Barański <tbaransk>
Status: CLOSED ERRATA QA Contact: Qixuan Wang <qixuan.wang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.6.0CC: alitke, cnv-qe-bugs, mrashish, ngavrilo, tbaransk, ycui
Target Milestone: ---   
Target Release: 2.6.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-cdi-importer v2.6.1-2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-07 08:46:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Qixuan Wang 2021-02-11 13:11:36 UTC
Description of problem:
If preallocation is enabled globally, create a DataVolume without preallocation stated, the annotation of DV's PVC is cdi.kubevirt.io/storage.preallocacation.requested: "false"

Discussed with Tomasz, the correct behavior is:
DV preallocation: true -> cdi.kubevirt.io/storage.preallocacation.requested: true
DV preallocation: false -> cdi.kubevirt.io/storage.preallocacation.requested: false
DV preallocation not present
global: true -> cdi.kubevirt.io/storage.preallocacation.requested: true
global: false -> cdi.kubevirt.io/storage.preallocacation.requested: false
global not present -> cdi.kubevirt.io/storage.preallocacation.requested: false (false is the default)


Version-Release number of selected component (if applicable):
Containerized Data Importer v1.28.2


How reproducible:
100%

Steps to Reproduce:
1. Enable preallocation globally.
$ [cnv-qe-jenkins@stg05-qixuan-b59vp-executor ~]$ oc get cdi -o yaml
apiVersion: v1
items:
- apiVersion: cdi.kubevirt.io/v1beta1
  kind: CDI
  metadata:
[...]
  spec:
    config:
      featureGates:
      - HonorWaitForFirstConsumer
      filesystemOverhead:
        global: "0.055"
      preallocation: true
    infra: {}
    uninstallStrategy: BlockUninstallIfWorkloadsExist
    workload: {}
  status:
[...]

2. Create a general DataVolume 
3. Check DV's PVC annotation.

Actual results:
[cnv-qe-jenkins@stg05-qixuan-b59vp-executor ~]$ oc get pvc xxx -o yaml | grep pre
cdi.kubevirt.io/storage.preallocacation.requested: "false"


Expected results:
cdi.kubevirt.io/storage.preallocacation.requested: "true"


Additional info:

Comment 1 Adam Litke 2021-02-18 21:06:50 UTC
Tomasz please take a look at this bug and see how it's different from Bug 1915704.

Comment 2 Tomasz Barański 2021-02-19 09:58:41 UTC
Bug 1915704 was reported as a problem with strict reconciliation and the resulting change in how CDI is configured, which turned out not to be a bug but a confusion regarding the correct way to setup configuration.

However, an actual bug has been discovered with global configuration during investigation. Qi Xuan decided to verify 1915704 and open this one to track the real bug.

Comment 3 Maya Rashish 2021-03-14 16:08:48 UTC
I changed it to ON_QA assuming that the linked PR (now merged) fixes the bug, please let me know if that's wrong.

Comment 4 Qixuan Wang 2021-03-18 08:38:04 UTC
Tested with Containerized Data Importer v1.28.3-9-g1f74571, the bug has been fixed. Move it to VERIFIED, thanks.


Here is the test record.
[cnv-qe-jenkins@stg11-gcp6c-executor ~]$ oc logs -f importer-my-dv-rbd
I0318 08:25:07.239470       1 importer.go:52] Starting importer
I0318 08:25:07.239609       1 importer.go:134] begin import process
I0318 08:25:07.251269       1 data-processor.go:345] Calculating available size
I0318 08:25:07.251330       1 data-processor.go:357] Checking out file system volume size.
I0318 08:25:07.251344       1 data-processor.go:365] Request image size not empty.
I0318 08:25:07.251358       1 data-processor.go:370] Target size 5179580416.
I0318 08:25:07.251530       1 util.go:37] deleting file: /data/lost+found
I0318 08:25:07.253204       1 data-processor.go:239] New phase: Convert
I0318 08:25:07.253227       1 data-processor.go:245] Validating image
I0318 08:25:07.428231       1 qemu.go:127] Added preallocation
I0318 08:25:07.435039       1 qemu.go:224] 0.00
I0318 08:25:09.975036       1 qemu.go:224] 1.00
I0318 08:25:12.621699       1 qemu.go:224] 2.00
I0318 08:25:15.269274       1 qemu.go:224] 3.01
I0318 08:25:18.192360       1 qemu.go:224] 4.01
[...]
I0318 08:29:38.005117       1 qemu.go:224] 97.50
I0318 08:29:42.047971       1 qemu.go:224] 98.50
I0318 08:29:44.883173       1 qemu.go:224] 99.50
I0318 08:29:46.693848       1 data-processor.go:239] New phase: Resize
W0318 08:29:46.719944       1 data-processor.go:331] Available space less than requested size, resizing image to available space 4894703104.
I0318 08:29:46.719972       1 data-processor.go:337] Expanding image size to: 4894703104
I0318 08:29:46.744381       1 data-processor.go:239] New phase: Preallocate
I0318 08:29:46.744425       1 qemu.go:105] Added preallocation
I0318 08:29:46.837427       1 data-processor.go:239] New phase: Complete
I0318 08:29:46.837540       1 importer.go:212] Import Complete, Preallocation applied


[cnv-qe-jenkins@stg11-gcp6c-executor ~]$ oc get pvc my-dv-rbd -o yaml | grep pre
    cdi.kubevirt.io/storage.preallocacation.requested: "true"
    cdi.kubevirt.io/storage.preallocation: "true"
          f:cdi.kubevirt.io/storage.preallocacation.requested: {}
          f:cdi.kubevirt.io/storage.preallocation: {}

Comment 9 errata-xmlrpc 2021-04-07 08:46:03 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 (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