Fillout FailoverTest options
This commit is contained in:
@@ -2,22 +2,45 @@ function Invoke-ZertoFailoverTest {
|
|||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Name(s) of VPG(s) to roll back from failing over",
|
HelpMessage = "Name of VPG to failover test",
|
||||||
Mandatory = $true
|
Mandatory = $true
|
||||||
)]
|
)]
|
||||||
[string[]]$vpgName
|
[string]$vpgName,
|
||||||
|
[Parameter(
|
||||||
|
HelpMessage = "The identifier of the checkpoint to use for testing. If unspecified, the latest checkpoint will be used."
|
||||||
|
)]
|
||||||
|
[string]$checkpointIdentifier,
|
||||||
|
[Parameter(
|
||||||
|
HelpMessage = "The name(s) of the VMs within the selected VPG you wish to test. If unspecified, all VMs in the VPG will be tested."
|
||||||
|
)]
|
||||||
|
[string[]]$vmName
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
$baseUri = "vpgs"
|
$baseUri = "vpgs"
|
||||||
|
$vpgIdentifier = $(Get-ZertoVpg -name $vpgName).vpgIdentifier
|
||||||
|
if ( $PSBoundParameters.ContainsKey('vmName') ) {
|
||||||
|
$vmIdentifiers = @()
|
||||||
|
$vmIdentifiers = foreach ( $name in $vmName ) {
|
||||||
|
$(Get-ZertoProtectedVm -vmName $name).vmIdentifier
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach ($name in $vpgName) {
|
$uri = "{0}/{1}/FailoverTest" -f $baseUri, $vpgIdentifier
|
||||||
$id = $(Get-ZertoVpg -name $name).vpgIdentifier
|
$body = [ordered]@{}
|
||||||
$uri = "{0}/{1}/FailoverTest" -f $baseUri, $id
|
if ($checkpointIdentifier) {
|
||||||
Invoke-ZertoRestRequest -uri $uri -method "POST"
|
$body['CheckpointIdentifier'] = $checkpointIdentifier
|
||||||
}
|
}
|
||||||
|
if ( $PSBoundParameters.ContainsKey('vmName') ) {
|
||||||
|
$vmIdentifiers = @()
|
||||||
|
$vmIdentifiers = foreach ( $name in $vmName ) {
|
||||||
|
$(Get-ZertoProtectedVm -vmName $name).vmIdentifier
|
||||||
|
}
|
||||||
|
$body['VmIdentifiers'] = $vmIdentifiers
|
||||||
|
}
|
||||||
|
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
|
|||||||
Reference in New Issue
Block a user