Expanding virtual storage by adding blank disk images

You can increase your storage capacity or create new data partitions by adding blank disk images to OKD Virtualization.

About data volumes

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 OKD Virtualization, and they prevent a virtual machine from being started before the PVC has been prepared.

Creating a blank disk image with data volumes

You can create a new blank disk image in a persistent volume claim by customizing and deploying a data volume configuration file.

Prerequisites

  • At least one available persistent volume.

  • Install the OpenShift CLI (oc).

Procedure

  1. Edit the data volume configuration file:

    1. apiVersion: cdi.kubevirt.io/v1beta1
    2. kind: DataVolume
    3. metadata:
    4. name: blank-image-datavolume
    5. spec:
    6. source:
    7. blank: {}
    8. pvc:
    9. # Optional: Set the storage class or omit to accept the default
    10. # storageClassName: "hostpath"
    11. accessModes:
    12. - ReadWriteOnce
    13. resources:
    14. requests:
    15. storage: 500Mi
  2. Create the blank disk image by running the following command:

    1. $ oc create -f <blank-image-datavolume>.yaml

Template: Data volume configuration file for blank disk images

blank-image-datavolume.yaml

  1. apiVersion: cdi.kubevirt.io/v1beta1
  2. kind: DataVolume
  3. metadata:
  4. name: blank-image-datavolume
  5. spec:
  6. source:
  7. blank: {}
  8. pvc:
  9. # Optional: Set the storage class or omit to accept the default
  10. # storageClassName: "hostpath"
  11. accessModes:
  12. - ReadWriteOnce
  13. resources:
  14. requests:
  15. storage: 500Mi

Additional resources