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-snapshot-class-cli.adoc
2025-05-21 18:36:05 +00:00

40 lines
1.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/storage/virt-configuring-storage-profile.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-customizing-storage-profile-snapshot-class-cli_{context}"]
= Specifying a volume snapshot class by using the CLI
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.
You can select which volume snapshot class to use by either:
* Setting the `spec.snapshotClass` for the storage profile.
* Setting a default volume snapshot class.
.Prerequisites
* You have installed the {oc-first}.
.Procedure
* Set the `VolumeSnapshotClass` you want to use. For example:
+
[source,yaml]
----
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
name: ocs-storagecluster-ceph-rbd-virtualization
spec:
snapshotClass: ocs-storagecluster-rbdplugin-snapclass
----
* Alternatively, set the default volume snapshot class by running the following command:
+
[source,terminal]
----
# oc patch VolumeSnapshotClass ocs-storagecluster-cephfsplugin-snapclass --type=merge -p '{"metadata":{"annotations":{"snapshot.storage.kubernetes.io/is-default-class":"true"}}}'
----