Skip to content

Commit

Permalink
[dsccommunity#259] Added serial number as disk identifier to Disk, Di…
Browse files Browse the repository at this point in the history
…skAccessPath and WaitForDisk resources
  • Loading branch information
bozho committed Nov 10, 2021
1 parent 7aa733b commit 31fe7a6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions source/DSCResources/DSC_Disk/DSC_Disk.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Get-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down Expand Up @@ -190,7 +190,7 @@ function Set-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down Expand Up @@ -687,7 +687,7 @@ function Test-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down
2 changes: 1 addition & 1 deletion source/DSCResources/DSC_Disk/DSC_Disk.schema.mof
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class DSC_Disk : OMI_BaseResource
{
[Key, Description("Specifies the identifier for which disk to modify.")] String DriveLetter;
[Required, Description("Specifies the disk identifier for the disk to modify.")] String DiskId;
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid","Location"}, Values{"Number","UniqueId","Guid","Location"}] String DiskIdType;
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid","Location","SerialNumber"}, Values{"Number","UniqueId","Guid","Location","SerialNumber"}] String DiskIdType;
[Write, Description("Specifies the partition style of the disk. Defaults to GPT."), ValueMap{"MBR","GPT"}, Values{"MBR","GPT"}] String PartitionStyle;
[Write, Description("Specifies the size of new volume. Leave empty to use the remaining free space.")] Uint64 Size;
[Write, Description("Define volume label if required.")] String FSLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Get-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down Expand Up @@ -173,7 +173,7 @@ function Set-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down Expand Up @@ -585,7 +585,7 @@ function Test-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class DSC_DiskAccessPath : OMI_BaseResource
[Key, Description("Specifies the access path folder to the assign the disk volume to.")] String AccessPath;
[Write, Description("Specifies no automatic drive letter assignment to the partition: Defaults to True")] Boolean NoDefaultDriveLetter;
[Required, Description("Specifies the disk identifier for the disk to modify.")] String DiskId;
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid","Location"}, Values{"Number","UniqueId","Guid","Location"}] String DiskIdType;
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid","Location","SerialNumber"}, Values{"Number","UniqueId","Guid","Location","SerialNumber"}] String DiskIdType;
[Write, Description("Specifies the size of new volume.")] Uint64 Size;
[Write, Description("Define volume label if required.")] String FSLabel;
[Write, Description("Specifies the allocation unit size to use when formatting the volume.")] Uint32 AllocationUnitSize;
Expand Down
6 changes: 3 additions & 3 deletions source/DSCResources/DSC_WaitForDisk/DSC_WaitForDisk.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function Get-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number','UniqueId','Guid','Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down Expand Up @@ -94,7 +94,7 @@ function Set-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number','UniqueId','Guid','Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down Expand Up @@ -176,7 +176,7 @@ function Test-TargetResource
$DiskId,

[Parameter()]
[ValidateSet('Number','UniqueId','Guid','Location')]
[ValidateSet('Number', 'UniqueId', 'Guid', 'Location', 'SerialNumber')]
[System.String]
$DiskIdType = 'Number',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class DSC_WaitForDisk : OMI_BaseResource
{
[Key, Description("Specifies the disk identifier for the disk to wait for.")] String DiskId;
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid","Location"}, Values{"Number","UniqueId","Guid","Location"}] String DiskIdType;
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid","Location","SerialNumber"}, Values{"Number","UniqueId","Guid","Location","SerialNumber"}] String DiskIdType;
[Write, Description("Specifies the number of seconds to wait for the disk to become available.")] Uint32 RetryIntervalSec;
[Write, Description("The number of times to loop the retry interval while waiting for the disk.")] Uint32 RetryCount;
[Read, Description("Will indicate whether Disk is available.")] Boolean IsAvailable;
Expand Down
4 changes: 2 additions & 2 deletions source/Modules/StorageDsc.Common/StorageDsc.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ function Get-DiskByIdentifier
$DiskId,

[Parameter()]
[ValidateSet('Number','UniqueId','Guid','Location')]
[ValidateSet('Number','UniqueId','Guid','Location','SerialNumber')]
[System.String]
$DiskIdType = 'Number'
)

switch -regex ($DiskIdType)
{
'Number|UniqueId' # for filters supported by the Get-Disk CmdLet
'Number|UniqueId|SerialNumber' # for filters supported by the Get-Disk CmdLet
{
$diskIdParameter = @{
$DiskIdType = $DiskId
Expand Down

0 comments on commit 31fe7a6

Please sign in to comment.