fix: retain existing StorageClass selection and add fallback logic (#1271)

Previously, the Image and Volume create/edit forms would lose the user's StorageClass selection or silently pick an unavailable class.

Changes:
- Retain the existing StorageClass if it is still available
- Fall back in order: cluster default → longhorn → first selectable
- Block creation and show an informational message when no selectable StorageClass exists

Signed-off-by: pohanhuang <pohan.huang@suse.com>
This commit is contained in:
Po Han Huang authored and GitHub committed 2026-11-24 19:52:56 +08:00
1 parent 0a49829658
commit d80249773d
5 files changed
+375 -25

No files matched your search

+3
View File
@@ -1194,6 +1194,7 @@ harvester:
size: Size
volumeMode: Volume Mode
accessModes: Access Modes
storageClassUnavailable: No selectable StorageClasses are available. Create a StorageClass before creating a volume.
createWithDataVolume: Create with DataVolume
createWithDataVolumeTooltip: Create Volume with Kubevirt/Containerized Data Importer way. It can fill accessMode/volumeMode automatically.
showAdvanced: Show Advanced Options
@@ -1236,6 +1237,8 @@ harvester:
fileName: File Name
uploadFile: Upload File
source: Source Type
storageClassUnavailable: No selectable StorageClasses are available. Create a StorageClass before creating an image.
encryptedStorageClassUnavailable: No selectable encrypted StorageClasses are available. Create an encrypted StorageClass before creating an image.
sourceType:
download: URL
upload: File