$ oc edit cdi
The Containerized Data Importer (CDI) can use the QEMU preallocate mode for data volumes to improve write performance. You can use preallocation mode for importing and uploading operations and when creating blank data volumes.
If preallocation is enabled, CDI uses the better preallocation method depending on the underlying file system and device type:
If the file system supports it, CDI uses the operating system’s
fallocate call to preallocate space by using the
posix_fallocate function, which allocates blocks and marks them as uninitialized.
fallocate mode cannot be used,
full mode allocates space for the image by writing data to the underlying storage. Depending on the storage location, all the empty allocated space might be zeroed.
You can enable cluster-wide preallocation mode for the Containerized Data Importer (CDI) by adding the
preallocation field to the
Install the OpenShift client (
oc client to edit the
$ oc edit cdi
spec.config.preallocation field with a value of
apiVersion: cdi.kubevirt.io/v1beta1 kind: CDI metadata: ... spec: config: preallocation: true (1)
Save and exit your editor to update the
CDI object and enable preallocation mode.
If preallocation is not globally enabled for the cluster, you can enable it for specific data volumes by including the
spec.preallocation field in the data volume manifest. You can enable preallocation mode in either the web console or by using the OpenShift client (
Preallocation mode is supported for all CDI source types.
spec.preallocation field in the data volume manifest:
apiVersion: cdi.kubevirt.io/v1beta1 kind: DataVolume metadata: name: preallocated-datavolume spec: source: (1) ... pvc: ... preallocation: true (2)
|1||All CDI source types support preallocation, however preallocation is ignored for cloning operations.|