-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path2_HCI_Switchless_NetATC_Cluster_Config.ps1
More file actions
96 lines (78 loc) · 4.7 KB
/
2_HCI_Switchless_NetATC_Cluster_Config.ps1
File metadata and controls
96 lines (78 loc) · 4.7 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#Configure Switchless HCI Cluster
#Version 1.2
#Variables
#Change this to "Full" for Fully-Converged networking
$FullyNone="None"
#Managment Nics
$MgmtNic1 = "Integrated NIC 1 Port 1-1"
$MgmtNic2 = "Integrated NIC 1 Port 2-1"
$mgmt_compute_nics = @("$MgmtNic1","$MgmtNic2")
$MgmtVlan=0
#Storage Nics
$S1Nic="SLOT 2 Port 1"
$S2Nic="SLOT 2 Port 2"
$storage_nics=@("$S1Nic","$S2Nic")
$S1vlan="700"
$storage_vlans=@("$S1vlan")
#Cluster Info
$ClusterName="AzHCICluster"
$ClusterIP="192.168.4.124"
$ClusterNodes='AzHCI02','AzHCI03','AzHCI04'
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This section below is for creating and configuring the cluster
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check if cluster exisits
IF(-not(Get-Cluster -ErrorAction SilentlyContinue)){
#Test cluster nodes before creating the cluster
Test-Cluster -Node $ClusterNodes -Include 'Storage Spaces Direct', 'Inventory', 'Network', 'System Configuration'
#NOTE: Make sure all errors are resolved before proceeding
Pause
#Create cluster
New-Cluster -Name $ClusterName -Node $ClusterNodes -StaticAddress $ClusterIP
}
# Exclude iDRAC NIC from Cluster
$NDISDesc=(Get-NetAdapter | Where-Object{$_.InterfaceDescription -imatch "NDIS"}).InterfaceDescription
IF(Test-Path -Path HKLM:\system\currentcontrolset\services\clussvc\parameters){
New-ItemProperty -Path HKLM:\system\currentcontrolset\services\clussvc\parameters -Name ExcludeAdaptersByDescription -Value $NDISDesc -Force}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Setup NetworkATC on the Cluster
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Setup QOS Overrides Intnet
$QoSOverride = New-NetIntentQoSPolicyOverrides
$QoSOverride.BandwidthPercentage_Cluster = 2
$QoSOverride.PriorityValue8021Action_Cluster = 5
# RDMA/JumboPacket Override for SMB & Management NIC
$MgmtAdapterPropertyOverrides = New-NetIntentAdapterPropertyOverrides
$MgmtAdapterPropertyOverrides.NetworkDirect = 0
$MgmtAdapterPropertyOverrides.JumboPacket = 1514
$StorAdapterPropertyOverrides = New-NetIntentAdapterPropertyOverrides
$StorAdapterPropertyOverrides.JumboPacket = 9014
If ((Get-NetAdapter -Name $storage_nics[0] | Select InterfaceDescription) -inotMatch "Mellanox") {
$StorAdapterPropertyOverrides.NetworkDirectTechnology = 1
} else {$StorAdapterPropertyOverrides.NetworkDirectTechnology = 4 }
# Storage Overrides if you do not want Network ATC to assign SMB IPs automatically.
$StorageOverride = New-NetIntentStorageOverrides
$StorageOverride.EnableAutomaticIPGeneration = $false
# Create Management and Compute Intent
IF(Get-AllNetIntents | ?{$_.keys.value -inotmatch "management_compute"}){
Add-NetIntent -Name Management_Compute -Management -Compute -AdapterName $mgmt_compute_nics -ManagementVlan $MgmtVlan -AdapterPropertyOverrides $MgmtAdapterPropertyOverrides}
# Create Storage Intent
IF(Get-AllNetIntents | ?{$_.keys.value -inotmatch "Storage"}){
add-NetIntent -Name Storage -Storage -AdapterName $storage_nics -StorageVLANs $storage_vlans -QosPolicyOverrides $QoSOverride -AdapterPropertyOverrides $StorAdapterPropertyOverrides -StorageOverrides $Storageoverride}
# Setup the Cluster Overrides
$clusterOverride = New-NetIntentGlobalClusterOverrides
$clusterOverride.EnableVirtualMachineMigrationPerformanceSelection = $false
$clusterOverride.VirtualMachineMigrationPerformanceOption = "SMB"
$clusterOverride.MaximumVirtualMachineMigrations = 2
# Create Cluster Intent
IF(Get-AllNetIntents -GlobalOverrides | Select-Object -ExpandProperty ClusterOverride | Select-Object VirtualMachineMigrationPerformanceOption){
Set-NetIntent -GlobalClusterOverrides $clusterOverride}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Setup Storage Spaces Direct (S2D)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IF($FullyNone -imatch "None"){
IF((Get-ClusterS2D).State){
#Enable S2d
Enable-Clusters2d
}
}