Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 291aae9dcd | |||
| f8f0d980d0 | |||
| b72099559c | |||
| 6046103da0 | |||
| cccd45b7fd | |||
| 77b7e1c376 | |||
| 8f735bee62 | |||
| de505debf9 | |||
| bc570e9005 | |||
| 804a60be77 | |||
| 1e678214b1 | |||
| ba0b12e83c | |||
| b33b07b524 | |||
| d4b4d1b4d7 | |||
| fbe3f4d031 | |||
| 26cfb832a4 | |||
| 865ca1dd39 | |||
| 2887f6d450 |
@@ -5,6 +5,16 @@ 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/),
|
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).
|
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.4.2]
|
||||||
|
|
||||||
|
### Zerto Virtual Manager
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
* Updated `Get-ZertoEvent` to translate a vpg name parameter to a vpgIdentifier per the API documentation
|
||||||
|
* Updated `Invoke-ZertoMoveCommit` to ensure that when one of the parameter switches is defined, all required parameters are sent to avoid conflicts with parameters passed with the `Invoke-ZertoMove` command.
|
||||||
|
* Updated `Start-ZertoCloneVpg` to fix an issue where an error would be thrown if an operation specified a subset of VMs to be cloned.
|
||||||
|
|
||||||
## [1.4.1]
|
## [1.4.1]
|
||||||
|
|
||||||
### General
|
### General
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ PS> Install-Module -name ZertoApiWrapper
|
|||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
* [Getting Started with Zerto Virtual Manager and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Stated-with-Zerto-Virtual-Manager)
|
* [Getting Started with Zerto Virtual Manager and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Virtual-Manager)
|
||||||
* [Getting Started with Zerto Analytics and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
|
* [Getting Started with Zerto Analytics and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
|
||||||
|
|
||||||
## Recent Updates
|
## Recent Updates
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
|||||||
$ParameterTestCases = @(
|
$ParameterTestCases = @(
|
||||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||||
@{ParameterName = 'vpgName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
@{ParameterName = 'vpg'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||||
@{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
@{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||||
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ function Get-ZertoEvent {
|
|||||||
HelpMessage = "The name of the VPG for which you want to return events."
|
HelpMessage = "The name of the VPG for which you want to return events."
|
||||||
)]
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[Alias("vpg")]
|
[Alias("vpgName")]
|
||||||
[string]$vpgName,
|
[string]$vpg,
|
||||||
[Parameter(
|
[Parameter(
|
||||||
ParameterSetName = "filter",
|
ParameterSetName = "filter",
|
||||||
HelpMessage = "The identifier of the VPG for which you want to return events."
|
HelpMessage = "The identifier of the VPG for which you want to return events."
|
||||||
@@ -137,6 +137,10 @@ function Get-ZertoEvent {
|
|||||||
# If a filter is applied, create the filter and return the events that fall in that filter
|
# If a filter is applied, create the filter and return the events that fall in that filter
|
||||||
"filter" {
|
"filter" {
|
||||||
$filter = Get-ZertoApiFilter -filterTable $PSBoundParameters
|
$filter = Get-ZertoApiFilter -filterTable $PSBoundParameters
|
||||||
|
if ($PSBoundParameters.Keys -contains 'vpg') {
|
||||||
|
$vpgIdentifier = (Get-ZertoVpg -name $vpg).vpgIdentifier
|
||||||
|
$filter = $filter.replace("vpg=$vpg", "vpg=$vpgIdentifier")
|
||||||
|
}
|
||||||
$uri = "{0}{1}" -f $baseUri, $filter
|
$uri = "{0}{1}" -f $baseUri, $filter
|
||||||
$returnObject = Invoke-ZertoRestRequest -uri $uri
|
$returnObject = Invoke-ZertoRestRequest -uri $uri
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||||
function Invoke-ZertoMoveCommit {
|
function Invoke-ZertoMoveCommit {
|
||||||
[cmdletbinding(SupportsShouldProcess = $true)]
|
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Main")]
|
||||||
param(
|
param(
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Name(s) of the VPG(s) to commit.",
|
HelpMessage = "Name(s) of the VPG(s) to commit.",
|
||||||
@@ -9,11 +9,16 @@ function Invoke-ZertoMoveCommit {
|
|||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string[]]$vpgName,
|
[string[]]$vpgName,
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False"
|
HelpMessage = "Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.",
|
||||||
|
ParameterSetName = 'ReverseProtect',
|
||||||
|
Mandatory
|
||||||
|
|
||||||
)]
|
)]
|
||||||
[switch]$reverseProtection,
|
[switch]$reverseProtection,
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Use this switch to keep the source VMs. If not set, they will be destroyed."
|
HelpMessage = "Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.",
|
||||||
|
ParameterSetName = 'KeepSource',
|
||||||
|
Mandatory
|
||||||
)]
|
)]
|
||||||
[switch]$keepSourceVms
|
[switch]$keepSourceVms
|
||||||
)
|
)
|
||||||
@@ -21,10 +26,16 @@ function Invoke-ZertoMoveCommit {
|
|||||||
begin {
|
begin {
|
||||||
$baseUri = "vpgs"
|
$baseUri = "vpgs"
|
||||||
$body = @{ }
|
$body = @{ }
|
||||||
if ($reverseProtection) {
|
Switch ($PSCmdlet.ParameterSetName){
|
||||||
$body["ReverseProtection"] = $true
|
'KeepSource' {
|
||||||
} elseif ($keepSourceVms) {
|
$body["KeepSourceVms"] = $true
|
||||||
$body["KeepSourceVms"] = $true
|
$body["ReverseProtection"] = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
'ReverseProtect' {
|
||||||
|
$body["ReverseProtection"] = $true
|
||||||
|
$body["KeepSourceVms"] = $false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,18 +27,25 @@ function Start-ZertoCloneVpg {
|
|||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
$baseUri = "vpgs"
|
$baseUri = "vpgs"
|
||||||
$vpgInfo = Get-ZertoVpg -name $vpgName
|
$vpgInfo = Get-ZertoVpg -name $vpgName
|
||||||
if ( -not $vpgInfo ) {
|
if ( -not $vpgInfo ) {
|
||||||
Write-Error "VPG: $vpgName could not be found. Please check the name and try again."
|
Write-Error "VPG: $vpgName could not be found. Please check the name and try again."
|
||||||
}
|
}
|
||||||
$vpgIdentifier = $vpgInfo.vpgIdentifier
|
$vpgIdentifier = $vpgInfo.vpgIdentifier
|
||||||
|
$body = @{ }
|
||||||
if ( $PSBoundParameters.ContainsKey('datastoreName') ) {
|
if ( $PSBoundParameters.ContainsKey('datastoreName') ) {
|
||||||
$recoverysiteIdentifier = $vpgInfo.recoverysite.identifier
|
$recoverysiteIdentifier = $vpgInfo.recoverysite.identifier
|
||||||
$recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores
|
$recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores
|
||||||
$datastoreIdentifier = $($recoverySiteDatastores | Where-Object { $_.datastoreName -like $datastoreName }).DatastoreIdentifier
|
$datastoreIdentifier = $($recoverySiteDatastores | Where-Object { $_.datastoreName -like $datastoreName }).DatastoreIdentifier
|
||||||
if ( -not $datastoreIdentifier ) {
|
if ( -not $datastoreIdentifier ) {
|
||||||
Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop
|
Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop
|
||||||
|
} else {
|
||||||
|
$body['DatastoreIdentifier'] = $datastoreIdentifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $PSBoundParameters.ContainsKey('vmName') ) {
|
if ( $PSBoundParameters.ContainsKey('vmName') ) {
|
||||||
@@ -55,32 +62,20 @@ function Start-ZertoCloneVpg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$body['VmIdentifiers'] = $vmIdentifiers
|
$body['VmIdentifiers'] = $vmIdentifiers
|
||||||
if ($checkpointIdentifier) {
|
|
||||||
$body['CheckpointIdentifier'] = $checkpointIdentifier
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
process {
|
|
||||||
$uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier
|
|
||||||
$body = [ordered]@{ }
|
|
||||||
if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) {
|
if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) {
|
||||||
$body['checkpointId'] = $checkpointIdentifier
|
$body['checkpointId'] = $checkpointIdentifier
|
||||||
}
|
}
|
||||||
if ( $datastoreIdentifier ) {
|
|
||||||
$body['DatastoreIdentifier'] = $datastoreIdentifier
|
|
||||||
}
|
|
||||||
if ( $vmIdentifiers ) {
|
|
||||||
$body['VmIdentifiers'] = $vmIdentifiers
|
|
||||||
}
|
|
||||||
Write-Verbose $body
|
Write-Verbose $body
|
||||||
|
$uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier
|
||||||
if ($PSCmdlet.ShouldProcess("Clone Vpg")) {
|
if ($PSCmdlet.ShouldProcess("Clone Vpg")) {
|
||||||
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST"
|
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST"
|
||||||
|
Write-Verbose "Call Submitted to $uri"
|
||||||
|
Write-Verbose "With the following information: $($body | ConvertTo-Json)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
Write-Verbose "Call Submitted to $uri"
|
|
||||||
Write-Verbose "With the following information: $($body | ConvertTo-Json)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ The type of event to return. This filter behaves in the same way as the eventCat
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: All, Events, Alerts
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
@@ -159,6 +160,7 @@ The type of entity for which you wish to return results. Possible Values are: 'V
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: VPG, VRA, Unknown, Site
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
@@ -174,6 +176,7 @@ This filter behaves in the same way as the category filter. If both category and
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: All, Events, Alerts
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ The priority specified for the VPG. Possible values are: 'Low', 'Medium', or 'Hi
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: Low, Medium, High
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ Possible values are: 'Failover', 'Failover Test', or 'Move'
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: Failover, Failover Test, Move
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ The status of the task. Possible values are: 'InProgress', 'Paused', 'Failed', '
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: InProgress, Paused, Failed, Completed, Cancelling
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ The VPG priority. Possible values are: 'Low', 'Medium', 'High'
|
|||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: filter
|
Parameter Sets: filter
|
||||||
Aliases:
|
Aliases:
|
||||||
|
Accepted values: Low, Medium, High
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
|
|||||||
@@ -12,9 +12,19 @@ Commit a VPG currently undergoing a move operation.
|
|||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
### Main (Default)
|
||||||
```
|
```
|
||||||
Invoke-ZertoMoveCommit [-vpgName] <String[]> [-reverseProtection] [-keepSourceVms] [-WhatIf] [-Confirm]
|
Invoke-ZertoMoveCommit -vpgName <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||||
[<CommonParameters>]
|
```
|
||||||
|
|
||||||
|
### ReverseProtect
|
||||||
|
```
|
||||||
|
Invoke-ZertoMoveCommit -vpgName <String[]> [-reverseProtection] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### KeepSource
|
||||||
|
```
|
||||||
|
Invoke-ZertoMoveCommit -vpgName <String[]> [-keepSourceVms] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
@@ -27,20 +37,33 @@ Commit a VPG currently undergoing a move operation.
|
|||||||
PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg"
|
PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg"
|
||||||
```
|
```
|
||||||
|
|
||||||
Commit VPG "MyVpg" after a move has been started.
|
Commit VPG "MyVpg" after a move operation has been completed. This commit process with use the `-KeepSourceVms` or `-ReverseProtection` selection made during the move initation.
|
||||||
|
|
||||||
|
### Example 2
|
||||||
|
```powershell
|
||||||
|
PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg" -keepSourceVms
|
||||||
|
```
|
||||||
|
|
||||||
|
Commit VPG "MyVpg" after a move operation has been completed specifying to keep the vms at the source location and NOT reverse protection. This commit process will overrule any reverse protection or keep source vms selection made during the move initiation.
|
||||||
|
|
||||||
|
### Example 3
|
||||||
|
```powershell
|
||||||
|
PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg" -reverseProtection
|
||||||
|
```
|
||||||
|
|
||||||
|
Commit VPG "MyVpg" after a move operation has been completed specifying to reverse protection of the VMs back to the source location. The VMs at the source location will be removed from inventory at the source location and the disks will be used as pre-seed volumes. This commit process will overrule any reverse protection or keep source vms selection made during the move initiation.
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -keepSourceVms
|
### -keepSourceVms
|
||||||
Use this switch to keep the source VMs.
|
"Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation."
|
||||||
If not set, they will be destroyed.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: SwitchParameter
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: KeepSource
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: False
|
Required: True
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
@@ -48,14 +71,14 @@ Accept wildcard characters: False
|
|||||||
```
|
```
|
||||||
|
|
||||||
### -reverseProtection
|
### -reverseProtection
|
||||||
Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False
|
"Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation."
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: SwitchParameter
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: ReverseProtect
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: False
|
Required: True
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
@@ -71,7 +94,7 @@ Parameter Sets: (All)
|
|||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.4.1
|
1.4.2
|
||||||
|
|||||||
Reference in New Issue
Block a user