Important fixes
1. Capture VHD before test will publish VHD in current storage region only. 2. Copy VHD to other region have a new option -destinationStorageAccountType 3. Provision test is improved to check for call traces after a delay and after restart. 4. Other minor fixes.
This commit is contained in:
Родитель
bb315bcdff
Коммит
e0747029b1
|
@ -91,7 +91,7 @@ else
|
|||
{
|
||||
$targetRegions = (Get-AzureRmLocation).Location
|
||||
}
|
||||
$targetStorageAccounts = ($GetAzureRmStorageAccount | where { ( $_.StorageAccountName -imatch "konkaci" ) -and $targetRegions.Contains($_.PrimaryLocation) -and $destinationAccountType -imatch $_.Sku.Tier}).StorageAccountName
|
||||
$targetStorageAccounts = ($GetAzureRmStorageAccount | where { ( $_.StorageAccountName -imatch "konkaci" ) -and $targetRegions.Contains($_.PrimaryLocation) -and ($destinationAccountType -imatch $_.Sku.Tier)}).StorageAccountName
|
||||
$destContextArr = @()
|
||||
foreach ($targetSA in $targetStorageAccounts)
|
||||
{
|
||||
|
@ -105,26 +105,31 @@ foreach ($targetSA in $targetStorageAccounts)
|
|||
[string]$DestBlob = $newVHDName
|
||||
$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
|
||||
$destContextArr += $destContext
|
||||
$testContainer = Get-AzureStorageContainer -Name $destContainer -Context $destContext -ErrorAction Ignore
|
||||
if ($testContainer -eq $null) {
|
||||
New-AzureStorageContainer -Name $destContainer -context $destContext
|
||||
}
|
||||
# Start the Copy
|
||||
Write-Host "Copying $SrcStorageBlob as $DestBlob from and to storage account $DestAccountName/$DestContainer"
|
||||
$out = Start-AzureStorageBlobCopy -AbsoluteUri $SasUrl -DestContainer $destContainer -DestContext $destContext -DestBlob $destBlob -Force
|
||||
if (($SrcStorageAccount -eq $DestAccountName) -and ($SrcStorageBlob -eq $DestBlob))
|
||||
{
|
||||
Write-Host "Skipping copy for : $DestAccountName as source storage account and VHD name is same."
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "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
|
||||
|
@ -137,7 +142,15 @@ while($CopyingInProgress)
|
|||
foreach ($destContext in $destContextArr)
|
||||
{
|
||||
$status = Get-AzureStorageBlobCopyState -Container $destContainer -Blob $destBlob -Context $destContext
|
||||
if ($status.Status -ne "Success")
|
||||
if ($status.Status -eq "Success")
|
||||
{
|
||||
Write-Host "$DestBlob : $($destContext.StorageAccountName) : Done : 100 %"
|
||||
}
|
||||
elseif ($status.Status -eq "Failed")
|
||||
{
|
||||
Write-Host "$DestBlob : $($destContext.StorageAccountName) : Failed."
|
||||
}
|
||||
elseif ($status.Status -eq "Pending")
|
||||
{
|
||||
sleep -Milliseconds 100
|
||||
$CopyingInProgress = $true
|
||||
|
@ -145,14 +158,10 @@ while($CopyingInProgress)
|
|||
$copyPercent = [math]::Round((($status.BytesCopied/$status.TotalBytes) * 100),2)
|
||||
Write-Host "$DestBlob : $($destContext.StorageAccountName) : Running : $copyPercent %"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "$DestBlob : $($destContext.StorageAccountName) : Done : 100 %"
|
||||
}
|
||||
}
|
||||
if ($CopyingInProgress)
|
||||
{
|
||||
Write-Host "$($newDestContextArr.Count) copy operations still in progress."
|
||||
Write-Host "--------$($newDestContextArr.Count) copy operations still in progress.-------"
|
||||
$destContextArr = $newDestContextArr
|
||||
Sleep -Seconds 10
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ if (($vmStatus.Statuses | Where-Object { $_.Code -imatch "PowerState" }).Code -i
|
|||
$turnONfailed = $true
|
||||
while ($turnONfailed -and $retryCount -lt 11)
|
||||
{
|
||||
$vmStatus = Get-AzureRMVm -ResourceGroupName $resourceGroup -Name $roleName -Status
|
||||
Write-Host "'$roleName' is '$(($vmStatus.Statuses | Where-Object { $_.Code -imatch "PowerState" }).Code)'. Turning it ON..."
|
||||
$startStatus = Start-AzureRmVM -Name $roleName -ResourceGroupName $resourceGroup
|
||||
if ($startStatus.Status -eq "Succeeded")
|
||||
|
|
|
@ -60,6 +60,7 @@ Set-Content -Value "No tests ran yet." -Path ".\report\testSummary.html" -Force
|
|||
if ( $customSecretsFilePath ) {
|
||||
$secretsFile = $customSecretsFilePath
|
||||
Write-Host "Using user provided secrets file: $($secretsFile | Split-Path -Leaf)"
|
||||
Set-Variable -Name $secretsFile -Value $customSecretsFilePath -Scope Global
|
||||
}
|
||||
if ($env:Azure_Secrets_File) {
|
||||
$secretsFile = $env:Azure_Secrets_File
|
||||
|
|
|
@ -227,6 +227,12 @@
|
|||
$currentStatus = SetUsage -currentStatus $currentStatus -text $identifierText -usage $testVMUsage -AllowedUsagePercentage $AllowedUsagePercentage
|
||||
$overFlowErrors += TestUsage -currentStatus $currentStatus -text $identifierText -AllowedUsagePercentage $AllowedUsagePercentage
|
||||
}
|
||||
elseif ( $testVMSize.StartsWith("ND"))
|
||||
{
|
||||
$identifierText = "standardNDFamily"
|
||||
$currentStatus = SetUsage -currentStatus $currentStatus -text $identifierText -usage $testVMUsage -AllowedUsagePercentage $AllowedUsagePercentage
|
||||
$overFlowErrors += TestUsage -currentStatus $currentStatus -text $identifierText -AllowedUsagePercentage $AllowedUsagePercentage
|
||||
}
|
||||
elseif ( $testVMSize.StartsWith("H"))
|
||||
{
|
||||
$identifierText = "standardHFamily"
|
||||
|
|
|
@ -1117,7 +1117,7 @@ Function GetAndCheckKernelLogs($allDeployedVMs, $status, $vmUser, $vmPassword)
|
|||
foreach ($VM in $allDeployedVMs)
|
||||
{
|
||||
$BootLogDir="$Logdir\$($VM.RoleName)"
|
||||
mkdir $BootLogDir -Force | Out-Null
|
||||
mkdir $BootLogDir -Force | Out-Null
|
||||
LogMsg "Collecting $($VM.RoleName) VM Kernel $status Logs.."
|
||||
$InitailBootLog="$BootLogDir\InitialBootLogs.txt"
|
||||
$FinalBootLog="$BootLogDir\FinalBootLogs.txt"
|
||||
|
|
|
@ -8,14 +8,35 @@ $resultArr = @()
|
|||
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
|
||||
if ($isDeployed)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$RestartStatus = RestartAllDeployments -allVMData $allVMData
|
||||
if($RestartStatus -eq "True")
|
||||
Start-Sleep 30
|
||||
LogMsg "Check 1: Checking call tracess again after 30 seconds sleep"
|
||||
$noCallTraces = GetAndCheckKernelLogs -allDeployedVMs $allVMData -status "Initial"
|
||||
if ($noCallTraces)
|
||||
{
|
||||
LogMsg "Test Result : PASS."
|
||||
$testResult = "PASS"
|
||||
$RestartStatus = RestartAllDeployments -allVMData $allVMData
|
||||
if($RestartStatus -eq "True")
|
||||
{
|
||||
Start-Sleep 30
|
||||
LogMsg "Check 2: Checking call tracess again after Reboot > 30 seconds sleep"
|
||||
$noCallTraces = GetAndCheckKernelLogs -allDeployedVMs $allVMData -status "Initial"
|
||||
if ($noCallTraces)
|
||||
{
|
||||
LogMsg "Test Result : PASS."
|
||||
$testResult = "PASS"
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "Test Result : FAIL."
|
||||
$testResult = "FAIL"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "Test Result : FAIL."
|
||||
$testResult = "FAIL"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -23,7 +44,6 @@ if ($isDeployed)
|
|||
$testResult = "FAIL"
|
||||
}
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
|
|
|
@ -4,7 +4,6 @@ $result = ""
|
|||
$testResult = ""
|
||||
$resultArr = @()
|
||||
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
|
||||
|
||||
if ($isDeployed)
|
||||
{
|
||||
try
|
||||
|
@ -18,16 +17,13 @@ if ($isDeployed)
|
|||
LogMsg " RoleName : $($clientVMData.RoleName)"
|
||||
LogMsg " Public IP : $($clientVMData.PublicIP)"
|
||||
LogMsg " SSH Port : $($clientVMData.SSHPort)"
|
||||
|
||||
#endregion
|
||||
|
||||
#region Deprovision the VM.
|
||||
LogMsg "Deprovisioning $($clientVMData.RoleName)"
|
||||
$testJob = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -command "waagent -deprovision --force" -runAsSudo
|
||||
LogMsg "Deprovisioning done."
|
||||
#endregion
|
||||
#endregion
|
||||
LogMsg "Shutting down VM.."
|
||||
|
||||
$stopVM = Stop-AzureRmVM -Name $clientVMData.RoleName -ResourceGroupName $clientVMData.ResourceGroupName -Force -Verbose
|
||||
if ($stopVM.Status -eq "Succeeded")
|
||||
{
|
||||
|
@ -79,77 +75,11 @@ if ($isDeployed)
|
|||
$OSDiskVHD = (Get-AzureRmVM -ResourceGroupName $clientVMData.ResourceGroupName -Name $clientVMData.RoleName).StorageProfile.OsDisk.Vhd.Uri
|
||||
$currentVHDName = $OSDiskVHD.Trim().Split("/")[($OSDiskVHD.Trim().Split("/").Count -1)]
|
||||
$testStorageAccount = $OSDiskVHD.Replace("http://","").Replace("https://","").Trim().Split(".")[0]
|
||||
$testStorageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $(($GetAzureRmStorageAccount | Where {$_.StorageAccountName -eq "$testStorageAccount"}).ResourceGroupName) -Name $testStorageAccount)[0].Value
|
||||
$targetRegions = $currentTestData.regions.Split(",")
|
||||
$targetStorageAccounts = ($GetAzureRmStorageAccount | where { ( $_.StorageAccountName -imatch "konkaci" ) -and $targetRegions.Contains($_.PrimaryLocation)}).StorageAccountName
|
||||
$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 = $newVHDName
|
||||
$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
|
||||
$destContextArr += $destContext
|
||||
$testContainer = Get-AzureStorageContainer -Name $destContainer -Context $destContext -ErrorAction Ignore
|
||||
if ($testContainer -eq $null) {
|
||||
New-AzureStorageContainer -Name $destContainer -context $destContext
|
||||
}
|
||||
# Start the Copy
|
||||
LogMsg "Copying $SrcStorageBlob as $DestBlob from and to storage account $DestAccountName/$DestContainer"
|
||||
$out = Start-AzureStorageBlobCopy -AbsoluteUri $SasUrl -DestContainer $destContainer -DestContext $destContext -DestBlob $destBlob -Force
|
||||
}
|
||||
#
|
||||
# Monitor replication status
|
||||
#
|
||||
$destContextArr
|
||||
$CopyingInProgress = $true
|
||||
while($CopyingInProgress)
|
||||
{
|
||||
$CopyingInProgress = $false
|
||||
$newDestContextArr = @()
|
||||
foreach ($destContext in $destContextArr)
|
||||
{
|
||||
$status = Get-AzureStorageBlobCopyState -Container $destContainer -Blob $destBlob -Context $destContext
|
||||
if ($status.Status -ne "Success")
|
||||
{
|
||||
sleep -Milliseconds 100
|
||||
$CopyingInProgress = $true
|
||||
$newDestContextArr += $destContext
|
||||
LogMsg "$DestBlob : $($destContext.StorageAccountName) : Running"
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultSummary += CreateResultSummary -testResult "Done" -metaData "$DestBlob : $($destContext.StorageAccountName)" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
|
||||
LogMsg "$DestBlob : $($destContext.StorageAccountName) : Done"
|
||||
}
|
||||
}
|
||||
if ($CopyingInProgress)
|
||||
{
|
||||
LogMsg "$($newDestContextArr.Count) copy operations still in progress."
|
||||
$destContextArr = $newDestContextArr
|
||||
Sleep -Seconds 10
|
||||
}
|
||||
}
|
||||
LogMsg "Copy Done. Bytes Copied:$($status.BytesCopied), Total Bytes:$($status.TotalBytes)"
|
||||
|
||||
$sourceRegion = $(($GetAzureRmStorageAccount | Where {$_.StorageAccountName -eq "$testStorageAccount"}).Location)
|
||||
$targetStorageAccountType = [string]($(($GetAzureRmStorageAccount | Where {$_.StorageAccountName -eq "$testStorageAccount"}).Sku.Tier))
|
||||
LogMsg "Check 1: $targetStorageAccountType"
|
||||
LogMsg ".\Extras\CopyVHDtoOtherStorageAccount.ps1 -sourceLocation $sourceRegion -destinationLocations $sourceRegion -destinationAccountType $targetStorageAccountType -sourceVHDName $currentVHDName -destinationVHDName $newVHDName"
|
||||
.\Extras\CopyVHDtoOtherStorageAccount.ps1 -sourceLocation $sourceRegion -destinationLocations $sourceRegion -destinationAccountType $targetStorageAccountType -sourceVHDName $currentVHDName -destinationVHDName $newVHDName
|
||||
LogMsg "---------------Copy #1: END----------------"
|
||||
#endregion
|
||||
|
||||
|
@ -164,7 +94,7 @@ if ($isDeployed)
|
|||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
|
@ -174,7 +104,7 @@ if ($isDeployed)
|
|||
$testResult = "Aborted"
|
||||
}
|
||||
$resultArr += $testResult
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче