25 Commits

Author SHA1 Message Date
Wes Carroll f06157c75e Bump Version for Release 2020-12-16 13:10:02 -05:00
Wes Carroll d413374c09 CHANGLOG Updates 2020-12-16 09:43:22 -05:00
Wes Carroll 1513cd4f4b Update Synopsis 2020-12-16 09:42:48 -05:00
Wes Carroll 1daac508b2 Update SiteId Lookup Method 2020-12-16 09:42:23 -05:00
Wes Carroll a22d9e3416 Merge pull request #113 from ZertoPublic/wcarroll/issue112
SiteId Query to VirtualizationSites Fixes #112
2020-12-09 21:57:36 -05:00
Wes Carroll 06e81b46d6 Update CHANGELOG for #112 2020-12-09 17:09:53 -05:00
Wes Carroll af33715f02 SiteId Query to VirtualizationSites Fixes #112 2020-12-09 16:13:50 -05:00
Wes Carroll 912bca0f9c Merge pull request #111 from ZertoPublic/export_bug_fix
Export bug fix
2020-10-19 19:10:37 -04:00
Wes Carroll 4ac951607b Add required Mock 2020-10-19 18:43:13 -04:00
Wes Carroll d3d01f892f Bump Version 2020-10-19 18:35:30 -04:00
Wes Carroll 84b7922156 Update CHANGELOG 2020-10-19 18:24:08 -04:00
Wes Carroll 0eaf89608b Clean up VPG Settings Identifier 2020-10-19 18:22:10 -04:00
Wes Carroll 50e03b36f5 Merge pull request #110 from ZertoPublic/Release
Release into Master
2020-09-08 08:55:07 -04:00
Wes Carroll 4531d2d53b Merge branch 'release_prep' into Release 2020-09-08 08:22:32 -04:00
Wes Carroll e6e6be9ede Bump Version 2020-09-08 08:21:10 -04:00
Wes Carroll 5c2dd620d8 Update for Release Notes 2020-09-08 08:20:29 -04:00
Wes Carroll a5a91febcf Merge pull request #109 from jonsouzerto/master
Fixed issue 108
2020-09-04 10:28:45 -04:00
jonsouzerto bb5dbaa0d4 Update CHANGELOG.md
Added fix information
2020-09-03 12:50:49 -04:00
jonsouzerto e6b5777e64 Updated recovery host key
Attempting to resolve issue 108
2020-09-03 12:45:35 -04:00
Wes Carroll ddee165575 Merge pull request #107 from gdbarron/invoke-move-updates
Invoke-ZertoMove parameter, pipeline, and restructuring updates
2020-08-28 13:48:34 -04:00
Brownstein f0279633dd add missing .IsPresent for switch value 2020-08-28 13:43:22 -04:00
Brownstein 139e52f3e2 add new parameter to test 2020-08-27 15:28:01 -04:00
Brownstein eea6e95988 update test and help files 2020-08-27 15:08:28 -04:00
Brownstein 0630cbb20e new param sets, pipeline input 2020-08-21 21:04:15 -04:00
Wes Carroll 682750fc6d Merge pull request #106 from ZertoPublic/Release
Merge pull request #105 from ZertoPublic/master
2020-08-20 13:44:03 -04:00
9 changed files with 175 additions and 73 deletions
+30
View File
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.5.3]
### Zerto Virtual Manager
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/112) where `New-ZertoVpg` would fail when specifying the local site as the target site.
* Updated the method where a Site Identifer is obtained during the `New-ZertoVpg` execution that would occasionally fail on some versions of PowerShell.
#### Updated
* Updated `New-ZertoVpg` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md) to more clearly specify the return value and the requirement to pass it into the `Save-ZertoVpgSetting` function to commit the VPG.
## [1.5.2]
### Zerto Virtual Manager
#### Fixed
* Fixed an issue when attempting to export more than 100 VPGs with the `Export-ZertoVpg` function that would cause an error.
## [1.5.1]
### Zerto Virtual Manager
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/108) with `New-ZertoVpg` where when specifying a single host as a recovery target, the host identifier was not properly assigned. - Thanks @jonsouzerto!
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/86) with `Invoke-ZertoMoveVpg` where parameters should have been mandatory in certain workflows. - Thanks @gdbarron!
## [1.5.0]
### Zerto Virtual Manager
+4
View File
@@ -46,6 +46,10 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
return "1024d377-afb8-4880-82f0-96eeff413ffd"
}
Mock -ModuleName ZertoApiWrapper -CommandName Remove-ZertoVpgSettingsIdentifier {
return $null
}
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpgSetting {
$returnObj = @{
Backup = $null
+5 -4
View File
@@ -5,17 +5,18 @@ $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 20 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 20
It "$global:function should have exactly 21 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 21
}
$ParameterTestCases = @(
@{ParameterName = 'vpgIdentifier'; Type = 'Guid[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
@{ParameterName = 'commitPolicyTimeout'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'forceShutdown'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $true; Validation = $null }
@{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $true; Validation = $null }
@{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'ContinueOnPreScriptFailure'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
)
@@ -38,6 +38,7 @@ function Export-ZertoVpg {
$vpgSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier
$filePath = "{0}\{1}.json" -f $outputPath, $name
$vpgSettings | Convertto-Json -depth 10 | Out-File -FilePath $filePath
$null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $vpgSettingsIdentifier
}
}
+75 -46
View File
@@ -1,22 +1,57 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZertoMove {
[CmdletBinding( DefaultParameterSetName = "main", SupportsShouldProcess = $true )]
[CmdletBinding( DefaultParameterSetName = "id", SupportsShouldProcess = $true )]
param(
[Parameter(
ParameterSetName = 'name',
HelpMessage = "Name(s) of the VPG(s) you want to move.",
Mandatory
)]
[Parameter(
ParameterSetName = 'commitName',
HelpMessage = "Name(s) of the VPG(s) you want to move.",
Mandatory
)]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName,
[Parameter(
ParameterSetName = 'id',
HelpMessage = "ID(s) of the VPG(s) you want to move.",
Mandatory,
ValueFromPipelineByPropertyName
)]
[Parameter(
ParameterSetName = 'commitId',
HelpMessage = "ID(s) of the VPG(s) you want to move.",
Mandatory,
ValueFromPipelineByPropertyName
)]
[ValidateNotNullOrEmpty()]
[guid[]]$vpgIdentifier,
[Parameter(
ParameterSetName = 'commitName',
HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
Default is the Site Settings setting."
Default is the Site Settings setting.",
Mandatory
)]
[Parameter(
ParameterSetName = 'commitId',
HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
Default is the Site Settings setting.",
Mandatory
)]
[ValidateSet("Rollback", "Commit", "None")]
[string]$commitPolicy,
[Parameter(
ParameterSetName = 'commitName',
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)]
[Parameter(
ParameterSetName = 'commitId',
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)]
# Min 5 Minutes, Max 24 Hours, Default Site Settigns.
@@ -27,15 +62,11 @@ function Invoke-ZertoMove {
)]
[switch]$forceShutdown,
[Parameter(
ParameterSetName = "disableReverseProtection",
HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.",
Mandatory
HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set."
)]
[switch]$disableReverseProtection,
[Parameter(
ParameterSetName = "keepSourceVms",
HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.",
Mandatory
HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection."
)]
[switch]$keepSourceVms,
[Parameter(
@@ -46,52 +77,50 @@ function Invoke-ZertoMove {
begin {
$baseUri = "vpgs"
$body = @{
forceShutdown = $forceShutdown.IsPresent
ContinueOnPreScriptFailure = $ContinueOnPreScriptFailure.IsPresent
keepSourceVms = $keepSourceVms.IsPresent
reverseProtection = -not $disableReverseProtection.IsPresent
}
if ( $keepSourceVms.IsPresent -and -not $disableReverseProtection.IsPresent ) {
Write-Verbose 'Disabling reverse protection as keepSourceVms requires it'
$body['reverseProtection'] = $false
}
if ($PSBoundParameters.ContainsKey('commitPolicy')) {
$body['commitPolicy'] = $commitPolicy
if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) {
$body['commitPolicyTimeout'] = $commitPolicyTimeout
}
}
}
process {
$body = @{ }
#TODO - use a foreach loop to populate the body without all the if statments
if ($PSBoundParameters.ContainsKey('commitPolicy')) {
$body['commitPolicy'] = $commitPolicy
}
if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) {
$body['commitPolicyTimeout'] = $commitPolicyTimeout
}
if ($PSBoundParameters.ContainsKey('forceShutdown')) {
$body['forceShutdown'] = $true
} else {
$body['forceShutdown'] = $false
}
if ($PSBoundParameters.ContainsKey('ContinueOnPreScriptFailure')) {
$body['ContinueOnPreScriptFailure'] = $true
} else {
$body['ContinueOnPreScriptFailure'] = $false
}
switch ($PSCmdlet.ParameterSetName) {
"disableReverseProtection" {
$body['reverseProtection'] = $false
$body['keepSourceVms'] = $false
{ $_ -in 'name', 'commitName' } {
$vpgIds = foreach ($name in $vpgName) {
$vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier
if ( -not $vpgId ) {
Write-Error "VPG: '$name' not found. Please check the name and try again. Skipping"
} else {
Write-Verbose "VPG: $name, ID: $vpgId"
$vpgId
}
}
}
"keepSourceVms" {
$body['reverseProtection'] = $false
$body['keepSourceVms'] = $true
}
"main" {
$body['reverseProtection'] = $true
$body['keepSourceVms'] = $false
{ $_ -in 'id', 'commitId' } {
$vpgIds = $vpgIdentifier
}
}
foreach ($name in $vpgName) {
$vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier
if ( -not $vpgId ) {
Write-Error "VPG: $name not found. Please check the name and try again. Skipping"
} else {
$uri = "{0}/{1}/move" -f $baseUri, $vpgId
if ($PSCmdlet.ShouldProcess("Moving VPG: $name with settings: $($body | convertto-json)")) {
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
}
foreach ($thisId in $vpgIds) {
$uri = "{0}/{1}/move" -f $baseUri, $thisId
if ($PSCmdlet.ShouldProcess("Moving VPG: $thisId with settings: $($body | ConvertTo-Json)")) {
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
}
}
}
+3 -3
View File
@@ -165,7 +165,7 @@ function New-ZertoVpg {
begin {
# Create an identifiers table, and start converting names to identifiers.
$identifiersTable = @{ }
$identifiersTable['recoverySiteIdentifier'] = (Get-ZertoPeerSite).Where({$_.PeerSiteName -like $recoverySite}) | Select-Object -ExpandProperty SiteIdentifier
$identifiersTable['recoverySiteIdentifier'] = Get-ZertoVirtualizationSite | Where-Object { $_.VirtualizationSiteName -like $recoverySite } | Select-Object -ExpandProperty SiteIdentifier
$peerSiteNetworks = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -networks)
$identifiersTable['failoverNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $recoveryNetwork } | Select-Object -ExpandProperty NetworkIdentifier
$identifiersTable['testNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $testNetwork } | Select-Object -ExpandProperty NetworkIdentifier
@@ -295,11 +295,11 @@ function New-ZertoVpg {
"recoveryHostDatastoreCluster" {
$baseSettings.Recovery.DefaultDatastoreClusterIdentifier = $identifiersTable['datastoreClusterIdentifier']
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier']
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier']
}
"recoveryHostDatastore" {
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier']
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier']
$baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier']
}
+55 -18
View File
@@ -12,22 +12,30 @@ Start a move of a VPG.
## SYNTAX
### main (Default)
### id (Default)
```
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown]
Invoke-ZertoMove -vpgIdentifier <Guid[]> [-forceShutdown] [-disableReverseProtection] [-keepSourceVms]
[-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
```
### disableReverseProtection
### commitName
```
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown]
[-disableReverseProtection] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
Invoke-ZertoMove -vpgName <String[]> -commitPolicy <String> [-commitPolicyTimeout <Int32>] [-forceShutdown]
[-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
### keepSourceVms
### name
```
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown]
[-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
Invoke-ZertoMove -vpgName <String[]> [-forceShutdown] [-disableReverseProtection] [-keepSourceVms]
[-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
```
### commitId
```
Invoke-ZertoMove -vpgIdentifier <Guid[]> -commitPolicy <String> [-commitPolicyTimeout <Int32>] [-forceShutdown]
[-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
@@ -37,10 +45,24 @@ Start a move of a VPG.
### Example 1
```powershell
PS C:\> Invoke-ZertoMove -vpgName "MyVpg"
PS C:\> Invoke-ZertoMove -vpgName 'MyVpg'
```
Starts a move operation of VPG "MyVpg"
Specify the name of a vpg to move
### Example 2
```powershell
PS C:\> Invoke-ZertoMove -vpgIdentifier '2fbbf6b5-cddc-4653-b1fe-564f069eeb64'
```
Specify the identifier of a vpg to move
### Example 3
```powershell
PS C:\> Get-ZertoVpg | Invoke-ZertoMove
```
Utilize the pipeline to move multiple vpgs
## PARAMETERS
@@ -55,11 +77,11 @@ Default is the Site Settings setting.
```yaml
Type: String
Parameter Sets: (All)
Parameter Sets: commitName, commitId
Aliases:
Accepted values: Rollback, Commit, None
Required: False
Required: True
Position: Named
Default value: None
Accept pipeline input: False
@@ -72,7 +94,7 @@ If omitted, the site settings default will be applied.
```yaml
Type: Int32
Parameter Sets: (All)
Parameter Sets: commitName, commitId
Aliases:
Required: False
@@ -102,10 +124,10 @@ Do not enable reverse protection. The VPG definition is kept with the status Nee
```yaml
Type: SwitchParameter
Parameter Sets: disableReverseProtection
Parameter Sets: (All)
Aliases:
Required: True
Required: False
Position: Named
Default value: None
Accept pipeline input: False
@@ -132,13 +154,28 @@ Use this switch to Prevent the protected virtual machines from being deleted in
```yaml
Type: SwitchParameter
Parameter Sets: keepSourceVms
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vpgIdentifier
ID(s) of the VPG(s) you want to move.
```yaml
Type: Guid[]
Parameter Sets: id, commitId
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
@@ -147,7 +184,7 @@ Name(s) of the VPG(s) you want to move.
```yaml
Type: String[]
Parameter Sets: (All)
Parameter Sets: commitName, name
Aliases:
Required: True
+1 -1
View File
@@ -8,7 +8,7 @@ schema: 2.0.0
# New-ZertoVpg
## SYNOPSIS
Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions.
Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions. Returns a VpgSettingsIdentifier to be passed into the `Save-ZertoVpgSetting` function to create the VPG.
## SYNTAX
+1 -1
View File
@@ -1 +1 @@
1.5.0
1.5.3