From ed58c57835942e811921904e28da383dc0492c34 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 20 Dec 2023 16:28:14 -0500 Subject: [PATCH] fix(striker-ui): auto-suggest IPMI IP based on BCN in create manifest --- .../ManageManifest/AnHostConfigInputGroup.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx b/striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx index d9a05037..89a0f53d 100644 --- a/striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx +++ b/striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx @@ -80,11 +80,13 @@ const AnHostConfigInputGroup = ({ fences: previousFenceList = {}, hostNumber, hostType, - ipmiIp, + ipmiIp: previousIpmiIp, networks: previousNetworkList = {}, upses: previousUpsList = {}, }: ManifestHost = previousHostArgs; + let ipmiIp = previousIpmiIp; + const fences = knownFenceListValues.reduce( (fenceList, { fenceName }) => { const { [fenceName]: { fencePort = '' } = {} } = @@ -96,6 +98,7 @@ const AnHostConfigInputGroup = ({ }, {}, ); + const networks = networkListEntries.reduce( ( networkList, @@ -116,6 +119,16 @@ const AnHostConfigInputGroup = ({ }); } + if (!ipmiIp && networkType === 'bcn' && networkNumber === 1) { + ipmiIp = guessHostIpOnNetwork({ + anSeq: anSequence, + minIp: networkMinIp, + offset3: 11, + subnetMask: networkSubnetMask, + subSeq: hostNumber, + }); + } + networkList[networkId] = { networkIp, networkNumber, @@ -126,6 +139,7 @@ const AnHostConfigInputGroup = ({ }, {}, ); + const upses = knownUpsListValues.reduce( (upsList, { upsName }) => { const { [upsName]: { isUsed = true } = {} } = previousUpsList;