Skip to content

Commit

Permalink
[Storage] Support NFS and SmbMultichannel (#15130)
Browse files Browse the repository at this point in the history
* [Storage] Support NFS

* [Storage] Support EnableSmbMultichannel

* fix PR review comments
  • Loading branch information
blueww authored May 28, 2021
1 parent 37e7adc commit 4f75001
Show file tree
Hide file tree
Showing 15 changed files with 2,794 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ public void TestShareSoftDeletee()
public void TestShareSnapshot()
{
TestController.NewInstance.RunPsTest(_logger, "Test-ShareSnapshot");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestFileServiceProperties()
{
TestController.NewInstance.RunPsTest(_logger, "Test-FileServiceProperties");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAzureStorageShareNFS()
{
TestController.NewInstance.RunPsTest(_logger, "Test-AzureStorageShareNFS");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,103 @@ function Test-ShareSnapshot
}
}

<#
.SYNOPSIS
Test Storage File Service Properties
.DESCRIPTION
SmokeTest
#>
function Test-FileServiceProperties
{
# Setup
$rgname = Get-StorageManagementTestResourceName;

try
{
# Test
$stoname = 'sto' + $rgname;
$stotype = 'Premium_LRS';
$loc = Get-ProviderLocation_Canary2 ResourceManagement;
$kind = 'FileStorage'

Write-Verbose "RGName: $rgname | Loc: $loc"
New-AzResourceGroup -Name $rgname -Location $loc;

# $loc = Get-ProviderLocation_Canary ResourceManagement;
New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -Kind $kind
$stos = Get-AzStorageAccount -ResourceGroupName $rgname;

# Enable MC, and set smb setting
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableSmbMultichannel $true
$servicePropertie = Get-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual $true $servicePropertie.ProtocolSettings.Smb.Multichannel.Enabled

# Disable MC, update smb setting
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableSmbMultichannel $false
$servicePropertie = Get-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual $false $servicePropertie.ProtocolSettings.Smb.Multichannel.Enabled

Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Test Azure storage share with NFS
.DESCRIPTION
Smoke[Broken]Test
#>
function Test-AzureStorageShareNFS
{
# Setup
$rgname = Get-StorageManagementTestResourceName;

try
{
# Test
$stoname = 'sto' + $rgname;
$stotype = 'Premium_LRS';
$kind = 'FileStorage'

$loc = Get-ProviderLocation ResourceManagement;
New-AzResourceGroup -Name $rgname -Location $loc;

New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -Kind $kind;
$sto = Get-AzStorageAccount -ResourceGroupName $rgname -Name $stoname;
Assert-AreEqual $stoname $sto.StorageAccountName;
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $kind $sto.Kind;


$shareName = "share"+ $rgname
$sto | New-AzRmStorageShare -Name $shareName -EnabledProtocol NFS -RootSquash RootSquash
$share = $sto | Get-AzRmStorageShare -Name $shareName
Assert-AreEqual $rgname $share.ResourceGroupName
Assert-AreEqual $stoname $share.StorageAccountName
Assert-AreEqual $shareName $share.Name
Assert-AreEqual "NFS" $share.EnabledProtocols
Assert-AreEqual "RootSquash" $share.RootSquash

Update-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName -RootSquash NoRootSquash
$share = $sto | Get-AzRmStorageShare -Name $shareName
Assert-AreEqual $rgname $share.ResourceGroupName
Assert-AreEqual $stoname $share.StorageAccountName
Assert-AreEqual $shareName $share.Name
Assert-AreEqual "NFS" $share.EnabledProtocols
Assert-AreEqual "NoRootSquash" $share.RootSquash

Retry-IfException { Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname; }
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}


Large diffs are not rendered by default.

Loading

0 comments on commit 4f75001

Please sign in to comment.