1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-customizing-storage-profile.adoc
2023-10-30 10:13:25 -04:00

109 lines
4.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/storage/virt-customizing-storageprofiles.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-customizing-storage-profile_{context}"]
= Customizing the storage profile
You can specify default parameters by editing the `StorageProfile` object for the provisioner's storage class. These default parameters only apply to the persistent volume claim (PVC) if they are not configured in the `DataVolume` object.
An empty `status` section in a storage profile indicates that a storage provisioner is not recognized by the Containerized Data Interface (CDI). Customizing a storage profile is necessary if you have a storage provisioner that is not recognized by CDI. In this case, the administrator sets appropriate values in the storage profile to ensure successful allocations.
[WARNING]
====
If you create a data volume and omit YAML attributes and these attributes are not defined in the storage profile, then the requested storage will not be allocated and the underlying persistent volume claim (PVC) will not be created.
====
.Prerequisites
* Ensure that your planned configuration is supported by the storage class and its provider. Specifying an incompatible configuration in a storage profile causes volume provisioning to fail.
.Procedure
. Edit the storage profile. In this example, the provisioner is not recognized by CDI:
+
[source,terminal,subs="attributes+"]
----
$ oc edit -n {CNVNamespace} storageprofile <storage_class>
----
+
.Example storage profile
[source,yaml]
----
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
name: <unknown_provisioner_class>
# ...
spec: {}
status:
provisioner: <unknown_provisioner>
storageClass: <unknown_provisioner_class>
----
+
. Provide the needed attribute values in the storage profile:
+
.Example storage profile
[source,yaml]
----
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
name: <unknown_provisioner_class>
# ...
spec:
claimPropertySets:
- accessModes:
- ReadWriteOnce <1>
volumeMode:
Filesystem <2>
status:
provisioner: <unknown_provisioner>
storageClass: <unknown_provisioner_class>
----
<1> The `accessModes` that you select.
<2> The `volumeMode` that you select.
+
After you save your changes, the selected values appear in the storage profile `status` element.
[id="virt-customizing-storage-profile-default-cloning-strategy_{context}"]
== Setting a default cloning strategy using a storage profile
You can use storage profiles to set a default cloning method for a storage class, creating a _cloning strategy_. Setting cloning strategies can be helpful, for example, if your storage vendor only supports certain cloning methods. It also allows you to select a method that limits resource usage or maximizes performance.
Cloning strategies can be specified by setting the `cloneStrategy` attribute in a storage profile to one of these values:
* `snapshot` is used by default when snapshots are configured. This cloning strategy uses a temporary volume snapshot to clone the volume. The storage provisioner must support Container Storage Interface (CSI) snapshots.
* `copy` uses a source pod and a target pod to copy data from the source volume to the target volume. Host-assisted cloning is the least efficient method of cloning.
* `csi-clone` uses the CSI clone API to efficiently clone an existing volume without using an interim volume snapshot. Unlike `snapshot` or `copy`, which are used by default if no storage profile is defined, CSI volume cloning is only used when you specify it in the `StorageProfile` object for the provisioner's storage class.
[NOTE]
====
You can also set clone strategies using the CLI without modifying the default `claimPropertySets` in your YAML `spec` section.
====
.Example storage profile
[source,yaml]
----
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
name: <provisioner_class>
# ...
spec:
claimPropertySets:
- accessModes:
- ReadWriteOnce <1>
volumeMode:
Filesystem <2>
cloneStrategy: csi-clone <3>
status:
provisioner: <provisioner>
storageClass: <provisioner_class>
----
<1> Specify the access mode.
<2> Specify the volume mode.
<3> Specify the default cloning strategy.