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

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


(cherry picked from commit d80249773d)

Signed-off-by: pohanhuang <pohan.huang@suse.com>
Co-authored-by: Po Han Huang <pohan.huang@suse.com>
This commit is contained in:
mergify[bot]andPo Han Huang authored and GitHub committed 2026-11-28 00:15:13 +08:00
1 parent 9e2c8ca1ff
commit 56c0261403
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