Giter VIP home page Giter VIP logo

failoverclusterdsc's Introduction

FailoverClusterDsc

This module contains DSC resources for the management and configuration of Windows Server Failover Cluster.

Build Status Azure DevOps coverage (branch) codecov Azure DevOps tests PowerShell Gallery (with prereleases) PowerShell Gallery

Code of Conduct

This project has adopted this Code of Conduct.

Releases

For each merge to the branch main a preview release will be deployed to PowerShell Gallery. Periodically a release version tag will be pushed which will deploy a full release to PowerShell Gallery.

Contributing

Please check out common DSC Community contributing guidelines.

Change log

A full list of changes in each version can be found in the change log.

Documentation

The documentation can be found in the FailoverClusterDsc Wiki. The DSC resources schema files is used to automatically update the documentation on each PR merge.

Examples

You can review the Examples directory in the FailoverClusterDsc module for some general use scenarios for all of the resources that are in the module.

The resource examples are also available in the FailoverClusterDsc Wiki.

failoverclusterdsc's People

Contributors

aultt avatar bgelens avatar blankf avatar claudiospizzi avatar codykonior avatar ddenbraver avatar dscbot avatar eshaparmar avatar flouwers avatar gigi81 avatar indhukrishna avatar jambar42 avatar jasonmorgan avatar joeyaiello avatar johlju avatar jrdbarnes avatar karolkaczmarek avatar kwirkykat avatar markgossa avatar mgreenegit avatar minkukel avatar mnewswanger avatar nickgw avatar oxhobbs avatar powershellteam avatar tragiccode avatar travisez13 avatar wasabii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

failoverclusterdsc's Issues

xCluster: Test-TargetResource never throws an error if domain name can't be evaluated

Details of the scenario you tried and the problem that is occurring:
The function Test-TargetResource never throws an error if domain name can't be evaluated. Instead it will write a verbose message and return $false indicating that the Set-TargetResource function should run, which in this case will result in an error.
I suggest that the Test-TargetResource throws an error when domain cannot be evaluated.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

Multi-subnet cluster creation hangs indefinitely

xCluster hangs apparently indefinitely when we pass a comma separated string of static cluster addresses.

This makes sense since the New-Cluster cmdlet admonishes you by throwing an exception when you pass multiple static IP addresses in different subnets and do not also pass at least one node in each subnet.

New-Cluster : Static address 'a.b.c.d' was not found on any cluster network.

Since xCluster does not support passing a node list like New-Cluster (it just uses the current node the resource is executing on) we're stuck passing a single corresponding static cluster address. That works for the first node in the cluster creating a single node cluster BUT

Subsequent nodes use Add-ClusterNode which does not support passing a static cluster address.

We've got to either

  1. change the xCluster interface to support node lists or
  2. or add a whole bunch of network logic to see if the any passed static cluster address needs to be retroactively added to the cluster to prior adding the node if it's on a different subnet

This code will add additional static cluster addresses as needed:

$res = Get-ClusterResource "Cluster IP Address"
$param1 = New-Object Microsoft.FailoverClusters.PowerShell.ClusterParameter $res,Address,a.b.c.d
$param2 = New-Object Microsoft.FailoverClusters.PowerShell.ClusterParameter $res,SubnetMask,a.b.c.d
$params = $param1,$param2
$params | Set-ClusterParameter

Thoughts?

Support for Multi-site clusters

Request support for multi-site clusters. I don’t think it’s possible to create a multi-site cluster with the existing resources. The IP Address property was implemented as a single string and not a collection, and there is no option to add nodes with the resource as-is. In order to run the New-Cluster command and do this you’d have to give a hostname that has access to each of the subnets you list in the IP param.

e.g. New-Cluster -Name clustername -Node hosta, hostb -StaticIPAddress subneta, subnetb.

README.md: Parameters should list their class (data type) and type qualifier

I suggest to add all parameters like this.

  • [String] ClusterGroup (Key): Name of the cluster group.
  • [String] ClusterName (Key): Name of the cluster.
  • [String[]] Nodes (Required): The nodes to set as owners.
  • [String[]] ClusterResources (Write): The resources to set preferred owner on.
  • [String[]] Ensure (Write): If the preferred owners should be present or absent. { Present | Absent }

ClusterPreferredOwner: The resource is moving cluster group in Set-TargetResource

When setting preferred owner on a cluster group or a cluster resource it moves the cluster group to the first node. In a production environment this could be a bad thing.

See line 98-99

        Write-Verbose -Message "Moving Cluster Group $ClusterGroup to node $($Nodes[0])"
        $null = (Get-ClusterGroup -cluster $ClusterName) | Where-Object {$_.name -like $ClusterGroup} | Move-ClusterGroup -Node $Nodes[0]

Why is it moving the cluster group? And if this is a must, then I think this should be handled differently.

Updates for supporting clusters in Azure

From what I can see, this module would need a few tweaks in order to work properly in the context of creating failover clusters in Azure. For example, when creating the cluster you have to assign a link-local IP address as the cluster IP, then bring it back online. I'd love to contribute towards this but thought I should inquire as to the best method? For example, should these be created as separate resources in the same module (xClusterAzure?), or even a fork of the entire repository (xFailoverClusterAzure?)?

Cannot add type. The type name 'Lib.Impersonation.ImpersonationLib' already exists.

Hello,

I have discovered an odd issue than try to deploy failover cluster using the latest version.

It shows me an error in the code:
Cannot add type. The type name 'Lib.Impersonation.ImpersonationLib' already exists.

Any suggestions how to solve this issue?

I do use other DSC resource modules in the deployment script: cSqlPs,xFailoverCluster,xNetworking,xSmbShare,cStoragePool,PSDesiredStateConfiguration

It does conflict if DSC resource MSFT_xSqlInstanceTcpPort is bein used, because they are using the same function:
function Get-ImpersonatetLib
{
if ($script:ImpersonateLib)
{
return $script:ImpersonateLib
}

$sig = @'

[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);

[DllImport("kernel32.dll")]
public static extern Boolean CloseHandle(IntPtr hObject);
'@
$script:ImpersonateLib = Add-Type -PassThru -Namespace 'Lib.Impersonation' -Name ImpersonationLib -MemberDefinition $sig

return $script:ImpersonateLib

}


Any suggestions how to solve it are welcome.

Thanks,
T.

Support for Cloud Witness

Hey All!

Are you working on adding a DSCResource for adding a cloud witness for those in Azure?

Thanks!

Michael

Cluster Role?

anyone know how to script the roles in FailOver Clustering?

I need to add the two HA servers to the role, but exclude the DR server. I do not see any DSC's or cmdlets for the roles.

Unable to add a Node to an existing Cluster

When adding another node to the Cluster, the Set-TargetResource function uses "Add-ClusterNode $env:COMPUTERNAME -Cluster $Name" on line 129.
This fails with the error message:

Add-ClusterNode : Check the spelling of the cluster name. Otherwise, there might be a problem with your
network. Make sure the cluster nodes are turned on and connected to the network or contact your network
administrator.
The RPC server is unavailable
At line:1 char:1

  • Add-ClusterNode $env:COMPUTERNAME -Cluster $Name
  • - CategoryInfo          : ConnectionError: (:) [Add-ClusterNode], ClusterCmdletException
    - FullyQualifiedErrorId : ClusterRpcConnection,Microsoft.FailoverClusters.PowerShell.AddClusterNodeComman 
      d
    
    

When running "Get-Cluster -Name $Name -Domain $ComputerInfo.Domain", this does work and return the Cluster as expected.

When running:
Add-ClusterNode $env:COMPUTERNAME -Cluster "" this does work and add the new node successfully.

"Get-ClusterNode -Cluster $Name" does not work from a node that is not yet in the Cluster.

This essentially prevents adding Nodes to the Cluster using this DSC Resource.

Environment tested is on 2 Azure VMs.

xFailOverCluster: Add VS Code workspace settings file with settings matching style guideline

Details of the scenario you tried and the problem that is occurring:
I suggest we add a VS Code workspace setting file with the following settings:

// Place your settings in this file to overwrite default and user settings.
{
    "powershell.codeFormatting.openBraceOnSameLine": false,
    "powershell.codeFormatting.newLineAfterOpenBrace": false,
    "powershell.codeFormatting.newLineAfterCloseBrace": true,
    "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
    "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
    "powershell.codeFormatting.whitespaceAroundOperator": true,
    "powershell.codeFormatting.whitespaceAfterSeparator": true,
    "powershell.codeFormatting.ignoreOneLineBlock": false,
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true
}

This is discussed here PowerShell/DscResources#284.

That will make it possible inside VS Code to press SHIFT+ALT+F or press F1 and choose 'Format document' in the list. The PowerShell code will then be formatted according to the Style Guideline (although maybe not complete, but would help a lot).

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

New xClusterNetworking Resource

Forking to attempt to commit a new resource for managing cluster networks. Initial pass will include network name and Network Metric settings. This will give users a bit more control of the network configurations of their cluster (particularity useful for hyper-v clusters that need to set custom metrics for live migration).

FileShare Witness

Would be beneficial to have a resource to configure quorum. Specifically FileShare Witness is often used in SQL Server clusters.

xWaitForCluster not accepting "Credential" parameter

Receiving the following error when trying to run xWaitForCluster on node attempting to join the cluster:

Chef::Exceptions::PowershellCmdletException

Powershell Cmdlet failed: Invoke-DscResource : Undefined property Credential

It seems that maybe that parameter was removed but the documentation hasn't been updated?

BREAKING CHANGE: ClusterDisk: Disk number changes between reboots

The resource xClusterDisk should change to use the same logic as xDisk and xWaitForDisk over at xStorage.
See issue dsccommunity/StorageDsc#81 and the change will be merged in dsccommunity/StorageDsc#87.

PR description from dsccommunity/StorageDsc#87:

Removes DiskNumber parameter and replaces with DiskId and DiskIdType. The reason why this was done is because DiskNumber is not a reliable method of identifying disks (it can change between reboots as has been shown). This change will allow support for both DiskNumber and Disk Unique Id to identify disks.

I think this means that the current proposed change in PR #26 should not be merged since that PR is proposing to change to identify disk using the Guid property.

UniqueId is the same for both the cmdlet Get-Disk to get the disks (used by xStorage\xDisk resource) and using Get-CimInstance to get the cluster disks (used by xClusterDisk resource).

PS > Get-Disk | Select Number,UniqueId

Number UniqueId
------ --------
     0 6000C29FB215833D878679F2A872C08C
     4 60003FF44DC75ADCA9D3B0EAAE6D327C
     1 60003FF44DC75ADCB404B1E06EA33A2A
     3 60003FF44DC75ADC9583AC6C75E03D96
     2 60003FF44DC75ADCB300A3B38C2273A4
     5 60003FF44DC75ADC9B337A5F69B4C5DF
PS > Get-CimInstance -ClassName MSCluster_Disk -Namespace 'Root\MSCluster' | Select Number,UniqueId

Number UniqueId
------ --------
     3 60003FF44DC75ADC9583AC6C75E03D96
     5 60003FF44DC75ADC9B337A5F69B4C5DF
     4 60003FF44DC75ADCA9D3B0EAAE6D327C
     2 60003FF44DC75ADCB300A3B38C2273A4
     1 60003FF44DC75ADCB404B1E06EA33A2A

xClusterNetwork: Unit tests does not use the correct template and folder structure is wrong

Details of the scenario you tried and the problem that is occurring:
Unit tests does not use the correct template and folder structure is wrong

I suggest change so the correct template is used for the unit tests, and that the correct folder structure is used.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

Wrong cmdlet used to get Cluster Address Value

Line 38 is currently:
$address = Get-ClusterGroup -Cluster $Name -Name "Cluster IP Address" | Get-ClusterParameter "Address"

Should be:
$address = Get-ClusterResource -Cluster $Name -Name "Cluster IP Address" | Get-ClusterParameter -Name "Address"

Doesn't seem to work when using the Cluster Name as $Name, but does when using a Cluster Node Name as $Name.

This was tested when creating a 2 node cluster with Azure VMs.

xCluster: Set-TargetResource never throws an error if domain name can't be evaluated

Details of the scenario you tried and the problem that is occurring:
The function Set-TargetResource never throws an error if domain name can't be evaluated. This is because of a logic error where the try block is misplaced. Leading to, if domain name cannot be evaluated, means cluster does not exist and should be created. Which is not true because it never evaluated if the cluster existed.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
n/a

xClusterPreferredOwner: Script Analyzer warnings that need to be fixed

MSFT_xClusterPreferredOwner.psm1 (Line 8): The 'Key' parameter 'ClusterName' is not present in 'Get-TargetResource' DSC resource function(s).
MSFT_xClusterPreferredOwner.psm1 (Line 65): The 'Key' parameter 'ClusterName' is not present in 'Set-TargetResource' DSC resource function(s).
MSFT_xClusterPreferredOwner.psm1 (Line 153): The 'Key' parameter 'ClusterName' is not present in 'Test-TargetResource' DSC resource function(s).

xCluster: DomainAdministratorCredential should not be mandatory

Details of the scenario you tried and the problem that is occurring:
It should be possible to use built-in parameter PsDscRunAsCredential for WMF 5.x, so the parameter DomainAdministratorCredential should not be mandatory.

The DSC configuration that is using the resource (as detailed as possible):

xCluster "Create$($Node.FailoverClusterName)"
{
    Name = $Node.FailoverClusterName
    StaticIPAddress = $Node.FailoverClusterIPAddress

    PsDscRunAsCredential = $SqlInstallCredential
}

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
n/a

xClusterQuorum: Test-TargetResource fails on Windows Server 2016 using NodeAndFileShareMajority

Using the following configuration the quorum is set correctly. But in subsequently calls to Test-TargetResource, the call fails with error 'Unknown quorum resource: File Share Witness'.

xClusterQuorum ClusterConfigureQuorum
{
    IsSingleInstance = 'Yes'
    Type = 'NodeAndFileShareMajority'
    Resource = "\\fileserver.company.local\clusterwitness$" 
    PsDscRunAsCredential = $installCredential 
}

This is because when evaluating it uses the following code

elseif ($ClusterQuorum.QuorumResource.ResourceType.DisplayName -eq 'File Share Witness')
{
    $ClusterQuorumType = 'NodeAndFileShareMajority'
}

But the property DisplayName is actually set to 'File Share Quorum Witness'. The property Name and ResourceType is set to 'File Share Witness'.

PS > $ClusterQuorum.QuorumResource

Name               State  OwnerGroup    ResourceType      
----               -----  ----------    ------------      
File Share Witness Online Cluster Group File Share Witness

PS > $ClusterQuorum.QuorumResource.ResourceType

Name               DisplayName              
----               -----------              
File Share Witness File Share Quorum Witness

PS > $ClusterQuorum.QuorumResource.ResourceType.DisplayName
File Share Quorum Witness

So either we change so that we evaluate the property Name, or we change evaluation to look for the correct DisplayName. If I look at the properties in the GUI, then the Type is set to 'File Share Quorum Witness'. So I guess that correlates to the DisplayName property, and Name can be changed by the user. So I guess we need to change to the correct display name string value.

image

xCluster`s Get function will fail

xCluster module`s get function will fail, due to using Get-ClusterGroup Cmdlet.

$address = Get-ClusterGroup -Cluster $Name -Name "Cluster IP Address" | Get-ClusterParameter "Address"

"Cluster IP Address" is not Cluster Group, it is Cluster Resource. We should use Get-ClusterResource Cmdlet.

Ignore Network when creating new cluster

Hello,

Is there a way to ignore network when creating a new cluster. We have multiple NICs installed on the server and would to either utilize all three NICs or ignore the others.

Thanks.

xClusterDisk: Unit tests does not use the correct template and folder structure is wrong

Details of the scenario you tried and the problem that is occurring:
Unit tests does not use the correct template and folder structure is wrong

I suggest change so the correct template is used for the unit tests, and that the correct folder structure is used.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

xCluster: Unit tests does not use the correct template and folder structure is wrong

Details of the scenario you tried and the problem that is occurring:
Unit tests does not use the correct template and folder structure is wrong

I suggest change so the correct template is used for the unit tests, and that the correct folder structure is used.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

xCluster: Script Analyzer warnings that need to be fixed

The following PSScriptAnalyzer errors need to be fixed:
MSFT_xCluster.psm1 (Line 25): $null should be on the left side of equality comparisons.
MSFT_xCluster.psm1 (Line 25): $null should be on the left side of equality comparisons.
MSFT_xCluster.psm1 (Line 81): $null should be on the left side of equality comparisons.
MSFT_xCluster.psm1 (Line 81): $null should be on the left side of equality comparisons.
MSFT_xCluster.psm1 (Line 186): $null should be on the left side of equality comparisons.
MSFT_xCluster.psm1 (Line 186): $null should be on the left side of equality comparisons.
MSFT_xCluster.psm1 (Line 24): File 'MSFT_xCluster.psm1' uses WMI cmdlet. For PowerShell 3.0 and above, use CIM cmdlet which perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems.
MSFT_xCluster.psm1 (Line 80): File 'MSFT_xCluster.psm1' uses WMI cmdlet. For PowerShell 3.0 and above, use CIM cmdlet which perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems.
MSFT_xCluster.psm1 (Line 185): File 'MSFT_xCluster.psm1' uses WMI cmdlet. For PowerShell 3.0 and above, use CIM cmdlet which perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems.

FailoverClusterDsc: Rename the resource module

Details of the scenario you tried and the problem that is occurring:
This might be getting ahead of things. But, when we get to the point that this module is HQRM and being renamed from experimental naming, I suggest we name it FailoverClusterDsc to match the Failover Clustering PowerShell module.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System and PowerShell the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

xWaitForCluster: Script Analyzer warnings that need to be fixed

The following PSScriptAnalyzer errors need to be fixed:
MSFT_xWaitForCluster.psm1 (Line 48): File 'MSFT_xWaitForCluster.psm1' uses WMI cmdlet. For PowerShell 3.0 and above, use CIM cmdlet which perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems.
MSFT_xWaitForCluster.psm1 (Line 99): File 'MSFT_xWaitForCluster.psm1' uses WMI cmdlet. For PowerShell 3.0 and above, use CIM cmdlet which perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems.
MSFT_xWaitForCluster.psm1 (Line 49): $null should be on the left side of equality comparisons.
MSFT_xWaitForCluster.psm1 (Line 49): $null should be on the left side of equality comparisons.
MSFT_xWaitForCluster.psm1 (Line 57): $null should be on the left side of equality comparisons.
MSFT_xWaitForCluster.psm1 (Line 100): $null should be on the left side of equality comparisons.
MSFT_xWaitForCluster.psm1 (Line 100): $null should be on the left side of equality comparisons.
MSFT_xWaitForCluster.psm1 (Line 107): $null should be on the left side of equality comparisons.

Adding a cluster disk adds disks to the cluster

Hi there,

The Add-ClusterNode cmdlet is missing the -NoStorage option. The original node which creates the cluster contains that option and works as expected, but when the subsequent nodes are added all shared disks in the cluster are then added into the available storage.

Thanks,
Ryan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.