-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
bugThe issue is a bug.The issue is a bug.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.
Description
Problem description
When running the Cluster resource twice, it errors out that the node is already joined to a cluster. Given that PowerShell DSC is supposed to be idempotent, it should have instead succeeded since it was already in the proper cluster.
DSC is a platform that provides declarative and idempotent (repeatable) deployment, configuration and conformance.
https://learn.microsoft.com/en-us/powershell/dsc/overview/dscforengineers?view=dsc-1.1
Verbose logs
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer CM-SQL-TEST-A01 with user sid [redacted].
VERBOSE: An LCM method call arrived from computer CM-SQL-TEST-A01 with user sid [redacted].
WARNING: There is no operation running currently. Stop will return without any action.
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ Start Set ]
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ End Set ]
VERBOSE: An LCM method call arrived from computer CM-SQL-TEST-A01 with user sid [redacted].
The current configuration was cancelled.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ Start Set ]
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ Start Resource ] [[Cluster]CreateCluster]
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ Start Test ] [[Cluster]CreateCluster]
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Checking if cluster cm-sql-test-cluster is present.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_ComputerSystem'.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Operation 'Enumerate CimInstances' complete.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Enumerating clusters in domain prod.company.com.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Cluster cm-sql-test-cluster is present.
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ End Test ] [[Cluster]CreateCluster] in 1.8130 seconds.
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ Start Set ] [[Cluster]CreateCluster]
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Checking if cluster cm-sql-test-cluster is present.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_ComputerSystem'.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Operation 'Enumerate CimInstances' complete.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Enumerating clusters in domain prod.company.com.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] Cluster cm-sql-test-cluster is NOT present.
VERBOSE: [CM-SQL-TEST-A01]: [[Cluster]CreateCluster] at MS.Internal.ServerClusters.InputValidator.ValidateComputer(String computerName, ValidateComputerOptions options, Cluster cluster)
at MS.Internal.ServerClusters.Configuration.NodeManagementBase.AddNode(String nodeName)
at Microsoft.FailoverClusters.PowerShell.NewClusterCommand.<>c__DisplayClass33_0.<WrappedProcessRecord>b__0(String nodeName)
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ End Set ] [[Cluster]CreateCluster] in 5.9060 seconds.
PowerShell DSC resource DSC_Cluster failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop:
There was an error adding node 'CM-SQL-TEST-A01' to the cluster
The computer 'cm-sql-test-a01.prod.company.com' is joined to a cluster.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : cm-sql-test-a01
VERBOSE: [CM-SQL-TEST-A01]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : cm-sql-test-a01
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 8.031 seconds
DSC configuration
Configuration CreateTestCluster {
param (
[string] $ClusterName,
[string] $ClusterIP
)
Import-DscResource -ModuleName FailoverClusterDsc
Node 'localhost' {
Cluster CreateCluster {
Name = $ClusterName
StaticIPAddress = $ClusterIP
}
}
}Suggested solution
Test if the node is already in a cluster and if it is, check if it is the proper cluster. If its the proper cluster, return success. If its not, either throw an error or remove it from that cluster and join it to the proper one.
Operating system the target node is running
OsName : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}
PowerShell version and build the target node is running
Name Value
---- -----
PSVersion 5.1.20348.2849
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2849
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
FailoverClusterDsc version
Name Version Path
---- ------- ----
FailoverClusterDsc 2.2.0 C:\Program Files\WindowsPowerShell\Modules\FailoverClusterDsc\2.2.0\FailoverClusterDsc.psd1
Metadata
Metadata
Assignees
Labels
bugThe issue is a bug.The issue is a bug.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.