Skip to content

Commit 235540f

Browse files
authored
Merge pull request #92884 from aspauldi/CNV-44025
2 parents 8362c24 + de671e3 commit 235540f

5 files changed

+109
-63
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/storage/virt-configuring-storage-profile.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-customizing-storage-profile-default-cloning-strategy_{context}"]
7+
= Setting a default cloning strategy by using a storage profile
8+
9+
You can use storage profiles to set a default cloning method for a storage class by creating a cloning strategy. Setting cloning strategies can be helpful, for example, if your storage vendor supports only certain cloning methods. It also allows you to select a method that limits resource usage or maximizes performance.
10+
11+
Cloning strategies are specified by setting the `cloneStrategy` attribute in a storage profile to one of the following values:
12+
13+
* `snapshot` is used by default when snapshots are configured. The Containerized Data Importer (CDI) will use the snapshot method if it recognizes the storage provider and the provider supports Container Storage Interface (CSI) snapshots. This cloning strategy uses a temporary volume snapshot to clone the volume.
14+
* `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.
15+
* `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.
16+
17+
[NOTE]
18+
====
19+
You can set clone strategies using the CLI without modifying the default `claimPropertySets` in your YAML `spec` section.
20+
====
21+
22+
.Example storage profile
23+
[source,yaml]
24+
----
25+
apiVersion: cdi.kubevirt.io/v1beta1
26+
kind: StorageProfile
27+
metadata:
28+
name: <provisioner_class>
29+
# ...
30+
spec:
31+
claimPropertySets:
32+
- accessModes:
33+
- ReadWriteOnce <1>
34+
volumeMode: Filesystem <2>
35+
cloneStrategy: csi-clone <3>
36+
status:
37+
provisioner: <provisioner>
38+
storageClass: <provisioner_class>
39+
----
40+
<1> Specify the `accessModes`.
41+
<2> Specify the `volumeMode`.
42+
<3> Specify the default `cloneStrategy`.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/storage/virt-configuring-storage-profile.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-customizing-storage-profile-snapshot-class-cli_{context}"]
7+
= Specifying a volume snapshot class by using the CLI
8+
9+
If you are creating a snapshot of a VM, a warning appears if the storage class of the disk has more than one volume snapshot class associated with it. In this case, you must specify one volume snapshot class; otherwise, any disk that has more than one volume snapshot class is excluded from the snapshots list.
10+
11+
You can select which volume snapshot class to use by either:
12+
13+
* Setting the `spec.snapshotClass` for the storage profile.
14+
* Setting a default volume snapshot class.
15+
16+
.Procedure
17+
18+
* Set the `VolumeSnapshotClass` you want to use. For example:
19+
+
20+
[source,yaml]
21+
----
22+
apiVersion: cdi.kubevirt.io/v1beta1
23+
kind: StorageProfile
24+
metadata:
25+
name: ocs-storagecluster-ceph-rbd-virtualization
26+
spec:
27+
snapshotClass: ocs-storagecluster-rbdplugin-snapclass
28+
----
29+
30+
* Alternatively, set the default volume snapshot class by running the following command:
31+
+
32+
[source,terminal]
33+
----
34+
# oc patch VolumeSnapshotClass ocs-storagecluster-cephfsplugin-snapclass --type=merge -p '{"metadata":{"annotations":{"snapshot.storage.kubernetes.io/is-default-class":"true"}}}'
35+
----
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/storage/virt-configuring-storage-profile.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-customizing-storage-profile-snapshot-class_web_{context}"]
7+
= Specifying a volume snapshot class by using the web console
8+
9+
If you are creating a snapshot of a VM, a warning appears if the storage class of the disk has more than one volume snapshot class associated with it. In this case, you must specify one volume snapshot class; otherwise, any disk that has more than one volume snapshot class is excluded from the snapshots list.
10+
11+
You can specify the default volume snapshot class in the {product-title} web console.
12+
13+
.Procedure
14+
15+
. From the *Virtualization* focused view, select *Storage*.
16+
. Click *VolumeSnapshotClasses*.
17+
. Select a volume snapshot class from the list.
18+
. Click the *Annotations* pencil icon.
19+
. Enter the following *Key*: `snapshot.storage.kubernetes.io/is-default-class`.
20+
. Enter the following *Value*: `true`.
21+
. Click *Save*.

modules/virt-customizing-storage-profile.adoc

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="virt-customizing-storage-profile_{context}"]
7-
87
= Customizing the storage profile
98

109
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.
1110

1211
You cannot modify storage class parameters. To make changes, delete and re-create the storage class. You must then reapply any customizations that were previously made to the storage profile.
1312

14-
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.
13+
An empty `status` section in a storage profile indicates that a storage provisioner is not recognized by the Containerized Data Importer (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.
14+
15+
If you are creating a snapshot of a VM, a warning appears if the storage class of the disk has more than one `VolumeSnapshotClass` associated with it. In this case, you must specify one volume snapshot class; otherwise, any disk that has more than one volume snapshot class is excluded from the snapshots list.
1516

1617
[WARNING]
1718
====
@@ -31,21 +32,7 @@ If you create a data volume and omit YAML attributes and these attributes are no
3132
$ oc edit storageprofile <storage_class>
3233
----
3334
+
34-
.Example storage profile
35-
[source,yaml]
36-
----
37-
apiVersion: cdi.kubevirt.io/v1beta1
38-
kind: StorageProfile
39-
metadata:
40-
name: <unknown_provisioner_class>
41-
# ...
42-
spec: {}
43-
status:
44-
provisioner: <unknown_provisioner>
45-
storageClass: <unknown_provisioner_class>
46-
----
47-
+
48-
. Provide the needed attribute values in the storage profile:
35+
. Specify the `accessModes` and `volumeMode` values you want to configure for the storage profile. For example:
4936
+
5037
.Example storage profile
5138
[source,yaml]
@@ -59,52 +46,10 @@ spec:
5946
claimPropertySets:
6047
- accessModes:
6148
- ReadWriteOnce <1>
62-
volumeMode:
63-
Filesystem <2>
49+
volumeMode: Filesystem <2>
6450
status:
6551
provisioner: <unknown_provisioner>
6652
storageClass: <unknown_provisioner_class>
6753
----
68-
<1> The `accessModes` that you select.
69-
<2> The `volumeMode` that you select.
70-
+
71-
After you save your changes, the selected values appear in the storage profile `status` element.
72-
73-
[id="virt-customizing-storage-profile-default-cloning-strategy_{context}"]
74-
== Setting a default cloning strategy using a storage profile
75-
76-
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.
77-
78-
Cloning strategies can be specified by setting the `cloneStrategy` attribute in a storage profile to one of these values:
79-
80-
* `snapshot` is used by default when snapshots are configured. The CDI will use the snapshot method if it recognizes the storage provider and the provider supports Container Storage Interface (CSI) snapshots. This cloning strategy uses a temporary volume snapshot to clone the volume.
81-
* `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.
82-
* `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.
83-
84-
[NOTE]
85-
====
86-
You can also set clone strategies using the CLI without modifying the default `claimPropertySets` in your YAML `spec` section.
87-
====
88-
89-
.Example storage profile
90-
[source,yaml]
91-
----
92-
apiVersion: cdi.kubevirt.io/v1beta1
93-
kind: StorageProfile
94-
metadata:
95-
name: <provisioner_class>
96-
# ...
97-
spec:
98-
claimPropertySets:
99-
- accessModes:
100-
- ReadWriteOnce <1>
101-
volumeMode:
102-
Filesystem <2>
103-
cloneStrategy: csi-clone <3>
104-
status:
105-
provisioner: <provisioner>
106-
storageClass: <provisioner_class>
107-
----
108-
<1> Specify the access mode.
109-
<2> Specify the volume mode.
110-
<3> Specify the default cloning strategy.
54+
<1> Specify the `accessModes`.
55+
<2> Specify the `volumeMode`.

virt/storage/virt-configuring-storage-profile.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ To specify RBD block mode PVCs, use the 'ocs-storagecluster-ceph-rbd' storage cl
2222
endif::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
2323

2424
include::modules/virt-customizing-storage-profile.adoc[leveloffset=+1]
25-
include::modules/virt-viewing-automatically-created-storage-profiles.adoc[leveloffset=+2]
25+
include::modules/virt-customizing-storage-profile-snapshot-class-web.adoc[leveloffset=+2]
26+
include::modules/virt-customizing-storage-profile-snapshot-class-cli.adoc[leveloffset=+2]
27+
include::modules/virt-viewing-automatically-created-storage-profiles.adoc[leveloffset=+2]
28+
include::modules/virt-customizing-storage-profile-default-cloning-strategy.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)