Skip to content

Commit 7b1f978

Browse files
authored
Add support for PremiumV2_LRS and UltraSSD_LRS target disks (Azure#27257)
1 parent 1cf00b4 commit 7b1f978

File tree

9 files changed

+18034
-3710
lines changed

9 files changed

+18034
-3710
lines changed

src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/A2ATestsHelper.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function getVaultLocation{
3737

3838
function getPrimaryLocation
3939
{
40-
return "EastUS"
40+
return "EastUS2"
4141
}
4242

4343
function getLocationForEZScenario
@@ -52,7 +52,7 @@ function getLocationForEZAzScenario
5252

5353
function getPrimaryZoneLocation
5454
{
55-
return "EastUS"
55+
return "EastUS2"
5656
}
5757

5858
function getPrimaryExtendedLocation
@@ -201,7 +201,7 @@ function createAzureVm{
201201
$stnd = "Standard"
202202
$password=$VMLocalAdminSecurePassword|ConvertTo-SecureString -AsPlainText -Force
203203
$Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $password);
204-
$vm = New-AzVM -Name $VMName -Credential $Credential -location $VMLocation -Image RHELRaw8LVMGen2 -DomainNameLabel $domain -SecurityType $stnd
204+
$vm = New-AzVM -Name $VMName -Credential $Credential -location $VMLocation -Image 'MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest' -DomainNameLabel $domain -SecurityType $stnd
205205
return $vm.Id
206206
}
207207

@@ -255,7 +255,7 @@ function createAzureVmInAvailabilityZone{
255255
$stnd = "Standard"
256256
$password=$VMLocalAdminSecurePassword|ConvertTo-SecureString -AsPlainText -Force
257257
$Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $password);
258-
$vm = New-AzVM -Name $VMName -Credential $Credential -location $VMLocation -Image RHELRaw8LVMGen2 -DomainNameLabel $domain -Zone $VMZone -SecurityType $stnd
258+
$vm = New-AzVM -Name $VMName -Credential $Credential -location $VMLocation -Image 'MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest' -DomainNameLabel $domain -Zone $VMZone -SecurityType $stnd
259259
return $vm.Id
260260
}
261261

@@ -375,16 +375,17 @@ function createCacheStorageAccount{
375375
}
376376

377377
function createCacheStorageAccountForZone{
378-
param([string] $location , [string] $resourceGroup)
378+
param([string] $location , [string] $resourceGroup, [string] $type)
379379

380+
$type = if ($type) { $type } else { 'Standard_LRS' }
380381
$StorageAccountName = getCacheStorageAccountName
381382
$cacheLocation = getPrimaryZoneLocation
382383
$storageRes = getAzureVmName
383384
$storageAccount = New-AzStorageAccount `
384385
-ResourceGroupName $storageRes `
385386
-Location $cacheLocation `
386387
-Name $StorageAccountName `
387-
-Type 'Standard_LRS'
388+
-Type $type
388389
return $storageAccount.Id
389390
}
390391

src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void TestNewA2ADiskReplicationConfig()
4040
"Test-NewA2ADiskReplicationConfiguration");
4141
}
4242

43-
[Fact(Skip = "to be re-recorded in next release")]
43+
[Fact]
4444
[Trait(Category.AcceptanceType, Category.CheckIn)]
4545
public void TestNewA2AManagedDiskReplicationConfig()
4646
{
@@ -50,6 +50,27 @@ public void TestNewA2AManagedDiskReplicationConfig()
5050
"Test-NewA2AManagedDiskReplicationConfiguration");
5151
}
5252

53+
[Fact]
54+
[Trait(Category.AcceptanceType, Category.CheckIn)]
55+
public void TestNewA2AManagedDiskReplicationConfigForPv2()
56+
{
57+
TestRunner.RunTestScript(
58+
$"Import-Module {_helperModule.AsAbsoluteLocation()}",
59+
$"Import-Module {_testModule.AsAbsoluteLocation()}",
60+
"Test-NewA2AManagedDiskReplicationConfigurationForPv2");
61+
}
62+
63+
[Fact]
64+
[Trait(Category.AcceptanceType, Category.CheckIn)]
65+
public void TestNewA2AManagedDiskReplicationConfigForUltraDisk()
66+
{
67+
TestRunner.RunTestScript(
68+
$"Import-Module {_helperModule.AsAbsoluteLocation()}",
69+
$"Import-Module {_testModule.AsAbsoluteLocation()}",
70+
"Test-NewA2AManagedDiskReplicationConfigurationForUltraDisk");
71+
}
72+
73+
5374
[Fact(Skip = "to be re-recorded in next release")]
5475
[Trait(Category.AcceptanceType, Category.CheckIn)]
5576
public void TestNewA2AManagedDiskReplicationConfigWithCmk()

src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,188 @@
1717

1818
##Default Value ##
1919

20+
<#
21+
.SYNOPSIS
22+
NewA2ADiskReplicationConfigurationUltraDisk creation test.
23+
#>
24+
function Test-NewA2AManagedDiskReplicationConfigurationForUltraDisk {
25+
param([string] $seed = '108')
26+
27+
$primaryPolicyName = getPrimaryPolicy
28+
$recoveryPolicyName = getRecoveryPolicy
29+
30+
$primaryContainerMappingName = getPrimaryContainerMapping
31+
$recoveryContainerMappingName = getRecoveryContainerMapping
32+
33+
$primaryContainerName = getPrimaryContainer
34+
$recoveryContainerName = getRecoveryContainer
35+
$vaultRgLocation = getVaultRgLocation
36+
$vaultName = getVaultName
37+
$vaultLocation = getVaultLocation
38+
$vaultRg = getVaultRg
39+
$primaryLocation = getPrimaryLocation
40+
$recoveryLocation = getRecoveryLocation
41+
$primaryFabricName = getPrimaryFabric
42+
$recoveryFabricName = getRecoveryFabric
43+
$RecoveryReplicaDiskAccountType = "Premium_LRS"
44+
$RecoveryTargetDiskAccountType = "UltraSSD_LRS"
45+
$policyName = getPrimaryPolicy
46+
$mappingName = getPrimaryContainerMapping
47+
$primaryNetMapping = getPrimaryNetworkMapping
48+
49+
#create recovery side resources
50+
$recRgName = getRecoveryResourceGroupName
51+
New-AzResourceGroup -name $recRgName -location $recoveryLocation -force
52+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
53+
$RecoveryAzureNetworkId = createRecoveryNetworkId
54+
55+
#create primary
56+
$vmName = getAzureVmName
57+
$v2VmId = createAzureVmInAvailabilityZone
58+
$vm = get-azVm -ResourceGroupName $vmName -Name $vmName
59+
60+
# Stop the VM
61+
Stop-AzVM -Name $vmName -ResourceGroupName $vmName -force
62+
# Enable Ultra Disk compatibility
63+
$vm = Get-AzVM -name $vmName -ResourceGroupName $vmName
64+
Update-AzVM -ResourceGroupName $vmName -VM $vm -UltraSSDEnabled $True
65+
# Start the VM
66+
Start-AzVM -Name $vmName -ResourceGroupName $vmName
67+
68+
#create disk and attach
69+
$diskName = getAzureDataDiskName
70+
$primaryZone = getPrimaryZone
71+
$newDiskConfig = New-AzDiskConfig -SkuName 'UltraSSD_LRS' -Location $vm.Location -CreateOption Empty -DiskSizeGB 20 -Zone $primaryZone
72+
$newDisk = New-AzDisk -ResourceGroupName $vm.ResourceGroupName -DiskName $diskName -Disk $newDiskConfig
73+
$vm = Add-AzVMDataDisk -VM $vm -Name $diskName -CreateOption Attach -ManagedDiskId $newDisk.Id -Lun 1
74+
Update-azVm -ResourceGroupName $vmName -VM $vm
75+
76+
77+
$logStg = createCacheStorageAccountForZone($vm.Location, $vm.ReservationGroupName, "Premium_LRS")
78+
$dataDiskId = $vm.StorageProfile.DataDisks[0].ManagedDisk.Id
79+
$index = $v2VmId.IndexOf("/providers/")
80+
$Rg = $v2VmId.Substring(0, $index)
81+
$PrimaryAzureNetworkId = $Rg + "/providers/Microsoft.Network/virtualNetworks/" + $vmName
82+
83+
# vault Creation
84+
New-AzResourceGroup -name $vaultRg -location $vaultRgLocation -force
85+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
86+
New-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName -Location $vaultLocation
87+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
88+
$Vault = Get-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName
89+
Set-ASRVaultContext -Vault $Vault
90+
91+
# fabric Creation
92+
$fabJob = New-AzRecoveryServicesAsrFabric -Azure -Name $primaryFabricName -Location $primaryLocation
93+
WaitForJobCompletion -JobId $fabJob.Name
94+
$fab = Get-AzRecoveryServicesAsrFabric -Name $primaryFabricName
95+
Assert-true { $fab.name -eq $primaryFabricName }
96+
Assert-AreEqual $fab.FabricSpecificDetails.Location $primaryLocation
97+
98+
$fabJob = New-AzRecoveryServicesAsrFabric -Azure -Name $recoveryFabricName -Location $recoveryLocation
99+
WaitForJobCompletion -JobId $fabJob.Name
100+
$fab = Get-AzRecoveryServicesAsrFabric -Name $recoveryFabricName
101+
Assert-true { $fab.name -eq $recoveryFabricName }
102+
Assert-AreEqual $fab.FabricSpecificDetails.Location $recoveryLocation
103+
$pf = get-asrFabric -Name $primaryFabricName
104+
$rf = get-asrFabric -Name $recoveryFabricName
105+
106+
$RecoveryResourceGroupId = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/" + $recRgName
107+
108+
$v = New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig -ManagedDisk -LogStorageAccountId $logStg `
109+
-DiskId $dataDiskId -RecoveryResourceGroupId $RecoveryResourceGroupId -RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType `
110+
-RecoveryTargetDiskAccountType $RecoveryTargetDiskAccountType
111+
112+
Assert-True { $v.DiskId -eq $dataDiskId }
113+
}
114+
115+
<#
116+
.SYNOPSIS
117+
NewA2ADiskReplicationConfigurationPv2 creation test.
118+
#>
119+
function Test-NewA2AManagedDiskReplicationConfigurationForPv2 {
120+
param([string] $seed = '107')
121+
122+
$primaryPolicyName = getPrimaryPolicy
123+
$recoveryPolicyName = getRecoveryPolicy
124+
125+
$primaryContainerMappingName = getPrimaryContainerMapping
126+
$recoveryContainerMappingName = getRecoveryContainerMapping
127+
128+
$primaryContainerName = getPrimaryContainer
129+
$recoveryContainerName = getRecoveryContainer
130+
$vaultRgLocation = getVaultRgLocation
131+
$vaultName = getVaultName
132+
$vaultLocation = getVaultLocation
133+
$vaultRg = getVaultRg
134+
$primaryLocation = getPrimaryLocation
135+
$recoveryLocation = getRecoveryLocation
136+
$primaryFabricName = getPrimaryFabric
137+
$recoveryFabricName = getRecoveryFabric
138+
$RecoveryReplicaDiskAccountType = "Premium_LRS"
139+
$RecoveryTargetDiskAccountType = "PremiumV2_LRS"
140+
$policyName = getPrimaryPolicy
141+
$mappingName = getPrimaryContainerMapping
142+
$primaryNetMapping = getPrimaryNetworkMapping
143+
144+
#create recovery side resources
145+
$recRgName = getRecoveryResourceGroupName
146+
New-AzResourceGroup -name $recRgName -location $recoveryLocation -force
147+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
148+
$RecoveryAzureNetworkId = createRecoveryNetworkId
149+
150+
#create primary
151+
$vmName = getAzureVmName
152+
$v2VmId = createAzureVmInAvailabilityZone
153+
$vm = get-azVm -ResourceGroupName $vmName -Name $vmName
154+
155+
#create disk and attach
156+
$diskName = getAzureDataDiskName
157+
$primaryZone = getPrimaryZone
158+
$newDiskConfig = New-AzDiskConfig -SkuName 'PremiumV2_LRS' -Location $vm.Location -CreateOption Empty -DiskSizeGB 20 -Zone $primaryZone
159+
$newDisk = New-AzDisk -ResourceGroupName $vm.ResourceGroupName -DiskName $diskName -Disk $newDiskConfig
160+
$vm = Add-AzVMDataDisk -VM $vm -Name $diskName -CreateOption Attach -ManagedDiskId $newDisk.Id -Lun 1
161+
Update-azVm -ResourceGroupName $vmName -VM $vm
162+
163+
164+
$logStg = createCacheStorageAccountForZone($vm.Location, $vm.ReservationGroupName, "Premium_LRS")
165+
$dataDiskId = $vm.StorageProfile.DataDisks[0].ManagedDisk.Id
166+
$index = $v2VmId.IndexOf("/providers/")
167+
$Rg = $v2VmId.Substring(0, $index)
168+
$PrimaryAzureNetworkId = $Rg + "/providers/Microsoft.Network/virtualNetworks/" + $vmName
169+
170+
# vault Creation
171+
New-AzResourceGroup -name $vaultRg -location $vaultRgLocation -force
172+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
173+
New-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName -Location $vaultLocation
174+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
175+
$Vault = Get-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName
176+
Set-ASRVaultContext -Vault $Vault
177+
178+
# fabric Creation
179+
$fabJob = New-AzRecoveryServicesAsrFabric -Azure -Name $primaryFabricName -Location $primaryLocation
180+
WaitForJobCompletion -JobId $fabJob.Name
181+
$fab = Get-AzRecoveryServicesAsrFabric -Name $primaryFabricName
182+
Assert-true { $fab.name -eq $primaryFabricName }
183+
Assert-AreEqual $fab.FabricSpecificDetails.Location $primaryLocation
184+
185+
$fabJob = New-AzRecoveryServicesAsrFabric -Azure -Name $recoveryFabricName -Location $recoveryLocation
186+
WaitForJobCompletion -JobId $fabJob.Name
187+
$fab = Get-AzRecoveryServicesAsrFabric -Name $recoveryFabricName
188+
Assert-true { $fab.name -eq $recoveryFabricName }
189+
Assert-AreEqual $fab.FabricSpecificDetails.Location $recoveryLocation
190+
$pf = get-asrFabric -Name $primaryFabricName
191+
$rf = get-asrFabric -Name $recoveryFabricName
192+
193+
$RecoveryResourceGroupId = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/" + $recRgName
194+
195+
$v = New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig -ManagedDisk -LogStorageAccountId $logStg `
196+
-DiskId $dataDiskId -RecoveryResourceGroupId $RecoveryResourceGroupId -RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType `
197+
-RecoveryTargetDiskAccountType $RecoveryTargetDiskAccountType
198+
199+
Assert-True { $v.DiskId -eq $dataDiskId }
200+
}
201+
20202
<#
21203
.SYNOPSIS
22204
NewA2ADiskReplicationConfiguration creation test.

0 commit comments

Comments
 (0)