fix(striker-ui): auto-suggest IPMI IP based on BCN in create manifest

main
Tsu-ba-me 1 year ago
parent 997c501d6a
commit ed58c57835
  1. 16
      striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx

@ -80,11 +80,13 @@ const AnHostConfigInputGroup = <M extends MapToInputTestID>({
fences: previousFenceList = {}, fences: previousFenceList = {},
hostNumber, hostNumber,
hostType, hostType,
ipmiIp, ipmiIp: previousIpmiIp,
networks: previousNetworkList = {}, networks: previousNetworkList = {},
upses: previousUpsList = {}, upses: previousUpsList = {},
}: ManifestHost = previousHostArgs; }: ManifestHost = previousHostArgs;
let ipmiIp = previousIpmiIp;
const fences = knownFenceListValues.reduce<ManifestHostFenceList>( const fences = knownFenceListValues.reduce<ManifestHostFenceList>(
(fenceList, { fenceName }) => { (fenceList, { fenceName }) => {
const { [fenceName]: { fencePort = '' } = {} } = const { [fenceName]: { fencePort = '' } = {} } =
@ -96,6 +98,7 @@ const AnHostConfigInputGroup = <M extends MapToInputTestID>({
}, },
{}, {},
); );
const networks = networkListEntries.reduce<ManifestHostNetworkList>( const networks = networkListEntries.reduce<ManifestHostNetworkList>(
( (
networkList, networkList,
@ -116,6 +119,16 @@ const AnHostConfigInputGroup = <M extends MapToInputTestID>({
}); });
} }
if (!ipmiIp && networkType === 'bcn' && networkNumber === 1) {
ipmiIp = guessHostIpOnNetwork({
anSeq: anSequence,
minIp: networkMinIp,
offset3: 11,
subnetMask: networkSubnetMask,
subSeq: hostNumber,
});
}
networkList[networkId] = { networkList[networkId] = {
networkIp, networkIp,
networkNumber, networkNumber,
@ -126,6 +139,7 @@ const AnHostConfigInputGroup = <M extends MapToInputTestID>({
}, },
{}, {},
); );
const upses = knownUpsListValues.reduce<ManifestHostUpsList>( const upses = knownUpsListValues.reduce<ManifestHostUpsList>(
(upsList, { upsName }) => { (upsList, { upsName }) => {
const { [upsName]: { isUsed = true } = {} } = previousUpsList; const { [upsName]: { isUsed = true } = {} } = previousUpsList;

Loading…
Cancel
Save