diff --git a/web/console/src/modules/cluster/components/resource/virtual-machine/constants/index.tsx b/web/console/src/modules/cluster/components/resource/virtual-machine/constants/index.tsx index fc0cc4f372..a73c5ff8fa 100644 --- a/web/console/src/modules/cluster/components/resource/virtual-machine/constants/index.tsx +++ b/web/console/src/modules/cluster/components/resource/virtual-machine/constants/index.tsx @@ -28,6 +28,7 @@ export interface DiskInterface { type: DiskTypeEnum; volumeMode: VolumeModeEnum; storageClass: string; + scProvisioner: string; size: number; } diff --git a/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/diskPanel.tsx b/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/diskPanel.tsx index 2fa787c062..0dd0840a6e 100644 --- a/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/diskPanel.tsx +++ b/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/diskPanel.tsx @@ -24,6 +24,7 @@ export const DiskPanel = () => { type: DiskTypeEnum.Data, volumeMode: VolumeModeEnum.Filesystem, storageClass: null, + scProvisioner: null, size: 50 } ]; @@ -97,6 +98,9 @@ export const DiskPanel = () => { onChange={storageClass => modifyDiskItem({ storageClass, + scProvisioner: + storageClassListLoadable?.contents?.find(({ value }) => value === storageClass)?.provisioner ?? + null, id }) } diff --git a/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/index.tsx b/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/index.tsx index c4c192a550..67aaf5b207 100644 --- a/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/index.tsx +++ b/web/console/src/modules/cluster/components/resource/virtual-machine/pages/create/index.tsx @@ -64,7 +64,9 @@ export const VMCreatePanel = () => { }); history.back(); - } catch (error) {} + } catch (error) { + console.log('createVm error --->', error); + } } return ( diff --git a/web/console/src/modules/cluster/components/resource/virtual-machine/store/creation.ts b/web/console/src/modules/cluster/components/resource/virtual-machine/store/creation.ts index c09885b7be..f62729eb12 100644 --- a/web/console/src/modules/cluster/components/resource/virtual-machine/store/creation.ts +++ b/web/console/src/modules/cluster/components/resource/virtual-machine/store/creation.ts @@ -33,6 +33,7 @@ export const diskListState = atom({ type: DiskTypeEnum.System, volumeMode: VolumeModeEnum.Filesystem, storageClass: null, + scProvisioner: null, size: 50 }, @@ -42,6 +43,7 @@ export const diskListState = atom({ type: DiskTypeEnum.Data, volumeMode: VolumeModeEnum.Filesystem, storageClass: null, + scProvisioner: null, size: 50 } ] @@ -56,7 +58,7 @@ export const storageClassListState = selector({ const { items } = await storageClassAPI.fetchStorageClassList(clusterId); - return items?.map(({ metadata }) => ({ value: metadata?.name })) ?? []; + return items?.map(({ metadata, provisioner }) => ({ value: metadata?.name, provisioner })) ?? []; } }); diff --git a/web/console/src/webApi/virtual-machine.ts b/web/console/src/webApi/virtual-machine.ts index cd078f001e..edb19fa71c 100644 --- a/web/console/src/webApi/virtual-machine.ts +++ b/web/console/src/webApi/virtual-machine.ts @@ -1,3 +1,4 @@ +import { VolumeModeEnum } from '@src/modules/cluster/components/resource/virtual-machine/constants'; import { Request, generateQueryString } from './request'; const IMAGE_NAMESPACE = 'kube-public'; @@ -221,7 +222,9 @@ export function createVM({ } }, - volumeMode: item.volumeMode, + volumeMode: ['loopdevice.csi.infra.tce.io', 'rbd.csi.ceph.com'].includes(item?.scProvisioner) + ? VolumeModeEnum.Block + : VolumeModeEnum.Filesystem, storageClassName: item.storageClass },