$ oc edit cdi
DataVolume
objects are custom resources that are provided by the Containerized
Data Importer (CDI) project. Data volumes orchestrate import, clone, and upload
operations that are associated with an underlying persistent volume claim (PVC).
Data volumes are integrated with OpenShift Virtualization, and they prevent a virtual machine
from being started before the PVC has been prepared.
The Containerized Data Importer (CDI) requires scratch space (temporary storage) to complete some operations, such as importing and uploading virtual machine images. During this process, CDI provisions a scratch space PVC equal to the size of the PVC backing the destination data volume (DV). The scratch space PVC is deleted after the operation completes or aborts.
You can define the storage class that is used to bind the scratch space PVC in the spec.config.scratchSpaceStorageClass
field of the CDI
object.
If the defined storage class does not match a storage class in the cluster, then the default storage class defined for the cluster is used. If there is no default storage class defined in the cluster, the storage class used to provision the original DV or PVC is used.
CDI requires requesting scratch space with a |
If there are no storage classes, CDI uses any PVCs in the project that match the size requirements for the image. If there are no PVCs that match these requirements, the CDI import pod remains in a Pending state until an appropriate PVC is made available or until a timeout function kills the pod.
Type | Reason |
---|---|
Registry imports |
CDI must download the image to a scratch space and extract the layers to find the image file. The image file is then passed to QEMU-IMG for conversion to a raw disk. |
Upload image |
QEMU-IMG does not accept input from STDIN. Instead, the image to upload is saved in scratch space before it can be passed to QEMU-IMG for conversion. |
HTTP imports of archived images |
QEMU-IMG does not know how to handle the archive formats CDI supports. Instead, the image is unarchived and saved into scratch space before it is passed to QEMU-IMG. |
HTTP imports of authenticated images |
QEMU-IMG inadequately handles authentication. Instead, the image is saved to scratch space and authenticated before it is passed to QEMU-IMG. |
HTTP imports of custom certificates |
QEMU-IMG inadequately handles custom certificates of HTTPS endpoints. Instead, CDI downloads the image to scratch space before passing the file to QEMU-IMG. |
Dynamically provision scratch space for CDI operations by defining a storage class in the CDI
object.
Install the OpenShift client (oc
).
Use the oc
client to edit the CDI
object:
$ oc edit cdi
Edit the spec.config.scratchSpaceStorageClass
field to match a storage class in the cluster.
apiVersion: cdi.kubevirt.io/v1beta1
kind: CDI
...
spec:
config:
scratchSpaceStorageClass: "<storage_class>" (1)
...
1 | Replace <storage_class> with the storage class that you want to use to provision scratch space for CDI operations in your cluster. |
Save and exit your default editor to update the CDI
object.
This matrix shows the supported CDI operations for content types against endpoints, and which of these operations requires scratch space.
Content types | HTTP | HTTPS | HTTP basic auth | Registry | Upload |
---|---|---|---|---|---|
KubeVirt(QCOW2) |
✓ QCOW2 |
✓ QCOW2** |
✓ QCOW2 |
✓ QCOW2* |
✓ QCOW2* |
KubeVirt (RAW) |
✓ RAW |
✓ RAW |
✓ RAW |
✓ RAW* |
✓ RAW* |
✓ Supported operation
□ Unsupported operation
* Requires scratch space
** Requires scratch space if a custom certificate authority is required
See the Dynamic provisioning section for more information on storage classes and how these are defined in the cluster.