Skip to content

Commit fb4c68c

Browse files
committed
tested vm availability sets
1 parent f0f92ed commit fb4c68c

File tree

1 file changed

+8
-7
lines changed
  • AzureBasicLoadBalancerUpgrade/module/AzureBasicLoadBalancerUpgrade/modules/ValidateScenario

1 file changed

+8
-7
lines changed

AzureBasicLoadBalancerUpgrade/module/AzureBasicLoadBalancerUpgrade/modules/ValidateScenario/ValidateScenario.psm1

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ Function Test-SupportedMultiLBScenario {
550550
# check that backend type is not 'empty', meaning there is no reason to use -multiLBConfig
551551
log -Message "[Test-SupportedMultiLBScenario] Checking that backend type is not 'empty' for any of the multi load balancers"
552552
If ($multiLBConfig.scenario.backendType -contains 'Empty') {
553-
log -ErrorAction Stop -Severity 'Error' -Message "[Test-SupportedMultiLBScenario] One or more Basic Load Balancers backend is empty, for which Load Balancers, there no reason to use -multiLBConfig. Use standalone migrations or remove the load balancer with the empty backend from the -multiLBConfig parameter"
553+
log -ErrorAction Stop -Severity 'Error' -Message "[Test-SupportedMultiLBScenario] One or more Basic Load Balancers backend is empty. Empty load balancer should not be included in -multiLBConfig. Use standalone migrations or remove the load balancer with the empty backend from the -multiLBConfig parameter"
554554
return
555555
}
556556

@@ -628,10 +628,10 @@ Function Test-SupportedMultiLBScenario {
628628
$joinedNicIDs = $nicIDs -join ','
629629

630630
$graphQuery = @"
631-
Resources |
631+
resources |
632632
where type =~ 'microsoft.network/networkinterfaces' and id in~ ($joinedNicIDs) |
633633
project lbNicVMId = tolower(tostring(properties.virtualMachine.id)) |
634-
join ( Resources | where type =~ 'microsoft.compute/virtualmachines' | project vmId = tolower(id), availabilitySetId = coalesce(properties.availabilitySet.id, 'NO_AVAILABILITY_SET') on `$left.lbNicVMId == `$right.vmId |
634+
join ( resources | where type =~ 'microsoft.compute/virtualmachines' | project vmId = tolower(id), availabilitySetId = coalesce(properties.availabilitySet.id, 'NO_AVAILABILITY_SET')) on `$left.lbNicVMId == `$right.vmId |
635635
project availabilitySetId
636636
"@
637637

@@ -641,7 +641,7 @@ Function Test-SupportedMultiLBScenario {
641641
$timeoutStopwatch = [System.Diagnostics.Stopwatch]::StartNew()
642642
do {
643643
If (!$waitingForARG) {
644-
log -Message "[UpgradeVMPublicIP] Querying Resource Graph for PIPs associated with VMs in the backend pool(s)..."
644+
log -Message "[UpgradeVMPublicIP] Querying Resource Graph for availability sets of VMs in load balancers backend pools"
645645
}
646646
Else {
647647
log -Message "[UpgradeVMPublicIP] Waiting 15 seconds before querying ARG again (total wait time up to 15 minutes before failure)..."
@@ -657,11 +657,12 @@ Function Test-SupportedMultiLBScenario {
657657
log -Severity Error -Message "[UpgradeVMPublicIP] Resource Graph query timed out before results were returned! The Resource Graph lags behind ARM by several minutes--if the resources to migrate were just created (as in a test), test the query from the log to determine if this was an ingestion lag or synax failure. Once the issue has been corrected follow the steps at https://aka.ms/basiclbupgradefailure to retry the migration." -terminateOnError
658658
}
659659

660-
If (($VMAvailabilitySets | Sort-Object | Get-Unique).count -gt 1) {
661-
log -Severity Error -Message "[Test-SupportedMultiLBScenario] The provided Basic Load Balancers do not share backend pool members (VMs are in differnet Availability Sets). Using -multiLBConfig when backend is not shared adds risk and complexity in recovery." -terminateOnError
660+
# VMs must share an availability set or the backend must be a single VM with no availability set ('NO_AVAILABILITY_SET')
661+
If (($VMAvailabilitySets.availabilitySetId | Sort-Object | Get-Unique).count -gt 1 -or ($VMAvailabilitySets.availabilitySetId | Where-Object {$_ -eq 'NO_AVAILABILITY_SET'}).count -gt 1) {
662+
log -Severity Error -Message "[Test-SupportedMultiLBScenario] The provided Basic Load Balancers do not share backend pool members (VMs are in different or no Availability Sets: '$($VMAvailabilitySets.availabilitySetId -join ',')'). Using -multiLBConfig when backend is not shared adds risk and complexity in recovery." -terminateOnError
662663
}
663664
Else {
664-
log -Message "[Test-SupportedMultiLBScenario] The provided Basic Load Balancers share '$($groupedBackends.count)' backend pool members."
665+
log -Message "[Test-SupportedMultiLBScenario] The provided Basic Load Balancers share '$(($VMAvailabilitySets.availabilitySetId | Sort-Object | Get-Unique).count)' availability set"
665666
}
666667
}
667668

0 commit comments

Comments
 (0)