KubeVirt – Creating Data Volume fails – DataVolume.storage spec is missing accessMode and volumeMode

This post was originally published on this site

The Issue

I had a freshly deployed Red Hat OpenShift cluster on which I had set up OpenShift Virtualization (KubeVirt). When I tried to create my first data volume so I could start creating VMs, nothing happened. The ISO file upload would fail.

Running oc describe dv {name} -n {namespace} showed the below event/error.

DataVolume.storage spec is missing accessMode and volumeMode, cannot get access mode from StorageProfile managed-nfs-storage
The Cause

This is caused by default created StorageProfile used by KubeVirt, which will be created from your default StorageClass, not setting the correct values, as per this git issue comment.

Previously virtctl (CLI for KubeVirt) used ReadWriteOnce if accessMode was not specified. But now, as we want to use possibilities provided by StorageProfiles, it does not set accessMode.
The Fix

Run the following command to update your StorageProfile with the correct settings, pay attention to whether you needReadWriteOnce or ReadWriteMany.

kubectl patch StorageProfile {StorageProfileName} 
  --type merge -p 
  '{"spec": {"claimPropertySets": [{"accessModes": ["ReadWriteOnce"]}]}}' 

Regards

https://platform.twitter.com/widgets.js

Dean Lewis

The post KubeVirt – Creating Data Volume fails – DataVolume.storage spec is missing accessMode and volumeMode appeared first on vEducate.co.uk.