fix: VM's machine type options is not support (#307)

* feat: get options from API

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>

* feat: add feature flag

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>

* refactor: remove default value

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>

* refactor: fallback to none

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>

---------

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
Yiya Chen
2025-06-02 12:38:04 +08:00
committed by GitHub
parent d6da4898b4
commit 7ecc9c320d
4 changed files with 18 additions and 9 deletions
+6 -1
View File
@@ -157,6 +157,7 @@ export default {
diskRows: [],
networkRows: [],
machineType: '',
machineTypes: [],
secretName: '',
secretRef: null,
showAdvanced: false,
@@ -295,6 +296,9 @@ export default {
async created() {
await this.$store.dispatch(`${ this.inStore }/findAll`, { type: SECRET });
const machineTypes = this.value.vmMachineTypesFeatureEnabled ? await this.$store.dispatch('harvester/request', { url: '/v1/harvester/clusters/local?link=machineTypes' }) : [''];
this.machineTypes = machineTypes;
this.getInitConfig({ value: this.value, init: this.isCreate });
},
@@ -331,7 +335,8 @@ export default {
const maintenanceStrategy = vm.metadata.labels?.[HCI_ANNOTATIONS.VM_MAINTENANCE_MODE_STRATEGY] || 'Migrate';
const runStrategy = spec.runStrategy || 'RerunOnFailure';
const machineType = value.machineType;
const machineType = spec.template.spec.domain?.machine?.type || this.machineTypes[0];
const cpu = spec.template.spec.domain?.cpu?.cores;
const memory = spec.template.spec.domain.resources.limits.memory;
const reservedMemory = vm.metadata?.annotations?.[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];