-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable native support for Failover Cluster NC (#287)
This pull request includes changes to enhance the functionality of the SDN Diagnostics module, particularly for Service Fabric and Failover Cluster configurations. The most significant changes are the addition of new commands, modifications to existing commands, and the introduction of new modules for different cluster configurations. Additions and modifications to commands: * [`src/SdnDiagnostics.Helper.psm1`](diffhunk://#diff-c298d582fd8e12a03b0e7b1dc9c562c58cc978d2e9044757d73f1a00f840c6b5L72-R78): Removed 'Test-SdnKnownIssue' and added new commands to the `$networkControllerParamCommands` array. * [`src/modules/SdnDiag.Common/private/Export-RegistryKeyConfigDetails.ps1`](diffhunk://#diff-2bc0c28b695611157ad4de8a232e841315642b136775d2bf32f8f74acd670b19L18-R21): Changed the logging level and improved the registry key path enumeration. Added a security measure to redact the AESKey for cluster network controller registry keys. [[1]](diffhunk://#diff-2bc0c28b695611157ad4de8a232e841315642b136775d2bf32f8f74acd670b19L18-R21) [[2]](diffhunk://#diff-2bc0c28b695611157ad4de8a232e841315642b136775d2bf32f8f74acd670b19R30-R34) * [`src/modules/SdnDiag.Common/private/Get-CommonConfigState.ps1`](diffhunk://#diff-835b08b8e1c0bce0a59f0c589152e1a7e9a6e24bfb443ad00669c63f3924d881L58-R58): Modified the `Get-NetAdapterAdvancedProperty` command to handle errors according to the `$ErrorActionPreference` variable. * [`src/modules/SdnDiag.Common/public/Repair-SdnDiagnosticsScheduledTask.ps1`](diffhunk://#diff-a69fd2713e1d24fef7f12349ac339925ef11a4e9a80269f3c5abe39f02632788R10-R18): Added a switch statement to handle different `ClusterConfigType` values. * [`src/modules/SdnDiag.Health/private/Test-NcUrlNameResolution.ps1`](diffhunk://#diff-53875d037e2095362d1f4d2ebce09ba56c67e194efbb31a4155b7fc6a28b3a43L30-R32): Changed the `Get-SdnNetworkController` command to `Get-SdnNetworkControllerSF`. * [`src/modules/SdnDiag.Health/public/Debug-SdnFabricInfrastructure.ps1`](diffhunk://#diff-324c08d6d20cb9d37d1a5b9756303f40024eb3d5c4008d8b210c8e7295ea1151R47-R50): Added a condition to throw an exception if the `ClusterConfigType` is not 'ServiceFabric'. New modules for different cluster configurations: * [`src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.Config.psd1`](diffhunk://#diff-656db7b7942a5c8bebb655094f4e112758a27267910335e9c06d6575c280b295R1-R70): Created a new configuration file for the NetworkControllerFC module. * [`src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.psm1`](diffhunk://#diff-141e8a7963d2aa6f51b5851094e11e0287b3c8793904094c9840ed25816c2a2aR1-R13): Created a new module file for the NetworkControllerFC module. * [`src/modules/SdnDiag.NetworkController.FC/private/Get-NetworkControllerFCConfigState.ps1`](diffhunk://#diff-a101ed5e85ead9ca9371fad33a94311da92c52d3812fd2f1b23fbb6ca7af6ee9R1-R43): Created a new function to output a set of configuration state files for the network controller role. * [`src/modules/SdnDiag.NetworkController.FC/private/Get-SdnClusterName.ps1`](diffhunk://#diff-5c8dc2849956c598e30fbe1008e22689493be806df2cf5f403958cdb2e86d99cR1-R27): Created a new function to get the cluster name. * [`src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFC.ps1`](diffhunk://#diff-a2156b35c839b8eaf62a5ada1c1a34d7bd04c2fdf44f317d4231ef9162ec610fR1-R45): Created a new function to get network controller application settings. * [`src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFCClusterInfo.ps1`](diffhunk://#diff-45acf2c028d64150f072773cb338f9ba97cec5a221c3679a15546e47281ce796R1-R63): Created a new function to gather the Network Controller cluster wide info. * [`src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFCNode.ps1`](diffhunk://#diff-07e5e85f95431cfe04c99dc1bc32352f6850f798d97dcac0cb582d4d193b47e0R1-R85): Created a new function to return a list of servers from network controller. * [`src/modules/SdnDiag.NetworkController.SF/SdnDiag.NetworkController.SF.Config.psd1`](diffhunk://#diff-fcf4a3d34ad27665c7140f0762b97036cdc06820518e3ef8d5cf04ea80279c22R1-R34): Created a new configuration file for the NetworkControllerSF module. File additions: * [`src/SdnDiagnostics.psd1`](diffhunk://#diff-17aaaa968cc894449c79b449c228b28d8a8990bde4000e59bcf24d8189671ee1R38-R39): Added new module files to the list of files.
- Loading branch information
Showing
76 changed files
with
2,035 additions
and
1,187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
477 changes: 0 additions & 477 deletions
477
src/modules/SdnDiag.Common/public/Start-SdnDataCollection.ps1
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.Config.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
@{ | ||
Name = "NetworkControllerFC" | ||
WindowsFeature = @( | ||
"NetworkController" | ||
) | ||
RequiredModules = @( | ||
"NetworkController" | ||
) | ||
Properties = @{ | ||
CommonPaths = @{} | ||
EventLogProviders = @( | ||
'Microsoft-Windows-FailoverClustering*', | ||
'Microsoft-Windows-FailoverClustering-Manager*', | ||
'NetworkControllerFc' | ||
) | ||
RegKeyPaths = @( | ||
'HKLM:\Cluster\NetworkController' | ||
) | ||
Services = @{ | ||
SDNApiService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNApiService" | ||
} | ||
} | ||
SDNControllerService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNControllerService" | ||
} | ||
} | ||
SDNFirewallService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNFirewallService" | ||
} | ||
} | ||
SDNFnmService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNFnmService" | ||
} | ||
} | ||
SDNGatewayManager = @{ | ||
Properties = @{ | ||
DisplayName = "SDNGatewayManager" | ||
} | ||
} | ||
SDNHelperService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNHelperService" | ||
} | ||
} | ||
SDNServiceInsertion = @{ | ||
Properties = @{ | ||
DisplayName = "SDNServiceInsertion" | ||
} | ||
} | ||
SDNSlbManagerService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNSlbManagerService" | ||
} | ||
} | ||
SDNVSwitchService = @{ | ||
Properties = @{ | ||
DisplayName = "SDNVSwitchService" | ||
} | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
Import-Module $PSScriptRoot\..\SdnDiag.Common\SdnDiag.Common.psm1 | ||
Import-Module $PSScriptRoot\..\SdnDiag.Utilities\SdnDiag.Utilities.psm1 | ||
|
||
# create local variable to store configuration data | ||
$configurationData = Import-PowerShellDataFile -Path $PSScriptRoot\SdnDiag.NetworkController.FC.Config.psd1 | ||
New-Variable -Name 'SdnDiagnostics_NC_FC' -Scope 'Script' -Force -Value @{ | ||
Config = $configurationData | ||
} | ||
|
||
##### FUNCTIONS AUTO-POPULATED BELOW THIS LINE DURING BUILD ##### |
43 changes: 43 additions & 0 deletions
43
src/modules/SdnDiag.NetworkController.FC/private/Get-NetworkControllerFCConfigState.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
function Get-NetworkControllerFCConfigState { | ||
<# | ||
.SYNOPSIS | ||
Outputs a set of configuration state files for the network controller role. | ||
.PARAMETER OutputDirectory | ||
Specifies a specific path and folder in which to save the files. | ||
.EXAMPLE | ||
PS> Get-NetworkControllerFCConfigState -OutputDirectory "C:\Temp\CSS_SDN" | ||
#> | ||
|
||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[System.IO.FileInfo]$OutputDirectory | ||
) | ||
|
||
$currentErrorActionPreference = $ErrorActionPreference | ||
$ProgressPreference = 'SilentlyContinue' | ||
$ErrorActionPreference = 'SilentlyContinue' | ||
|
||
try { | ||
$config = Get-SdnModuleConfiguration -Role 'NetworkController_FC' | ||
[string]$outDir = Join-Path -Path $OutputDirectory.FullName -ChildPath "ConfigState" | ||
[string]$regDir = Join-Path -Path $OutputDirectory.FullName -ChildPath "Registry" | ||
|
||
if (-NOT (Initialize-DataCollection -Role $config.Name -FilePath $outDir -MinimumMB 10)) { | ||
"Unable to initialize environment for data collection for {0}" -f $config.Name | Trace-Output -Level:Error | ||
return | ||
} | ||
|
||
"Collect configuration state details for role {0}" -f $config.Name | Trace-Output | ||
|
||
# collect registry configuration information | ||
Export-RegistryKeyConfigDetails -Path $config.properties.regKeyPaths -OutputDirectory $regDir | ||
} | ||
catch { | ||
$_ | Trace-Exception | ||
$_ | Write-Error | ||
} | ||
|
||
$ProgressPreference = 'Continue' | ||
$ErrorActionPreference = $currentErrorActionPreference | ||
} |
27 changes: 27 additions & 0 deletions
27
src/modules/SdnDiag.NetworkController.FC/private/Get-SdnClusterName.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function Get-SdnClusterName { | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[System.String]$NetworkController, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[System.Management.Automation.PSCredential] | ||
[System.Management.Automation.Credential()] | ||
$Credential = [System.Management.Automation.PSCredential]::Empty | ||
) | ||
|
||
if (Test-ComputerNameIsLocal -ComputerName $NetworkController) { | ||
$clusterName = Get-Cluster | Select-Object -ExpandProperty Name | ||
} | ||
else { | ||
if ($null -ieq $Credential -or $Credential -eq [System.Management.Automation.PSCredential]::Empty) { | ||
$clusterName = Invoke-PSRemoteCommand -ComputerName $NetworkController -ScriptBlock { Get-Cluster } | Select-Object -ExpandProperty Name | ||
} | ||
else { | ||
$clusterName = Invoke-PSRemoteCommand -ComputerName $NetworkController -ScriptBlock { Get-Cluster } -Credential $Credential | Select-Object -ExpandProperty Name | ||
} | ||
} | ||
|
||
"Cluster Name: $clusterName" | Trace-Output -Level:Verbose | ||
return $clusterName | ||
} |
45 changes: 45 additions & 0 deletions
45
src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFC.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
function Get-SdnNetworkControllerFC { | ||
<# | ||
.SYNOPSIS | ||
Gets network controller application settings from the network controller node leveraging Failover Cluster. | ||
.PARAMETER NetworkController | ||
Specifies the name or IP address of the network controller node on which this cmdlet operates. The parameter is optional if running on network controller node. | ||
.PARAMETER Credential | ||
Specifies a user account that has permission to perform this action. The default is the current user. | ||
.EXAMPLE | ||
PS> Get-SdnNetworkControllerFC | ||
.EXAMPLE | ||
PS> Get-SdnNetworkControllerFC -NetworkController 'NC01' -Credential (Get-Credential) | ||
#> | ||
|
||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $false)] | ||
[System.String]$NetworkController = $env:COMPUTERNAME, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[System.Management.Automation.PSCredential] | ||
[System.Management.Automation.Credential()] | ||
$Credential = [System.Management.Automation.PSCredential]::Empty | ||
) | ||
|
||
$networkControllerSB = { | ||
Get-NetworkControllerOnFailoverCluster | ||
} | ||
|
||
try { | ||
if (Test-ComputerNameIsLocal -ComputerName $NetworkController) { | ||
Confirm-IsNetworkController | ||
$result = Invoke-Command -ScriptBlock $networkControllerSB | ||
} | ||
else { | ||
$result = Invoke-PSRemoteCommand -ComputerName $NetworkController -ScriptBlock $networkControllerSB -Credential $Credential | ||
} | ||
|
||
return $result | ||
} | ||
catch { | ||
$_ | Trace-Exception | ||
$_ | Write-Error | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFCClusterInfo.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
function Get-SdnNetworkControllerFCClusterInfo { | ||
<# | ||
.SYNOPSIS | ||
Gather the Network Controller cluster wide info from one of the Network Controller | ||
.PARAMETER NetworkController | ||
Specifies the name of the network controller node on which this cmdlet operates. | ||
.PARAMETER Credential | ||
Specifies a user account that has permission to perform this action. The default is the current user. | ||
.PARAMETER OutputDirectory | ||
Directory location to save results. It will create a new sub-folder called NetworkControllerClusterInfo_FC that the files will be saved to | ||
.EXAMPLE | ||
PS> Get-SdnNetworkControllerFCClusterInfo | ||
.EXAMPLE | ||
PS> Get-SdnNetworkControllerFCClusterInfo -NetworkController 'NC01' -Credential (Get-Credential) | ||
#> | ||
|
||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[System.String]$NetworkController, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[System.Management.Automation.PSCredential] | ||
[System.Management.Automation.Credential()] | ||
$Credential = [System.Management.Automation.PSCredential]::Empty, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[System.IO.FileInfo]$OutputDirectory | ||
) | ||
|
||
$currentErrorActionPreference = $ErrorActionPreference | ||
$ProgressPreference = 'SilentlyContinue' | ||
$ErrorActionPreference = 'Ignore' | ||
|
||
try { | ||
$outputDir = Join-Path -Path $OutputDirectory.FullName -ChildPath 'NetworkControllerClusterInfo_FC' | ||
if (!(Test-Path -Path $outputDir -PathType Container)) { | ||
$null = New-Item -Path $outputDir -ItemType Directory -Force | ||
} | ||
|
||
$clusterName = $Global:SdnDiagnostics.EnvironmentInfo.FailoverClusterConfig.Name | ||
if ($null -ieq $clusterName) { | ||
$clusterName = Get-SdnClusterName -NetworkController $NetworkController -Credential $Credential -ErrorAction Stop | ||
} | ||
|
||
Get-Cluster -Name $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-Cluster' -FileType json | ||
Get-ClusterFaultDomain -CimSession $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterFaultDomain' -FileType json | ||
Get-ClusterNode -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterNode' -FileType json | ||
Get-ClusterGroup -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterGroup' -FileType json | ||
Get-ClusterNetwork -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterNetwork' -FileType json | ||
Get-ClusterNetworkInterface -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterNetworkInterface' -FileType json | ||
Get-ClusterResource -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterResource' -FileType json | ||
Get-ClusterResourceType -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterResourceType' -FileType txt -Format Table | ||
Get-ClusterSharedVolume -Cluster $clusterName | Export-ObjectToFile -FilePath $outputDir -Name 'Get-ClusterSharedVolume' -FileType json | ||
} | ||
catch { | ||
$_ | Trace-Exception | ||
$_ | Write-Error | ||
} | ||
|
||
$ProgressPreference = 'Continue' | ||
$ErrorActionPreference = $currentErrorActionPreference | ||
} |
Oops, something went wrong.