Skip to content

Commit 010f2d5

Browse files
audunnwyunchi-ms
andauthored
[NetAppFiles]Apply 2021-08-01 Changes (#16855)
* Apply 2021-10-01 Changes * Add example output to md file * Update ChangeLog.md * Singular * Administrators to singular Co-authored-by: Yunchi Wang <[email protected]>
1 parent 559e606 commit 010f2d5

File tree

51 files changed

+29630
-13986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+29630
-13986
lines changed

src/NetAppFiles/NetAppFiles.Test/NetAppFiles.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.14.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.15.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="21.0.0" />
1616
</ItemGroup>
1717

src/NetAppFiles/NetAppFiles.Test/ScenarioTests/BackupTests.ps1

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function Test-BackupCrud
2929
$backupName2 = Get-ResourceName
3030
$backupPolicyName1 = Get-ResourceName
3131
$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
32-
$backupLocation = "eastus2euap"
33-
$backupVNetLocation = "eastus2euap"
32+
$backupLocation = "eastus2"
33+
$backupVNetLocation = "eastus2"
3434
#$backupLocation = "southcentralusstage"
3535
#$backupVNetLocation = "southcentralus"
3636
#$backupLocation = "centralus"
@@ -59,6 +59,12 @@ function Test-BackupCrud
5959
Cifs = $false
6060
Nfsv3 = $true
6161
Nfsv41 = $false
62+
kerberos5ReadOnly = $false
63+
kerberos5ReadWrite = $false
64+
kerberos5iReadOnly = $false
65+
kerberos5iReadWrite = $false
66+
kerberos5pReadOnly = $false
67+
kerberos5pReadWrite = $false
6268
AllowedClients = '0.0.0.0/0'
6369
}
6470
$exportPolicy = @{
@@ -77,11 +83,16 @@ function Test-BackupCrud
7783
do
7884
{
7985
$sourceVolume = Get-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1
80-
Start-Sleep -Seconds 10.0
86+
if ($env:AZURE_TEST_MODE -eq "Record")
87+
{
88+
Start-Sleep -Seconds 10.0
89+
}
8190
$i++
8291
}
8392
until ($sourceVolume.ProvisioningState -eq "Succeeded" -or $i -eq 3);
84-
}
93+
}
94+
95+
8596

8697
function SleepDuringRecord ($seconds = 30.0)
8798
{
@@ -95,7 +106,7 @@ function Test-BackupCrud
95106
try
96107
{
97108
# create the resource group
98-
New-AzResourceGroup -Name $resourceGroup -Location $backupVNetLocation -Tags @{Owner = 'b-aubald'}
109+
New-AzResourceGroup -Name $resourceGroup -Location $backupVNetLocation -Tags @{Owner = 'b-aubald';testTag1='psBackupTagValue1'}
99110

100111
# create virtual network
101112
$virtualNetwork = New-AzVirtualNetwork -ResourceGroupName $resourceGroup -Location $backupVNetLocation -Name $vnetName -AddressPrefix 10.0.0.0/16
@@ -116,7 +127,7 @@ function Test-BackupCrud
116127
$retrievedPool = New-AzNetAppFilesPool -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName1 -PoolName $poolName -PoolSize $poolSize -ServiceLevel $serviceLevel
117128

118129
# create volume and check
119-
$retrievedVolume = New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -CreationToken $volName1 -UsageThreshold $usageThreshold -ServiceLevel $serviceLevel -SubnetId $subnetId -Tag @{$newTagName = $newTagValue} -ExportPolicy $exportPolicy -ProtocolType $protocolTypes
130+
$retrievedVolume = New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -CreationToken $volName1 -UsageThreshold $usageThreshold -ServiceLevel $serviceLevel -SubnetId $subnetId -Tag @{$newTagName = $newTagValue} -ExportPolicy $exportPolicy -ProtocolType $protocolTypes
120131
Assert-AreEqual "$accName1/$poolName/$volName1" $retrievedVolume.Name
121132
Assert-AreEqual $serviceLevel $retrievedVolume.ServiceLevel
122133
Assert-AreEqual True $retrievedVolume.Tags.ContainsKey($newTagName)
@@ -145,6 +156,7 @@ function Test-BackupCrud
145156
# create and check Backup
146157
$retrievedBackup = New-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Name $backupName1 -Label $label
147158
Assert-AreEqual "$accName1/$poolName/$volName1/$backupName1" $retrievedBackup.Name
159+
WaitForBackupSucceeded $backupName1
148160
# service side issue does not return label enable when fixed (ANF-8057)
149161
#Assert-AreEqual $label $retrievedBackup.Label
150162

@@ -166,7 +178,9 @@ function Test-BackupCrud
166178

167179
#create second Backup
168180
$secondBackup = New-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Name $backupName2 -Label $label2
169-
Assert-AreEqual "$accName1/$poolName/$volName1/$backupName2" $secondBackup.Name
181+
Assert-AreEqual "$accName1/$poolName/$volName1/$backupName2" $secondBackup.Name
182+
WaitForBackupSucceeded $backupName2
183+
170184
# service side issue does not return label enable when fixed (ANF-8057)
171185
# Assert-AreEqual $label $secondBackup.Label2
172186

@@ -190,7 +204,8 @@ function Test-BackupCrud
190204
Remove-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Name $backupName1 -WhatIf
191205
$retrievedBackupsList = Get-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1
192206
Assert-AreEqual 2 $retrievedBackupsList.Length
193-
207+
208+
SleepDuringRecord 200
194209
#remove by name
195210
Remove-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Name $backupName1
196211
$retrievedBackupsList = Get-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1
@@ -245,8 +260,8 @@ function Test-BackupPipelines
245260
$usageThreshold = 100 * $gibibyte
246261
$doubleUsage = 2 * $usageThreshold
247262
$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
248-
$backupLocation = "eastus2euap"
249-
$backupVNetLocation = "eastus2euap"
263+
$backupLocation = "eastus2"
264+
$backupVNetLocation = "eastus2"
250265
$subnetName = "default"
251266
$poolSize = 4398046511104
252267
$serviceLevel = "Premium"
@@ -304,7 +319,8 @@ function Test-BackupPipelines
304319
#$retrieveSn = Get-AnfVolume -ResourceGroupName $resourceGroup -AccountName $accName -PoolName $poolName -VolumeName $volName | New-AnfSnapshot -SnapshotName $snName1
305320
$retrievedBackup = Get-AnfVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 | New-AnfBackup -BackupName $backupName1 -Label $label
306321
Assert-AreEqual "$accName1/$poolName/$volName1/$backupName1" $retrievedBackup.Name
307-
SleepDuringRecord 200
322+
323+
WaitForBackupSucceeded $backupName1
308324
# $getRetrievedBackupPolicy = Get-AnfVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -Name $volName1 | Get-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -Name $backupName1
309325

310326
$updateRetrievedBackup = Get-AnfVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -Name $volName1 | Update-AzNetAppFilesBackup -Name $backupName1 -Label $updateLabel
@@ -318,8 +334,8 @@ function Test-BackupPipelines
318334

319335
#create anoter backup
320336
$retrievedBackup = Get-AnfVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 | New-AnfBackup -BackupName $backupName2 -Label $label
321-
Assert-AreEqual "$accName1/$poolName/$volName1/$backupName2" $retrievedBackup.Name
322-
SleepDuringRecord 200
337+
Assert-AreEqual "$accName1/$poolName/$volName1/$backupName2" $retrievedBackup.Name
338+
WaitForBackupSucceeded $backupName2
323339

324340
$retrievedBackups = Get-AnfBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1
325341
Assert-AreEqual 2 $retrievedBackups.Length
@@ -337,7 +353,7 @@ function Test-BackupPipelines
337353
Remove-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1
338354
$retrievedVolumes = Get-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName
339355
Assert-AreEqual 0 $retrievedVolumes.Length
340-
356+
SleepDuringRecord 400
341357
# delete the last backup by piping from AccountBackup get
342358
Get-AnfBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -AccountBackupName $backupName2 | Remove-AnfBackup
343359
SleepDuringRecord 200
@@ -406,6 +422,12 @@ function Test-VolumeBackupStatus
406422
Cifs = $false
407423
Nfsv3 = $true
408424
Nfsv41 = $false
425+
kerberos5ReadOnly = $false
426+
kerberos5ReadWrite = $false
427+
kerberos5iReadOnly = $false
428+
kerberos5iReadWrite = $false
429+
kerberos5pReadOnly = $false
430+
kerberos5pReadWrite = $false
409431
AllowedClients = '0.0.0.0/0'
410432
}
411433

@@ -499,3 +521,17 @@ function Test-VolumeBackupStatus
499521
Clean-ResourceGroup $resourceGroup
500522
}
501523
}
524+
function WaitForBackupSucceeded ($backupName)
525+
{
526+
$i = 0
527+
do
528+
{
529+
$sourceBackup = Get-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Name $backupName
530+
if ($env:AZURE_TEST_MODE -eq "Record")
531+
{
532+
Start-Sleep -Seconds 10.0
533+
}
534+
$i++
535+
}
536+
until ($sourceBackup.ProvisioningState -eq "Succeeded" -or $i -eq 10);
537+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
18+
{
19+
public class QuotaLimitTests
20+
{
21+
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;
22+
23+
public QuotaLimitTests(Xunit.Abstractions.ITestOutputHelper output)
24+
{
25+
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
26+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
27+
}
28+
29+
[Fact]
30+
[Trait(Category.AcceptanceType, Category.CheckIn)]
31+
public void TestQuotaLimit()
32+
{
33+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-QuotaLimit");
34+
}
35+
}
36+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Test QuotaLimits
18+
#>
19+
function Test-QuotaLimit
20+
{
21+
$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
22+
$quotaLimitName = "totalTiBsPerSubscription"
23+
try
24+
{
25+
# get limits list
26+
$retrievedLimits = Get-AzNetAppFilesQuotaLimit -Location $resourceLocation
27+
Assert-NotNull $retrievedLimits
28+
Assert-True {$retrievedLimits.Length -gt 0}
29+
30+
# get limit by name
31+
$retrievedLimit = Get-AzNetAppFilesQuotaLimit -Location $resourceLocation -Name $quotaLimitName
32+
Assert-NotNull $retrievedLimit
33+
Assert-AreEqual "$resourceLocation/$quotaLimitName" $retrievedLimit.Name
34+
}
35+
finally
36+
{
37+
# Cleanup
38+
Clean-ResourceGroup $resourceGroup
39+
}
40+
}

src/NetAppFiles/NetAppFiles.Test/ScenarioTests/SnapshotTests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Test-SnapshotCrud
2424
$resourceGroup = Get-ResourceGroupName
2525
$accName = Get-ResourceName
2626
$poolName = Get-ResourceName
27-
$volName = Get-ResourceName
27+
$volName = Get-ResourceName
2828
$snName1 = Get-ResourceName
2929
$snName2 = Get-ResourceName
3030
$gibibyte = 1024 * 1024 * 1024
@@ -231,8 +231,9 @@ function Test-CreateVolumeFromSnapshot
231231
Assert-AreEqual "$accName/$poolName/$volName/$snName1" $retrievedSnapshotById.Name
232232

233233
# Create volume from snapshot
234-
$restoredVolume = New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $resourceLocation -AccountName $accName -PoolName $poolName -VolumeName $volName -CreationToken $volName -UsageThreshold $usageThreshold -ServiceLevel $serviceLevel -SubnetId $subnetId -SnapshotId $retrievedSnapshot.SnapshotId
235-
Assert-AreEqual $retrievedVolume.Name $restoredVolume.Name
234+
$restoredNewVolume = New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $resourceLocation -AccountName $accName -PoolName $poolName -VolumeName $volName2 -CreationToken $volName2 -UsageThreshold $usageThreshold -ServiceLevel $serviceLevel -SubnetId $subnetId -SnapshotId $retrievedSnapshot.SnapshotId
235+
Assert-NotNull $restoredNewVolume
236+
Assert-AreEqual "$accName/$poolName/$volName2" $restoredNewVolume.Name
236237
}
237238
finally
238239
{
@@ -305,9 +306,8 @@ function Test-RestoreVolumeFromSnapshot
305306
$retrievedSnapshotById = Get-AzNetAppFilesSnapshot -ResourceId $retrievedSnapshot.Id
306307
Assert-AreEqual "$accName/$poolName/$volName/$snName1" $retrievedSnapshotById.Name
307308

308-
# revert the volume from snapshot
309-
Restore-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName -PoolName $poolName -VolumeName $volName -SnapshotId $retrievedSnapshot.SnapshotId
310-
309+
# Restore the volume from snapshot
310+
$restoredVolume = Restore-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName -PoolName $poolName -VolumeName $volName -SnapshotId $retrievedSnapshot.SnapshotId
311311
}
312312
finally
313313
{

src/NetAppFiles/NetAppFiles.Test/ScenarioTests/VolumeTests.ps1

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,18 @@ function Test-VolumeReplication
267267
$doubleUsage = 2 * $usageThreshold
268268
$srcResourceGroupLocation = "westus2"
269269
$destResourceGroupLocation = "eastus"
270-
#$srcResourceLocation = "westus2stage"
270+
271+
#$srcResourceGroupLocation = "eastus2euap"
272+
#$destResourceGroupLocation = "southcentralus"
271273
$srcResourceLocation = "westus2"
272274
$destResourceLocation = "eastus"
275+
#for when using stage regions (southcentralusstage then vnet is created in southcentralus)
276+
$destVnetLocation = "eastus"
277+
278+
#$srcResourceLocation = "eastus2euap"
279+
#$destResourceLocation = "southcentralusstage"
280+
#$destVnetLocation = "southcentralus"
281+
273282
$subnetName = "default"
274283
$poolSize = 4398046511104
275284
$serviceLevel = "Premium"
@@ -311,7 +320,7 @@ function Test-VolumeReplication
311320
Start-Sleep -Seconds 10.0
312321
$i++
313322
}
314-
until ($replicationStatus.MirrorState -eq $targetState -or $i -eq 20);
323+
until ($replicationStatus.MirrorState -eq $targetState -or $i -eq 40);
315324

316325
$replicationStatus = Get-AnfReplicationStatus -ResourceGroupName $destResourceGroup -AccountName $destAccName -PoolName $destPoolName -VolumeName $destVolName
317326
Assert-AreEqual $targetState $replicationStatus.MirrorState
@@ -344,7 +353,7 @@ function Test-VolumeReplication
344353
Add-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $virtualNetwork -AddressPrefix "10.0.2.0/24" -Delegation $delegation | Set-AzVirtualNetwork
345354

346355
# create virtual network destination
347-
$virtualNetwork = New-AzVirtualNetwork -ResourceGroupName $destResourceGroup -Location $destResourceLocation -Name $destVnetName -AddressPrefix 10.0.0.0/16
356+
$virtualNetwork = New-AzVirtualNetwork -ResourceGroupName $destResourceGroup -Location $destVnetLocation -Name $destVnetName -AddressPrefix 10.0.0.0/16
348357
$delegation = New-AzDelegation -Name "netAppVolumes" -ServiceName "Microsoft.Netapp/volumes"
349358
Add-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $virtualNetwork -AddressPrefix "10.0.3.0/24" -Delegation $delegation | Set-AzVirtualNetwork
350359

@@ -436,7 +445,7 @@ function Test-SetVolumePool
436445
$gibibyte = 1024 * 1024 * 1024
437446
$usageThreshold = 100 * $gibibyte
438447
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
439-
$resourceLocation = "westus2"
448+
$resourceLocation = "eastus"
440449
$subnetName = "default"
441450
$poolSize = 4398046511104
442451
$serviceLevel = "Premium"
@@ -543,7 +552,7 @@ function Update-AzNetAppFilesVolumeSnapshotPolicy
543552
$gibibyte = 1024 * 1024 * 1024
544553
$usageThreshold = 100 * $gibibyte
545554
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
546-
$resourceLocation = "westus2"
555+
$resourceLocation = "eastus"
547556
$subnetName = "default"
548557
$poolSize = 4398046511104
549558
$serviceLevel = "Premium"
@@ -658,7 +667,7 @@ function Test-VolumePipelines
658667
$doubleUsage = 2 * $usageThreshold
659668
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
660669
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "westcentralus" -UseCanonical
661-
$resourceLocation = "westus2"
670+
$resourceLocation = "eastus"
662671
$subnetName = "default"
663672
$poolSize = 4398046511104
664673
$serviceLevel = "Premium"

0 commit comments

Comments
 (0)