зеркало из https://github.com/microsoft/lisa.git
Merge pull request #16 from iamshital/master
XFS Tests + Scripts required to support CustomVHD testing.
This commit is contained in:
Коммит
e67a6dc101
|
@ -7,3 +7,4 @@ TestConfiguration.xml
|
|||
Temp*
|
||||
report*
|
||||
UploadStatusFile*
|
||||
*.azure.env
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
param
|
||||
(
|
||||
$TestByTestName="",
|
||||
$TestByCategorizedTestName="",
|
||||
$TestByCategory="",
|
||||
$TestByTag=""
|
||||
)
|
||||
Get-ChildItem .\Libraries -Recurse | Where-Object { $_.FullName.EndsWith(".psm1") } | ForEach-Object { Import-Module $_.FullName -Force -Global }
|
||||
|
||||
$TestRegions = @()
|
||||
|
||||
if ( $TestByTestName )
|
||||
{
|
||||
foreach( $Test in $TestByTestName.Split(","))
|
||||
{
|
||||
$TestRegions += $Test.Split(">>")[$Test.Split(">>").Count - 1]
|
||||
}
|
||||
}
|
||||
if ( $TestByCategorizedTestName )
|
||||
{
|
||||
foreach( $Test in $TestByCategorizedTestName.Split(","))
|
||||
{
|
||||
$TestRegions += $Test.Split(">>")[$Test.Split(">>").Count - 1]
|
||||
}
|
||||
}
|
||||
if ( $TestByTag )
|
||||
{
|
||||
foreach( $Test in $TestByTag.Split(","))
|
||||
{
|
||||
$TestRegions += $Test.Split(">>")[$Test.Split(">>").Count - 1]
|
||||
}
|
||||
}
|
||||
|
||||
$UniqueTestRegions = $TestRegions | Get-Unique
|
||||
LogMsg "Selected test regions:"
|
||||
$i = 1
|
||||
$CurrentTestRegions = ""
|
||||
Set-Content -Value "" -Path .\CurrentTestRegions.azure.env -Force -NoNewline
|
||||
$UniqueTestRegions | ForEach-Object { LogMsg "$i. $_"; $i += 1; $CurrentTestRegions += "$_," }
|
||||
Set-Content -Value $CurrentTestRegions.TrimEnd(",") -Path .\CurrentTestRegions.azure.env -Force -NoNewline -Verbose
|
|
@ -0,0 +1,109 @@
|
|||
Param (
|
||||
$RemoteFolder = "Z:\ReceivedFiles",
|
||||
$LocalFolder = "D:\Temp"
|
||||
)
|
||||
|
||||
Get-ChildItem .\Libraries -Recurse | Where-Object { $_.FullName.EndsWith(".psm1") } | ForEach-Object { Import-Module $_.FullName -Force -Global }
|
||||
|
||||
$CurrentRemoteFolder = "$RemoteFolder\$env:JenkinsUser"
|
||||
$CurrentLocalFolder = "$LocalFolder"
|
||||
|
||||
$ExitCode = 0
|
||||
try
|
||||
{
|
||||
$7zExePath = (Get-Item .\Tools\7za.exe).FullName
|
||||
|
||||
#Prerequisites:
|
||||
if (!(Test-Path $CurrentLocalFolder))
|
||||
{
|
||||
New-Item -Path $CurrentLocalFolder -ItemType Directory -Force | Out-Null
|
||||
}
|
||||
LogMsg "Directory : $CurrentLocalFolder is available."
|
||||
|
||||
#region VALIDATE ARGUMENTS
|
||||
if ( $env:CustomVHD)
|
||||
{
|
||||
if ( ($env:CustomVHD).EndsWith(".xz") -or ($env:CustomVHD).EndsWith(".vhd") -or ($env:CustomVHD).EndsWith(".vhdx"))
|
||||
{
|
||||
$ReceivedFile = "$env:UpstreamBuildNumber-$env:CustomVHD"
|
||||
LogMsg "Copying $ReceivedFile --> $CurrentLocalFolder."
|
||||
Copy-Item -Path "$CurrentRemoteFolder\$ReceivedFile" -Destination "$CurrentLocalFolder\$ReceivedFile" -Force
|
||||
if ($ReceivedFile.EndsWith(".xz"))
|
||||
{
|
||||
$WorkingDirectory = (Get-Location).Path
|
||||
Set-Location $CurrentLocalFolder
|
||||
LogMsg "Detected *.xz file."
|
||||
LogMsg "Extracting '$ReceivedFile'. Please wait..."
|
||||
$7zConsoleOuput = Invoke-Expression -Command "$7zExePath -y x '$ReceivedFile';" -Verbose
|
||||
if ($7zConsoleOuput -imatch "Everything is Ok")
|
||||
{
|
||||
LogMsg "Extraction completed."
|
||||
$NewVHDName = $(($ReceivedFile).TrimEnd("xz").TrimEnd("."))
|
||||
LogMsg "Changing working directory to $WorkingDirectory"
|
||||
Set-Location $WorkingDirectory
|
||||
$VhdActualSize = ($7zConsoleOuput -imatch "size").Replace(" ",'').Replace(" ",'').Replace(" ",'').Replace(" ",'').Split(":")[1]
|
||||
$VhdCompressedSize = ($7zConsoleOuput -imatch "Compressed").Replace(" ",'').Replace(" ",'').Replace(" ",'').Replace(" ",'').Split(":")[1]
|
||||
$CompressinRatio = ((($VhdCompressedSize/($VhdActualSize-$VhdCompressedSize))*100))
|
||||
LogMsg "Compression Ratio : $([math]::Round($CompressinRatio,2))%"
|
||||
}
|
||||
else
|
||||
{
|
||||
$ExitCode += 1
|
||||
ThrowException "Failed to extract $ReceivedFile."
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$NewVHDName = $ReceivedFile
|
||||
}
|
||||
if ($NewVHDName.EndsWith(".vhdx"))
|
||||
{
|
||||
$WorkingDirectory = $pwd
|
||||
Set-Location $CurrentLocalFolder
|
||||
$NewVHDxName = $NewVHDName
|
||||
$NewVHDName = $NewVHDxName.Replace(".vhdx",".vhd")
|
||||
LogMsg "Converting '$NewVHDxName' --> '$NewVHDName'. [VHDx to VHD]"
|
||||
$convertJob = Start-Job -ScriptBlock { Convert-VHD -Path $args[0] -DestinationPath $args[1] -VHDType Dynamic } -ArgumentList "$CurrentLocalFolder\$NewVHDxName", "$CurrentLocalFolder\$NewVHDName"
|
||||
while ($convertJob.State -eq "Running")
|
||||
{
|
||||
LogMsg "'$NewVHDxName' --> '$NewVHDName' is running"
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
if ( $convertJob.State -eq "Completed")
|
||||
{
|
||||
LogMsg "'$NewVHDxName' --> '$NewVHDName' is Succeeded."
|
||||
$ExitCode = 0
|
||||
LogMsg "Removing '$NewVHDxName'..."
|
||||
Remove-Item "$CurrentLocalFolder\$NewVHDxName" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "'$NewVHDxName' --> '$NewVHDName' is Failed."
|
||||
$ExitCode += 1
|
||||
}
|
||||
Set-Location $WorkingDirectory
|
||||
}
|
||||
ValidateVHD -vhdPath "$CurrentLocalFolder\$NewVHDName"
|
||||
}
|
||||
else
|
||||
{
|
||||
$FileExtension = [System.IO.Path]::GetExtension("$env:CustomVHD")
|
||||
LogError "Unsupported file type: *$FileExtension"
|
||||
$ExitCode += 1
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError "Did you forgot to provide value for 'CustomVHD' parameter?"
|
||||
$ExitCode = 1
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
ThrowException($_)
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMsg "Exiting with code : $ExitCode"
|
||||
exit $ExitCode
|
||||
}
|
|
@ -2630,6 +2630,42 @@ function ZipFiles( $zipfilename, $sourcedir )
|
|||
cd $currentDir
|
||||
if ($out -match "Everything is Ok")
|
||||
{
|
||||
Write-Host "$currentDir\$zipfilename created successfully."
|
||||
LogMsg "$currentDir\$zipfilename created successfully."
|
||||
}
|
||||
}
|
||||
|
||||
Function GetStorageAccountFromRegion($Region,$StorageAccount)
|
||||
{
|
||||
#region Select Storage Account Type
|
||||
$RegionName = $Region.Replace(" ","").Replace('"',"").ToLower()
|
||||
$regionStorageMapping = [xml](Get-Content .\XML\RegionAndStorageAccounts.xml)
|
||||
if ($StorageAccount)
|
||||
{
|
||||
if ( $StorageAccount -imatch "ExistingStorage_Standard" )
|
||||
{
|
||||
$StorageAccountName = $regionStorageMapping.AllRegions.$RegionName.StandardStorage
|
||||
}
|
||||
elseif ( $StorageAccount -imatch "ExistingStorage_Premium" )
|
||||
{
|
||||
$StorageAccountName = $regionStorageMapping.AllRegions.$RegionName.PremiumStorage
|
||||
}
|
||||
elseif ( $StorageAccount -imatch "NewStorage_Standard" )
|
||||
{
|
||||
$StorageAccountName = "NewStorage_Standard_LRS"
|
||||
}
|
||||
elseif ( $StorageAccount -imatch "NewStorage_Premium" )
|
||||
{
|
||||
$StorageAccountName = "NewStorage_Premium_LRS"
|
||||
}
|
||||
elseif ($StorageAccount -eq "")
|
||||
{
|
||||
$StorageAccountName = $regionStorageMapping.AllRegions.$RegionName.StandardStorage
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$StorageAccountName = $regionStorageMapping.AllRegions.$RegionName.StandardStorage
|
||||
}
|
||||
LogMsg "Selected : $StorageAccountName"
|
||||
return $StorageAccountName
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
#!/bin/bash
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Linux on Hyper-V and Azure Test Code, ver. 1.0.0
|
||||
# Copyright (c) Microsoft Corporation
|
||||
#
|
||||
# All rights reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the ""License"");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
# OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
# ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
|
||||
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
#
|
||||
# See the Apache Version 2.0 License for specific language governing
|
||||
# permissions and limitations under the License.
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# perf_xfstesting.sh
|
||||
# Author : SHITAL SAVEKAR <v-shisav@microsoft.com>
|
||||
#
|
||||
# Description:
|
||||
# Download and run IPERF3 network performance tests.
|
||||
# This script needs to be run on client VM.
|
||||
#
|
||||
# Supported Distros:
|
||||
# Ubuntu 16.04
|
||||
# Supported Filesystems : ext4, xfs
|
||||
|
||||
#######################################################################
|
||||
|
||||
while echo $1 | grep ^- > /dev/null; do
|
||||
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
XFSTestConfigFile="xfstests-config.config"
|
||||
touch /root/XFSTestingConsole.log
|
||||
|
||||
LogMsg()
|
||||
{
|
||||
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
|
||||
echo "${1}" >> /root/XFSTestingConsole.log
|
||||
}
|
||||
|
||||
InstallXFSTestTools()
|
||||
{
|
||||
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux\|clear-linux-os" /etc/{issue,*release,*version} /usr/lib/os-release`
|
||||
if [[ $DISTRO =~ "Ubuntu" ]] || [[ $DISTRO =~ "Debian" ]];
|
||||
then
|
||||
LogMsg "Detected Ubuntu/Debian. Installing required packages..."
|
||||
until dpkg --force-all --configure -a; sleep 10; do echo 'Trying again...'; done
|
||||
apt-get update
|
||||
apt-get -y install gcc xfslibs-dev uuid-dev libtool xfsprogs e2fsprogs automake libuuid1 libuuidm-ocaml-dev attr libattr1-dev libacl1-dev libaio-dev gawk xfsprogs libgdbm-dev quota fio dbench bc make dos2unix
|
||||
git clone git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
|
||||
mv xfstests-dev xfstests
|
||||
cd xfstests
|
||||
./configure
|
||||
make
|
||||
cd ..
|
||||
LogMsg "Packages installation complete."
|
||||
else
|
||||
LogMsg "Unknown Distro"
|
||||
exit 10
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -e ${XFSTestConfigFile} ]; then
|
||||
LogMsg "${XFSTestConfigFile} File is present."
|
||||
else
|
||||
errMsg="Error: missing ${XFSTestConfigFile} file"
|
||||
LogMsg "${errMsg}"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
#Configure XFS Tools
|
||||
InstallXFSTestTools
|
||||
|
||||
dos2unix ${XFSTestConfigFile}
|
||||
cp -f ${XFSTestConfigFile} ./xfstests/local.config
|
||||
|
||||
mkdir -p /root/ext4
|
||||
mkdir -p /root/xfs
|
||||
|
||||
#RunTests
|
||||
if [[ $TestFileSystem == "cifs" ]];
|
||||
then
|
||||
mkdir -p /test1
|
||||
cd xfstests
|
||||
#Download Exclusion files
|
||||
wget https://wiki.samba.org/images/d/db/Xfstests.exclude.very-slow.txt -O tests/cifs/exclude.very-slow
|
||||
wget https://wiki.samba.org/images/b/b0/Xfstests.exclude.incompatible-smb3.txt -O tests/cifs/exclude.incompatible-smb3
|
||||
|
||||
./check -s $TestFileSystem -E tests/cifs/exclude.incompatible-smb3 -E tests/cifs/exclude.very-slow >> /root/XFSTestingConsole.log
|
||||
cd ..
|
||||
elif [[ $TestFileSystem == "ext4" ]] || [[ $TestFileSystem == "xfs" ]];
|
||||
then
|
||||
LogMsg "Formatting /dev/sdc with ${TestFileSystem}"
|
||||
if [[ $TestFileSystem == "xfs" ]];
|
||||
then
|
||||
mkfs.xfs -f /dev/sdc
|
||||
else
|
||||
echo y | mkfs -t $TestFileSystem /dev/sdc
|
||||
fi
|
||||
mkdir -p /test2
|
||||
cd xfstests
|
||||
LogMsg "Runnint tests for $TestFileSystem file system"
|
||||
./check -s $TestFileSystem >> /root/XFSTestingConsole.log
|
||||
cd ..
|
||||
else
|
||||
LogMsg "$TestFileSystem is not supported."
|
||||
fi
|
||||
LogMsg "TestCompleted"
|
|
@ -0,0 +1,10 @@
|
|||
[ext4]
|
||||
FSTYP=ext4
|
||||
TEST_DEV=/dev/sdc
|
||||
TEST_DIR=/root/ext4
|
||||
TEST_FS_MOUNT_OPTS='-o nobarrier'
|
||||
[xfs]
|
||||
FSTYP=ext4
|
||||
TEST_DEV=/dev/sdc
|
||||
TEST_DIR=/root/xfs
|
||||
TEST_FS_MOUNT_OPTS='-o nobarrier'
|
|
@ -0,0 +1,67 @@
|
|||
$result = ""
|
||||
$testResult = ""
|
||||
$resultArr = @()
|
||||
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
|
||||
if ($isDeployed)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
|
||||
RemoteCopy -uploadTo $allVMData.PublicIP -port $allVMData.SSHPort -files $currentTestData.files -username "root" -password $password -upload
|
||||
|
||||
$out = RunLinuxCmd -ip $allVMData.PublicIP -port $allVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
|
||||
$TestFileSystem = $currentTestData.TestParameters.param.Replace("TestFileSystem=","")
|
||||
$testJob = RunLinuxCmd -ip $allVMData.PublicIP -port $allVMData.SSHPort -username "root" -password $password -command "/root/perf_xfstesting.sh -TestFileSystem $TestFileSystem" -RunInBackground
|
||||
#endregion
|
||||
|
||||
#region MONITOR TEST
|
||||
while ( (Get-Job -Id $testJob).State -eq "Running" )
|
||||
{
|
||||
$currentStatus = RunLinuxCmd -ip $allVMData.PublicIP -port $allVMData.SSHPort -username "root" -password $password -command "tail -1 XFSTestingConsole.log"
|
||||
LogMsg "Current Test Staus : $currentStatus"
|
||||
WaitFor -seconds 20
|
||||
}
|
||||
RemoteCopy -download -downloadFrom $allVMData.PublicIP -files "XFSTestingConsole.log" -downloadTo $LogDir -port $allVMData.SSHPort -username "root" -password $password
|
||||
$XFSTestingConsole = Get-Content "$LogDir\XFSTestingConsole.log"
|
||||
if ( $XFSTestingConsole -imatch "Passed all" )
|
||||
{
|
||||
$testResult = "PASS"
|
||||
}
|
||||
else
|
||||
{
|
||||
$testResult = "FAIL"
|
||||
}
|
||||
foreach ( $line in $XFSTestingConsole.Split("`n"))
|
||||
{
|
||||
LogMsg "$line"
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
$metaData = ""
|
||||
if (!$testResult)
|
||||
{
|
||||
$testResult = "Aborted"
|
||||
}
|
||||
$resultArr += $testResult
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$testResult = "FAIL"
|
||||
$resultArr += $testResult
|
||||
}
|
||||
|
||||
$result = GetFinalResultHeader -resultarr $resultArr
|
||||
|
||||
#Clean up the setup
|
||||
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
|
||||
|
||||
#Return the result and summery to the test suite script..
|
||||
return $result
|
|
@ -41,7 +41,7 @@ if ($env:Azure_Secrets_File) {
|
|||
}
|
||||
if ( $secretsFile -eq $null ) {
|
||||
LogMsg "ERROR: Azure Secrets file not found in Jenkins / user not provided -customSecretsFilePath" -ForegroundColor Red -BackgroundColor Black
|
||||
exit 1
|
||||
ThrowException ("XML Secrets file not provided")
|
||||
}
|
||||
|
||||
#---------------------------------------------------------[Script Start]--------------------------------------------------------
|
||||
|
@ -71,5 +71,5 @@ if ( Test-Path $secretsFile ) {
|
|||
else {
|
||||
LogMsg "$($secretsFile | Spilt-Path -Leaf) file is not added in Jenkins Global Environments OR it is not bound to 'Azure_Secrets_File' variable." -ForegroundColor Red -BackgroundColor Black
|
||||
LogMsg "Aborting."-ForegroundColor Red -BackgroundColor Black
|
||||
exit 1
|
||||
ThrowException ("XML Secrets file not provided")
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
|
||||
|
||||
param
|
||||
(
|
||||
[string]$sourceLocation,
|
||||
[string]$destinationLocations,
|
||||
[string]$destinationAccountType,
|
||||
[string]$sourceVHDName,
|
||||
[string]$destinationVHDName
|
||||
)
|
||||
|
||||
Get-ChildItem .\Libraries -Recurse | Where-Object { $_.FullName.EndsWith(".psm1") } | ForEach-Object { Import-Module $_.FullName -Force -Global }
|
||||
|
||||
try
|
||||
{
|
||||
if (!$destinationVHDName)
|
||||
{
|
||||
$destinationVHDName = $sourceVHDName
|
||||
}
|
||||
if (!$destinationAccountType)
|
||||
{
|
||||
$destinationAccountType="Standard,Premium"
|
||||
}
|
||||
|
||||
$RegionName = $sourceLocation.Replace(" ","").Replace('"',"").ToLower()
|
||||
$RegionStorageMapping = [xml](Get-Content .\XML\RegionAndStorageAccounts.xml)
|
||||
$SourceStorageAccountName = $RegionStorageMapping.AllRegions.$RegionName.StandardStorage
|
||||
|
||||
#region Collect current VHD, Storage Account and Key
|
||||
$saInfoCollected = $false
|
||||
$retryCount = 0
|
||||
$maxRetryCount = 999
|
||||
while(!$saInfoCollected -and ($retryCount -lt $maxRetryCount))
|
||||
{
|
||||
try
|
||||
{
|
||||
$retryCount += 1
|
||||
LogMsg "[Attempt $retryCount/$maxRetryCount] : Getting Storage Account details ..."
|
||||
$GetAzureRMStorageAccount = $null
|
||||
$GetAzureRMStorageAccount = Get-AzureRmStorageAccount
|
||||
if ($GetAzureRMStorageAccount -eq $null)
|
||||
{
|
||||
$saInfoCollected = $false
|
||||
}
|
||||
else
|
||||
{
|
||||
$saInfoCollected = $true
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
LogErr "Error in fetching Storage Account info. Retrying in 10 seconds."
|
||||
sleep -Seconds 10
|
||||
$saInfoCollected = $false
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
$currentVHDName = $sourceVHDName
|
||||
$testStorageAccount = $SourceStorageAccountName
|
||||
$testStorageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $(($GetAzureRmStorageAccount | Where {$_.StorageAccountName -eq "$testStorageAccount"}).ResourceGroupName) -Name $testStorageAccount)[0].Value
|
||||
|
||||
$targetRegions = (Get-AzureRmLocation).Location
|
||||
if ($destinationLocations)
|
||||
{
|
||||
$targetRegions = $destinationLocations.Split(",")
|
||||
}
|
||||
else
|
||||
{
|
||||
$targetRegions = (Get-AzureRmLocation).Location
|
||||
}
|
||||
$targetStorageAccounts = @()
|
||||
foreach ($newRegion in $targetRegions)
|
||||
{
|
||||
if ( $destinationAccountType -imatch "Standard")
|
||||
{
|
||||
$targetStorageAccounts += $RegionStorageMapping.AllRegions.$newRegion.StandardStorage
|
||||
}
|
||||
if ( $destinationAccountType -imatch "Premium")
|
||||
{
|
||||
$targetStorageAccounts += $RegionStorageMapping.AllRegions.$newRegion.PremiumStorage
|
||||
}
|
||||
}
|
||||
$destContextArr = @()
|
||||
foreach ($targetSA in $targetStorageAccounts)
|
||||
{
|
||||
#region Copy as Latest VHD
|
||||
[string]$SrcStorageAccount = $testStorageAccount
|
||||
[string]$SrcStorageBlob = $currentVHDName
|
||||
$SrcStorageAccountKey = $testStorageAccountKey
|
||||
$SrcStorageContainer = "vhds"
|
||||
|
||||
[string]$DestAccountName = $targetSA
|
||||
[string]$DestBlob = $destinationVHDName
|
||||
$DestAccountKey= (Get-AzureRmStorageAccountKey -ResourceGroupName $(($GetAzureRmStorageAccount | Where {$_.StorageAccountName -eq "$targetSA"}).ResourceGroupName) -Name $targetSA)[0].Value
|
||||
$DestContainer = "vhds"
|
||||
$context = New-AzureStorageContext -StorageAccountName $srcStorageAccount -StorageAccountKey $srcStorageAccountKey
|
||||
$expireTime = Get-Date
|
||||
$expireTime = $expireTime.AddYears(1)
|
||||
$SasUrl = New-AzureStorageBlobSASToken -container $srcStorageContainer -Blob $srcStorageBlob -Permission R -ExpiryTime $expireTime -FullUri -Context $Context
|
||||
|
||||
#
|
||||
# Start Replication to DogFood
|
||||
#
|
||||
|
||||
$destContext = New-AzureStorageContext -StorageAccountName $destAccountName -StorageAccountKey $destAccountKey
|
||||
$testContainer = Get-AzureStorageContainer -Name $destContainer -Context $destContext -ErrorAction Ignore
|
||||
if ($testContainer -eq $null) {
|
||||
New-AzureStorageContainer -Name $destContainer -context $destContext
|
||||
}
|
||||
# Start the Copy
|
||||
if (($SrcStorageAccount -eq $DestAccountName) -and ($SrcStorageBlob -eq $DestBlob))
|
||||
{
|
||||
LogMsg "Skipping copy for : $DestAccountName as source storage account and VHD name is same."
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "Copying $SrcStorageBlob as $DestBlob from and to storage account $DestAccountName/$DestContainer"
|
||||
$out = Start-AzureStorageBlobCopy -AbsoluteUri $SasUrl -DestContainer $destContainer -DestContext $destContext -DestBlob $destBlob -Force
|
||||
$destContextArr += $destContext
|
||||
}
|
||||
}
|
||||
#
|
||||
# Monitor replication status
|
||||
#
|
||||
$CopyingInProgress = $true
|
||||
while($CopyingInProgress)
|
||||
{
|
||||
$CopyingInProgress = $false
|
||||
$newDestContextArr = @()
|
||||
foreach ($destContext in $destContextArr)
|
||||
{
|
||||
$status = Get-AzureStorageBlobCopyState -Container $destContainer -Blob $destBlob -Context $destContext
|
||||
if ($status.Status -eq "Success")
|
||||
{
|
||||
LogMsg "$DestBlob : $($destContext.StorageAccountName) : Done : 100 %"
|
||||
}
|
||||
elseif ($status.Status -eq "Failed")
|
||||
{
|
||||
LogMsg "$DestBlob : $($destContext.StorageAccountName) : Failed."
|
||||
}
|
||||
elseif ($status.Status -eq "Pending")
|
||||
{
|
||||
sleep -Milliseconds 100
|
||||
$CopyingInProgress = $true
|
||||
$newDestContextArr += $destContext
|
||||
$copyPercent = [math]::Round((($status.BytesCopied/$status.TotalBytes) * 100),2)
|
||||
LogMsg "$DestBlob : $($destContext.StorageAccountName) : Running : $copyPercent %"
|
||||
}
|
||||
}
|
||||
if ($CopyingInProgress)
|
||||
{
|
||||
LogMsg "--------$($newDestContextArr.Count) copy operations still in progress.-------"
|
||||
$destContextArr = $newDestContextArr
|
||||
Sleep -Seconds 10
|
||||
}
|
||||
$ExitCode = 0
|
||||
}
|
||||
LogMsg "All Copy Operations completed successfully."
|
||||
}
|
||||
catch
|
||||
{
|
||||
$ExitCode = 1
|
||||
ThrowExcpetion ($_)
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMsg "Exiting with code: $ExitCode"
|
||||
exit $ExitCode
|
||||
}
|
||||
#endregion
|
|
@ -0,0 +1,74 @@
|
|||
Param
|
||||
(
|
||||
|
||||
#Mandatory parameters
|
||||
[string]$VHDPath="",
|
||||
[string]$StorageAccount="ExistingStorage_Standard",
|
||||
[string]$Region="westus2",
|
||||
|
||||
#Optinal parameters
|
||||
[int]$NumberOfUploaderThreads=16,
|
||||
[switch]$DeleteVHDAfterUpload=$false
|
||||
)
|
||||
|
||||
Get-ChildItem .\Libraries -Recurse | Where-Object { $_.FullName.EndsWith(".psm1") } | ForEach-Object { Import-Module $_.FullName -Force -Global }
|
||||
|
||||
$StorageAccountName = GetStorageAccountFromRegion -Region $Region -StorageAccount $StorageAccount
|
||||
|
||||
$ExitCode = 1
|
||||
try
|
||||
{
|
||||
LogMsg "Target storage account: $StorageAccountName"
|
||||
LogMsg "Gettting Resource group name of the Storage account - $StorageAccountName"
|
||||
$StorageAccountNameRG = (Get-AzureRmResource | Where { $_.Name -eq $StorageAccountName}).ResourceGroupName
|
||||
$UploadLink = "https://$StorageAccountName.blob.core.windows.net/vhds"
|
||||
|
||||
LogMsg "WARNING: If a VHD is present in storage account with same name, it will be overwritten."
|
||||
|
||||
$RetryUpload = $true
|
||||
$retryCount = 0
|
||||
$VHDName = $VHDPath | Split-Path -Leaf
|
||||
while($RetryUpload -and ($retryCount -le 10))
|
||||
{
|
||||
$retryCount += 1
|
||||
LogMsg "Initiating '$VHDPath' upload to $UploadLink. Please wait..."
|
||||
$out = Add-AzureRmVhd -ResourceGroupName $StorageAccountNameRG -Destination "$UploadLink/$VHDName" -LocalFilePath "$VHDPath" -NumberOfUploaderThreads $NumberOfUploaderThreads -OverWrite -Verbose
|
||||
$uploadStatus = $?
|
||||
if ( $uploadStatus )
|
||||
{
|
||||
LogMsg "Upload successful."
|
||||
LogMsg "$($out.DestinationUri)"
|
||||
$ExitCode = 0
|
||||
$RetryUpload = $false
|
||||
if ($DeleteVHDAfterUpload)
|
||||
{
|
||||
LogMsg "Deleting $VHDPath"
|
||||
$out = Remove-Item -Path $VHDPath -Force | Out-Null
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "Skipping cleanup of $VHDPath"
|
||||
}
|
||||
LogMsg "Saving VHD URL to .\UploadedVHDLink.azure.env"
|
||||
Set-Content -Value $($out.DestinationUri) -Path .\UploadedVHDLink.azure.env -Force -Verbose -NoNewline
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "ERROR: Something went wrong in upload. Retrying..."
|
||||
$RetryUpload = $true
|
||||
Start-Sleep 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
ThrowException($_)
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMsg "Exiting with code : $ExitCode"
|
||||
exit $ExitCode
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<TestCases>
|
||||
<test>
|
||||
<TestName>FILE-SYSTEM-VERIFICATION-TESTS-CIFS</TestName>
|
||||
<PowershellScript>FILE-SYSTEM-VERIFICATION-TESTS.ps1</PowershellScript>
|
||||
<files>.\Testscripts\Linux\perf_xfstesting.sh,.\Testscripts\Linux\xfstests-config.config</files>
|
||||
<setupType>M1Disk1</setupType>
|
||||
<TestParameters>
|
||||
<param>TestFileSystem=cifs</param>
|
||||
</TestParameters>
|
||||
<Platform>Azure</Platform>
|
||||
<Category>Community</Category>
|
||||
<Area>Community</Area>
|
||||
<Tags>smb</Tags>
|
||||
<TestID>Community_001</TestID>
|
||||
</test>
|
||||
<test>
|
||||
<TestName>FILE-SYSTEM-VERIFICATION-TESTS-XFS</TestName>
|
||||
<PowershellScript>FILE-SYSTEM-VERIFICATION-TESTS.ps1</PowershellScript>
|
||||
<files>.\Testscripts\Linux\perf_xfstesting.sh,.\Testscripts\Linux\xfstests-config.config</files>
|
||||
<setupType>M1Disk1</setupType>
|
||||
<TestParameters>
|
||||
<param>TestFileSystem=xfs</param>
|
||||
</TestParameters>
|
||||
<Platform>Azure</Platform>
|
||||
<Category>Community</Category>
|
||||
<Area>Community</Area>
|
||||
<Tags>xfs,disk</Tags>
|
||||
<TestID>Community_001</TestID>
|
||||
</test>
|
||||
<test>
|
||||
<TestName>FILE-SYSTEM-VERIFICATION-TESTS-EXT4</TestName>
|
||||
<PowershellScript>FILE-SYSTEM-VERIFICATION-TESTS.ps1</PowershellScript>
|
||||
<files>.\Testscripts\Linux\perf_xfstesting.sh,.\Testscripts\Linux\xfstests-config.config</files>
|
||||
<setupType>M1Disk1</setupType>
|
||||
<TestParameters>
|
||||
<param>TestFileSystem=ext4</param>
|
||||
</TestParameters>
|
||||
<Platform>Azure</Platform>
|
||||
<Category>Community</Category>
|
||||
<Area>Community</Area>
|
||||
<Tags>ext4,disk</Tags>
|
||||
<TestID>Community_002</TestID>
|
||||
</test>
|
||||
</TestCases>
|
|
@ -0,0 +1,22 @@
|
|||
<TestSetup>
|
||||
<M1Disk1>
|
||||
<isDeployed>NO</isDeployed>
|
||||
<ResourceGroup>
|
||||
<VirtualMachine>
|
||||
<ARMInstanceSize>Standard_DS14_v2</ARMInstanceSize>
|
||||
<RoleName></RoleName>
|
||||
<EndPoints>
|
||||
<Name>SSH</Name>
|
||||
<Protocol>tcp</Protocol>
|
||||
<LocalPort>22</LocalPort>
|
||||
<PublicPort>22</PublicPort>
|
||||
</EndPoints>
|
||||
<DataDisk>
|
||||
<LUN>0</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
</VirtualMachine>
|
||||
</ResourceGroup>
|
||||
</M1Disk1>
|
||||
</TestSetup>
|
|
@ -239,4 +239,80 @@
|
|||
</VirtualMachine>
|
||||
</ResourceGroup>
|
||||
</S1C15>
|
||||
<DS14DISK12>
|
||||
<isDeployed>NO</isDeployed>
|
||||
<ResourceGroup>
|
||||
<VirtualMachine>
|
||||
<state></state>
|
||||
<InstanceSize>Standard_DS14</InstanceSize>
|
||||
<ARMInstanceSize>Standard_DS14</ARMInstanceSize>
|
||||
<EndPoints>
|
||||
<Name>SSH</Name>
|
||||
<Protocol>tcp</Protocol>
|
||||
<LocalPort>22</LocalPort>
|
||||
<PublicPort>22</PublicPort>
|
||||
</EndPoints>
|
||||
<DataDisk>
|
||||
<LUN>0</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>1</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>2</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>3</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>4</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>5</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>6</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>7</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>8</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>9</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>10</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
<DataDisk>
|
||||
<LUN>11</LUN>
|
||||
<DiskSizeInGB>1023</DiskSizeInGB>
|
||||
<HostCaching>None</HostCaching>
|
||||
</DataDisk>
|
||||
</VirtualMachine>
|
||||
</ResourceGroup>
|
||||
</DS14DISK12>
|
||||
</TestSetup>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<ResourceGroup>
|
||||
<VirtualMachine>
|
||||
<state></state>
|
||||
<InstanceSize>Standard_DS1</InstanceSize>
|
||||
<ARMInstanceSize>Standard_DS1</ARMInstanceSize>
|
||||
<InstanceSize>Standard_DS1_v2</InstanceSize>
|
||||
<ARMInstanceSize>Standard_DS1_v2</ARMInstanceSize>
|
||||
<RoleName></RoleName>
|
||||
<EndPoints>
|
||||
<Name>SSH</Name>
|
||||
|
@ -22,8 +22,8 @@
|
|||
<ResourceGroup>
|
||||
<VirtualMachine>
|
||||
<state></state>
|
||||
<InstanceSize>Standard_DS1</InstanceSize>
|
||||
<ARMInstanceSize>Standard_DS1</ARMInstanceSize>
|
||||
<InstanceSize>Standard_DS1_v2</InstanceSize>
|
||||
<ARMInstanceSize>Standard_DS1_v2</ARMInstanceSize>
|
||||
<RoleName></RoleName>
|
||||
<EndPoints>
|
||||
<Name>SSH</Name>
|
||||
|
|
Загрузка…
Ссылка в новой задаче