-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSwitchless_Node_Storage_IP_config.ps1
More file actions
70 lines (68 loc) · 3.43 KB
/
Switchless_Node_Storage_IP_config.ps1
File metadata and controls
70 lines (68 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#Configure node IP addresses for switchless
#Supports up to Four-node, dual-link full mesh
#Version 1.3
param
(
[Parameter(Mandatory = $true)]
[Int]
$NodeID
)
$SwitchlessNodeID = ${NodeID} #Update to the current Node number being configured.
Do{$SwitchlessClusterNodes=Read-Host "Number of Nodes"} until ($SwitchlessClusterNodes -match '^[1-4]$')
##############################################
#Setup Storage Network for Switchless Topology
##############################################
$StorageSubnet = '172.16.0.0'
$SingleStorageIPAddress =
@('172.16.12','172.16.13','172.16.14','172.16.23','172.16.24','172.16.34')
$DualStorageIPAddress =
@('172.16.21','172.16.31','172.16.41','172.16.32','172.16.42','172.16.43')
$StorageAddressPrefix = 29
$supportedAdapters = @("NVidia", "Mellanox", "QLogic", "E810")
$StorageAdapter = Get-NetAdapter | Where InterfaceDescription -imatch ($supportedAdapters -Join "|") | ? Status -like Up | sort Name | Get-NetAdapterHardwareInfo | ? Slot -GE 1 | Sort-Object Slot,Function
if ( $StorageAdapter ) {
Write-Output 'These adapters will be used for storage (dependent on cluster size):'
Write-Output $($StorageAdapter | Format-Table Name,Description,Slot,Function)
Pause
} else {
throw 'No RDMA Storage Adapters found!'
}
$SingleStorageIPAddress = $SingleStorageIPAddress | ForEach-Object { if
(($_).Substring(($_).Length -2) -match $SwitchlessNodeID) { $_ } }
$DualStorageIPAddress = $DualStorageIPAddress | ForEach-Object { if
(($_).Substring(($_).Length -2) -match $SwitchlessNodeID) { $_ } }
$SingleStorageIPAddress = $SingleStorageIPAddress | ForEach-Object { $_ + '.' +
$SwitchlessNodeID }
$DualStorageIPAddress = $DualStorageIPAddress | ForEach-Object { $_ + '.' +
$SwitchlessNodeID }
$StorageSubnet = $StorageSubnet.Split('.')[0] + '.' + $StorageSubnet.Split('.')[1]
$SingleStorageIPAddress = $SingleStorageIPAddress | ForEach-Object {
$_.Replace('172.16',$StorageSubnet) }
$DualStorageIPAddress = $DualStorageIPAddress | ForEach-Object { $_.Replace('172.16',
$StorageSubnet) }
Write-Output "Storage IP Addresses: $(($SingleStorageIPAddress)[0..
($SwitchlessClusterNodes -2)]) ($(($DualStorageIPAddress )[0..($SwitchlessClusterNodes -2)]))"
Pause
##
#################################
## Assign IPs for Storage Network
#################################
if ( ($SwitchlessClusterNodes -1) -le $StorageAdapter.Count ) {
Write-Output 'Configuring Single-Link Full Mesh Switchless Networks'
for ($i=0;$i -lt ($SwitchlessClusterNodes -1);$i++) {
Write-Output "Adapter: $(($StorageAdapter)[$i].Description) Name: $(($StorageAdapter)[$i].Name) IP: $($SingleStorageIPAddress[$i])"
$null = New-NetIPAddress -InterfaceAlias ($StorageAdapter)[$i].Name -IPAddress $SingleStorageIPAddress[$i] -PrefixLength $StorageAddressPrefix -Verbose
}
if ( ($SwitchlessClusterNodes -1)*2 -le $StorageAdapter.Count ) {
Write-Output 'Configuring Dual-Link Full Mesh Switchless Networks'
$n = $SwitchlessClusterNodes -1
for ($i=0;$i -lt ($SwitchlessClusterNodes -1);$i++) {
Write-Output "Adapter: $(($StorageAdapter)[$n].Description) Name: $(($StorageAdapter)[$n].Name) IP: $($DualStorageIPAddress[$i])"
$null = New-NetIPAddress -InterfaceAlias ($StorageAdapter)[$n].Name -IPAddress $DualStorageIPAddress[$i] -PrefixLength $StorageAddressPrefix -Verbose
$n++
}
}
} else {
throw "Not enough Storage NICs available based on cluster size of
$SwitchlessClusterNodes"
}