1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #-: Fix incorrect handling (#2778)

This commit is contained in:
vichansson 2023-10-18 17:23:11 +03:00 committed by GitHub
parent f3c9a8f5bf
commit 3d7c4f4b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,7 +97,8 @@ export const getAllocatedInfo = (host) => {
* @returns {Array} List of hugepages sizes from resource
*/
export const getHugepageSizes = (host) => {
const numaNodes = [host?.HOST_SHARE?.NUMA_NODES?.NODE ?? []].flat()
const wrapHost = Array.isArray(host) ? host : [host]
const numaNodes = [wrapHost?.HOST_SHARE?.NUMA_NODES?.NODE ?? []].flat()
return numaNodes
.filter((node) => node?.NODE_ID && node?.HUGEPAGE)
@ -137,10 +138,11 @@ export const getKvmCpuModels = (hosts = []) => {
* @returns {Array} List of KVM Machines from the pool
*/
export const getKvmCpuFeatures = (hosts = []) => {
const machineTypes = hosts
.filter((host) => host?.TEMPLATE?.HYPERVISOR === HYPERVISORS.kvm)
.map((host) => host.TEMPLATE?.KVM_CPU_FEATURES.split(','))
.flat()
const wrapHosts = Array.isArray(hosts) ? hosts : [hosts]
const machineTypes = wrapHosts
?.filter((host) => host?.TEMPLATE?.HYPERVISOR === HYPERVISORS?.kvm)
?.map((host) => host?.TEMPLATE?.KVM_CPU_FEATURES?.split(',') ?? [])
?.flat()
// Removes the repeated
return [...new Set(machineTypes)]