When you create a data volume using the storage API, the Containerized Data Interface (CDI) optimizes your persistent volume claim (PVC) allocation based on the type of storage supported by your selected storage class. You only have to specify the data volume name, namespace, and the amount of storage that you want to allocate.
When using Ceph RBD,
accessModes is automatically set to
ReadWriteMany, which enables live migration.
volumeMode is set to
Block to maximize performance.
When you are using
volumeMode: Filesystem, more space will automatically be requested by the CDI, if required to accommodate file system overhead.
In the following YAML, using the storage API requests a data volume with two gigabytes of usable space. The user does not need to know the
volumeMode in order to correctly estimate the required persistent volume claim (PVC) size. The CDI chooses the optimal combination of
volumeMode attributes automatically. These optimal values are based on the type of storage or the defaults that you define in your storage profile. If you want to provide custom values, they override the system-calculated values.
Example DataVolume definition
name: <datavolume> (1)
namespace: "<source_namespace>" (3)
name: "<my_vm_disk>" (4)
storage: 2Gi (6)
storageClassName: <storage_class> (7)
||The name of the new data volume.
||Indicate that the source of the import is an existing persistent volume claim (PVC).
||The namespace where the source PVC exists.
||The name of the source PVC.
||Indicates allocation using the storage API.
||Specifies the amount of available space that you request for the PVC.
||Optional: The name of the storage class. If the storage class is not specified, the system default storage class is used.