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-configuring-storage-class-bootsource-update.adoc
2025-11-18 16:29:25 +01:00

78 lines
2.4 KiB
Plaintext

// Module included in the following assembly:
//
// * virt/storage/virt-automatic-bootsource-updates.adoc
//
:_mod-docs-content-type: PROCEDURE
[id="virt-configuring-storage-class-bootsource-update_{context}"]
= Configuring a storage class for boot source images
[role="_abstract"]
You can configure a specific storage class in the `HyperConverged` resource.
[IMPORTANT]
====
To ensure stable behavior and avoid unnecessary re-importing, you can specify the `storageClassName` in the `dataImportCronTemplates` section of the `HyperConverged` resource.
====
.Prerequisites
* You have installed the {oc-first}.
.Procedure
. Open the `HyperConverged` CR in your default editor by running the following command:
+
[source,terminal,subs="attributes+"]
----
$ oc edit hyperconverged kubevirt-hyperconverged -n {CNVNamespace}
----
. Add the `dataImportCronTemplate` to the spec section of the `HyperConverged` resource and set the `storageClassName`:
+
[source,yaml]
----
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
spec:
dataImportCronTemplates:
- metadata:
name: rhel9-image-cron
spec:
template:
spec:
storage:
storageClassName: <storage_class> <1>
schedule: "0 */12 * * *" <2>
managedDataSource: <data_source> <3>
# ...
----
<1> Define the storage class.
<2> Required: Schedule for the job specified in cron format.
<3> Required: The data source to use.
+
--
[NOTE]
----
For the custom image to be detected as an available boot source, the value of the `spec.dataVolumeTemplates.spec.sourceRef.name` parameter in the VM template must match this value.
----
--
. Wait for the HyperConverged Operator (HCO) and Scheduling, Scale, and Performance (SSP) resources to complete reconciliation.
. Delete any outdated `DataVolume` and `VolumeSnapshot` objects from the `openshift-virtualization-os-images` namespace by running the following command.
+
[source,terminal]
----
$ oc delete DataVolume,VolumeSnapshot -n openshift-virtualization-os-images --selector=cdi.kubevirt.io/dataImportCron
----
. Wait for all `DataSource` objects to reach a "Ready - True" status. Data sources can reference either a PersistentVolumeClaim (PVC) or a VolumeSnapshot. To check the expected source format, run the following command:
+
[source,terminal]
----
$ oc get storageprofile <storage_class_name> -o json | jq .status.dataImportCronSourceFormat
----