fix: allow to edit as yaml if has empty CPU or memory (#547) (#549)

* fix: allow edit as yaml in create VM page if empty CPU or memory



* refactor: remove getCPUMemoryValidation



---------


(cherry picked from commit 5c2a23924d)

Signed-off-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
mergify[bot]
2025-10-08 16:24:50 +08:00
committed by GitHub
co-authored by Andy Lee
parent 1e0e2ea867
commit 3ef5a14567
3 changed files with 25 additions and 21 deletions
+3 -3
View File
@@ -3,15 +3,15 @@ import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations
export function getVmCPUMemoryValues(vm) {
if (!vm) {
return {
cpu: 0,
cpu: null,
memory: null,
isHotplugEnabled: false
};
}
const isHotplugEnabled = isCPUMemoryHotPlugEnabled(vm);
const { sockets = 1, threads = 1, cores = 1 } = vm.spec.template.spec.domain.cpu || {};
const cpu = sockets * threads * cores;
const { sockets = 1, threads = 1, cores = null } = vm.spec.template.spec.domain.cpu || {};
const cpu = cores === null ? null : sockets * threads * cores;
if (isHotplugEnabled) {
return {