...
data:
accessMode: ReadWriteOnce (1)
volumeMode: Filesystem (2)
<new>.accessMode: ReadWriteMany (3)
<new>.volumeMode: Block (4)
The kubevirt-storage-class-defaults
configmap provides access mode and volume mode defaults for DataVolumes. You can edit or add storage class defaults to the configmap in order to create DataVolumes in the web console that better match the underlying storage.
DataVolumes require a defined access mode and volume mode to be created in the web console.
These storage settings are configured by default with a ReadWriteOnce
access mode and Filesystem
volume mode.
You can modify these settings by editing the kubevirt-storage-class-defaults
configmap in the openshift-cnv
namespace.
You can also add settings for other storage classes in order to create DataVolumes in the web console for different storage types.
You must configure storage settings that are supported by the underlying storage. |
All DataVolumes that you create in the web console use the default storage settings unless you specify a storage class that is also defined in the configmap.
DataVolumes support the following access modes:
ReadWriteOnce
: The volume can be mounted as read-write by a single node. ReadWriteOnce
has greater versatility and is the default setting.
ReadWriteMany
: The volume can be mounted as read-write by many nodes. ReadWriteMany
is required for some features, such as live migration of virtual machines between nodes.
ReadWriteMany
is recommended if the underlying storage supports it.
The volume mode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. DataVolumes support the following volume modes:
Filesystem
: Creates a filesystem on the DataVolume. This is the default setting.
Block
: Creates a block DataVolume. Only use Block
if the underlying storage supports it.
Modify the storage settings for DataVolumes by editing the kubevirt-storage-class-defaults
configmap in the openshift-cnv
namespace.
You can also add settings for other storage classes in order to create DataVolumes in the web console for different storage types.
You must configure storage settings that are supported by the underlying storage. |
Click Workloads → Config Maps from the side menu.
In the Project list, select openshift-cnv.
Click kubevirt-storage-class-defaults to open the Config Map Overview.
Click the YAML tab to display the editable configuration.
Update the data
values with the storage configuration that is appropriate for your underlying storage:
...
data:
accessMode: ReadWriteOnce (1)
volumeMode: Filesystem (2)
<new>.accessMode: ReadWriteMany (3)
<new>.volumeMode: Block (4)
1 | The default accessMode is ReadWriteOnce . |
2 | The default volumeMode is Filesystem . |
3 | If you add an access mode for a storage class, replace the <new> part of the parameter with the storage class name. |
4 | If you add a volume mode for a storage class, replace the <new> part of the parameter with the storage class name. |
Click Save to update the config map.
Modify the storage settings for DataVolumes by editing the kubevirt-storage-class-defaults
configmap in the openshift-cnv
namespace.
You can also add settings for other storage classes in order to create DataVolumes in the web console for different storage types.
You must configure storage settings that are supported by the underlying storage. |
Edit the configmap by running the following command:
$ oc edit configmap kubevirt-storage-class-defaults -n openshift-cnv
Update the data
values of the configmap:
...
data:
accessMode: ReadWriteOnce (1)
volumeMode: Filesystem (2)
<new>.accessMode: ReadWriteMany (3)
<new>.volumeMode: Block (4)
1 | The default accessMode is ReadWriteOnce . |
2 | The default volumeMode is Filesystem . |
3 | If you add an access mode for storage class, replace the <new> part of the parameter with the storage class name. |
4 | If you add a volume mode for a storage class, replace the <new> part of the parameter with the storage class name. |
Save and exit the editor to update the config map.
The following YAML file is an example of a kubevirt-storage-class-defaults
configmap that has storage settings configured for two storage classes, migration
and block
.
Ensure that all settings are supported by your underlying storage before you update the configmap.
kind: configmap
apiVersion: v1
metadata:
name: kubevirt-storage-class-defaults
namespace: openshift-cnv
...
data:
accessMode: ReadWriteOnce
volumeMode: Filesystem
nfs-sc.accessMode: ReadWriteMany
nfs-sc.volumeMode: Filesystem
block-sc.accessMode: ReadWriteMany
block-sc.volumeMode: Block