Skip to content

Commit

Permalink
Merge pull request #534 from rubrikinc/mwpreston-issue533
Browse files Browse the repository at this point in the history
Issue 533 - Set-RubrikNutanixVM SnapshotConsistencyMandate ValidateSet
Close #533
  • Loading branch information
mwpreston authored Dec 19, 2019
2 parents b835695 + 6ad52fe commit 00905d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

* ValidateSet on Set-RubrikNutanixVM was incorrect. Changed this to the desired values as outlined in [Issue 533](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/533)

### Fixed

* Documentation links in comment-based help updated to lower case
Expand Down
12 changes: 2 additions & 10 deletions Rubrik/Public/Set-RubrikNutanixVM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Set-RubrikNutanixVM
This will unpause backups on any virtual machine named "Server1"
.EXAMPLE
Get-RubrikNutanixVM -SLA Platinum | Set-RubrikNutanixVM -SnapConsistency 'CRASH_CONSISTENT' -MaxNestedSnapshots 2 -UseArrayIntegration
Get-RubrikNutanixVM -SLA Platinum | Set-RubrikNutanixVM -SnapConsistency 'CrashConsistent' -MaxNestedSnapshots 2 -UseArrayIntegration
This will find all virtual machines in the Platinum SLA Domain and set their snapshot consistency to crash consistent (no application quiescence)
while also limiting the number of active hypervisor snapshots to 2 and enable storage array (SAN) snapshots for ingest
#>
Expand All @@ -37,7 +37,7 @@ function Set-RubrikNutanixVM
[ValidateNotNullOrEmpty()]
[String]$id,
# Consistency level mandated for this VM
[ValidateSet('AUTOMATIC','APP_CONSISTENT','CRASH_CONSISTENT','FILE_SYSTEM_CONSISTENT','VSS_CONSISTENT','INCONSISTENT','UNKNOWN')]
[ValidateSet('Automatic','CrashConsistent','ApplicationConsistent')]
[Alias('snapshotConsistencyMandate')]
[String]$SnapConsistency,
# Whether to pause or resume backups/archival for this VM.
Expand Down Expand Up @@ -66,14 +66,6 @@ function Set-RubrikNutanixVM
$resources = Get-RubrikAPIData -endpoint $function
Write-Verbose -Message "Load API data for $($resources.Function)"
Write-Verbose -Message "Description: $($resources.Description)"

#region one-off
if ($SnapConsistency)
{
$SnapConsistency = $SnapConsistency -replace 'AUTOMATIC', 'UNKNOWN'
}
#endregion

}

Process {
Expand Down
6 changes: 3 additions & 3 deletions Tests/Set-RubrikNutanixVM.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ Describe -Name 'Public/Set-RubrikNutanixVM' -Tag 'Public', 'Set-RubrikNutanixVM'
Mock -CommandName Submit-Request -Verifiable -ModuleName 'Rubrik' -MockWith {
@{
'id' = 'NutanixVirtualMachine:::aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee-vm-ffffffff-0000-1111-2222-333333333333'
'snapshotConsistencyMandate' = 'CRASH_CONSISTENT'
'snapshotConsistencyMandate' = 'CrashConsistent'
}
}
It -Name 'Should set SnapConsistency' -Test {
( Set-RubrikNutanixVM -id 'NutanixVirtualMachine:::aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee-vm-ffffffff-0000-1111-2222-333333333333' -SnapConsistency 'CRASH_CONSISTENT').snapshotConsistencyMandate |
Should -BeExactly 'CRASH_CONSISTENT'
( Set-RubrikNutanixVM -id 'NutanixVirtualMachine:::aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee-vm-ffffffff-0000-1111-2222-333333333333' -SnapConsistency 'CrashConsistent').snapshotConsistencyMandate |
Should -BeExactly 'CrashConsistent'
}

Assert-VerifiableMock
Expand Down

0 comments on commit 00905d5

Please sign in to comment.