-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from PowerShell/dev
Merging release pull request
- Loading branch information
Showing
7 changed files
with
774 additions
and
38 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
145 changes: 145 additions & 0 deletions
145
DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.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,145 @@ | ||
|
||
function Get-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([Hashtable])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateSet('Yes')] | ||
[String] $IsSingleInstance, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[ValidateSet('NodeMajority', 'NodeAndDiskMajority', 'NodeAndFileShareMajority', 'DiskOnly')] | ||
[String] $Type, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[String] $Resource | ||
) | ||
|
||
$ClusterQuorum = Get-ClusterQuorum | ||
|
||
switch ($ClusterQuorum.QuorumType) | ||
{ | ||
# WS2016 only | ||
'Majority' { | ||
if ($ClusterQuorum.QuorumResource -eq $null) | ||
{ | ||
$ClusterQuorumType = 'NodeMajority' | ||
} | ||
elseif ($ClusterQuorum.QuorumResource.ResourceType.DisplayName -eq 'Physical Disk') | ||
{ | ||
$ClusterQuorumType = 'NodeAndDiskMajority' | ||
} | ||
elseif ($ClusterQuorum.QuorumResource.ResourceType.DisplayName -eq 'File Share Witness') | ||
{ | ||
$ClusterQuorumType = 'NodeAndFileShareMajority' | ||
} | ||
else | ||
{ | ||
throw "Unknown quorum resource: $($ClusterQuorum.QuorumResource)" | ||
} | ||
} | ||
|
||
# WS2012R2 only | ||
'NodeMajority' { | ||
$ClusterQuorumType = 'NodeMajority' | ||
} | ||
'NodeAndDiskMajority' { | ||
$ClusterQuorumType = 'NodeAndDiskMajority' | ||
} | ||
'NodeAndFileShareMajority' { | ||
$ClusterQuorumType = 'NodeAndFileShareMajority' | ||
} | ||
|
||
# All | ||
'DiskOnly' { | ||
$ClusterQuorumType = 'DiskOnly' | ||
} | ||
|
||
# Default | ||
default { | ||
throw "Unknown quorum type: $($ClusterQuorum.QuorumType)" | ||
} | ||
} | ||
|
||
if ($ClusterQuorumType -eq 'NodeAndFileShareMajority') | ||
{ | ||
$ClusterQuorumResource = $ClusterQuorum.QuorumResource | Get-ClusterParameter -Name SharePath | Select-Object -ExpandProperty Value | ||
} | ||
else | ||
{ | ||
$ClusterQuorumResource = [String] $ClusterQuorum.QuorumResource.Name | ||
} | ||
|
||
@{ | ||
IsSingleInstance = $IsSingleInstance | ||
Type = $ClusterQuorumType | ||
Resource = $ClusterQuorumResource | ||
} | ||
} | ||
|
||
function Set-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateSet('Yes')] | ||
[String] $IsSingleInstance, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[ValidateSet('NodeMajority', 'NodeAndDiskMajority', 'NodeAndFileShareMajority', 'DiskOnly')] | ||
[String] $Type, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[String] $Resource | ||
) | ||
|
||
switch ($Type) | ||
{ | ||
'NodeMajority' { | ||
Set-ClusterQuorum -NoWitness | ||
} | ||
|
||
'NodeAndDiskMajority' { | ||
Set-ClusterQuorum -DiskWitness $Resource | ||
} | ||
|
||
'NodeAndFileShareMajority' { | ||
Set-ClusterQuorum -FileShareWitness $Resource | ||
} | ||
|
||
'DiskOnly' { | ||
Set-ClusterQuorum -DiskOnly $Resource | ||
} | ||
} | ||
} | ||
|
||
function Test-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([Boolean])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateSet('Yes')] | ||
[String] $IsSingleInstance, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[ValidateSet('NodeMajority', 'NodeAndDiskMajority', 'NodeAndFileShareMajority', 'DiskOnly')] | ||
[String] $Type, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[String] $Resource | ||
) | ||
|
||
$CurrentQuorum = Get-TargetResource -IsSingleInstance $IsSingleInstance | ||
|
||
return ( | ||
($CurrentQuorum.Type -eq $Type) -and | ||
($CurrentQuorum.Resource -eq $Resource) | ||
) | ||
} | ||
|
||
Export-ModuleMember -Function *-TargetResource |
9 changes: 9 additions & 0 deletions
9
DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.schema.mof
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,9 @@ | ||
[ClassVersion("1.0.0.0"), FriendlyName("xClusterQuorum")] | ||
class MSFT_xClusterQuorum : OMI_BaseResource | ||
{ | ||
[Key, ValueMap{"Yes"}, Values{"Yes"}] string IsSingleInstance; | ||
|
||
[Write, ValueMap{"NodeMajority", "NodeAndDiskMajority", "NodeAndFileShareMajority", "DiskOnly"}, Values{"NodeMajority", "NodeAndDiskMajority", "NodeAndFileShareMajority", "DiskOnly"}] string Type; | ||
|
||
[Write] String Resource; | ||
}; |
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 |
---|---|---|
|
@@ -4,9 +4,6 @@ | |
|
||
The **xFailOverCluster** DSC modules contains **xCluster** and **xWaitForCluster** resources for creating and configuring failover clusters. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## Contributing | ||
Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). | ||
|
||
|
@@ -22,28 +19,18 @@ Please check out common DSC Resources [contributing guidelines](https://github.c | |
* **StaticIPAddress**: Static IP Address of the cluster | ||
* **DomainAdministratorCredential**: Credential used to create the cluster | ||
|
||
### xClusterNetwork (Unreleased) | ||
### xClusterQuorum (Unreleased) | ||
|
||
* **Address**: The network address (e.g. 192.168.0.0) | ||
* **AddressMask**: The network mask (e.g. 255.255.255.0) | ||
* **Name**: The network label or name | ||
* **Role**: Network role: *0 = None, 1 = Cluster Only, 3 = Clsuter and Client* | ||
* **Metric**: The internal metric for the networks | ||
* **IsSingleInstance** Always set to `Yes` to prevent multiple quorum settings per cluster. | ||
* **Type** Quorum type to use: *NodeMajority*, *NodeAndDiskMajority*, *NodeAndFileShareMajority*, *DiskOnly* | ||
* **Resource** The name of the disk or file share resource to use as witness. Is optional with *NodeMajority* type. | ||
|
||
### xClusterDisk (Unreleased) | ||
|
||
* **Number**: Number of the cluster disk | ||
* **Ensure**: Define if the cluster disk should be added (Present) or removed (Absent) | ||
* **Label**: The disk label inside the Failover Cluster | ||
|
||
### xClusterPreferredOwner (Unreleased) | ||
For more information about cluster preferred owners please see: http://support.microsoft.com/kb/299631 | ||
* **ClusterGroup**: Cluster group name | ||
* **ClusterName**: Cluster name | ||
* **Nodes**: Selected cluster nodes. | ||
* **ClusterResources**: Selected cluster resources | ||
* **Ensure**: Whether an owner should be present or removed | ||
|
||
### xWaitForCluster | ||
|
||
* **Name**: Name of the cluster to wait for | ||
|
@@ -54,20 +41,16 @@ For more information about cluster preferred owners please see: http://support.m | |
## Versions | ||
|
||
### Unreleased | ||
|
||
### 1.4.0.0 | ||
* xClusterDisk: Fixed Test-TargetResource logic | ||
|
||
### 1.3.0.0 | ||
### 1.5.0.0 | ||
|
||
* Added xClusterNetwork resource | ||
* Added xClusterQuorum resource with options *NodeMajority*, *NodeAndDiskMajority*, *NodeAndFileShareMajority*, *DiskOnly* | ||
* Currently does not implement cloudwitness for Windows 2016. | ||
* Added xClusterDisk resource | ||
* Added xClusterPreferredOwner resource | ||
* Resolved issue: Failing Get-TargetResource in xCluster | ||
|
||
### 1.2.0.0 | ||
|
||
* xCluster: Added -NoStorage switch to add-clusternode. This prevents disks from being automatically added when joining a node to a cluster | ||
* xCluster: Added -NoStorage switch to add-clusterNode. This prevents disks from being automatically added when joining a node to a cluster | ||
|
||
### 1.1.0.0 | ||
|
||
|
Oops, something went wrong.