Skip to content

Commit

Permalink
B #-: Fix incorrect handling (#2778)
Browse files Browse the repository at this point in the history
  • Loading branch information
vichansson authored Oct 18, 2023
1 parent f3c9a8f commit 3d7c4f4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/fireedge/src/client/models/Host.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit 3d7c4f4

Please sign in to comment.