Shital Savekar 2017-06-29 14:24:34 +05:30
Родитель cc93e26b8a 28c99acead
Коммит 4c7e913b91
9 изменённых файлов: 1041 добавлений и 25 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -1,8 +1,8 @@
.idea/*
temp*
TestResults*
tools*
report*
Reload*
Azure_ICA_all_*
tools*
start*
.vscode/launch.json
.vscode/launch.json

Просмотреть файл

@ -61,17 +61,17 @@
<Data>
<!-- You can add your own distro and Image names here -->
<Distro>
<Name>SSU1604P</Name>
<Name>CK</Name>
<OsImage></OsImage>
<!-- <OsImage>b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-16_04-LTS-amd64-server-20160907.1-en-us-30GB</OsImage> -->
<ARMImage>
<Publisher></Publisher>
<Publisher>Canonical</Publisher>
<!-- <Publisher>Canonical</Publisher> -->
<Offer></Offer>
<Offer>UbuntuServer</Offer>
<!-- <Offer>UbuntuServer</Offer> -->
<Sku></Sku>
<Sku>16.04.0-LTS</Sku>
<!-- <Sku>16.04.0-LTS</Sku> -->
<Version></Version>
<Version>latest</Version>
<!-- <Version>latest</Version> -->
</ARMImage>
<OsVHD></OsVHD>
@ -7157,7 +7157,7 @@
<param>startIO=8</param>
<param>numjobs=1</param>
<param>ioruntime=300</param>
<param>maxIO=8</param>
<param>maxIO=8</param>
<param>fileSize=134G</param>
</TestParameters>
<Priority>P0</Priority>
@ -7283,7 +7283,118 @@
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<Priority>P0</Priority>
</test>
</test>
<!-- LIS BUILD TEST -->
<test>
<!-- Install Latest LIS -> reboot and Verify it Installed Successfully with out any errors and warnings. -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-1</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID2</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Install Previous LIS, reboot and Upgrade to latest LIS, reboot. Verify that LIS install/upgrade Successful with out any errors and warnings. -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-2</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<PreviousLISVersion>PREVIOUS</PreviousLISVersion>
<PreviousLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/previous-lis-rpms.tar.gz^tar -xzf previous-lis-rpms.tar.gz^cp -ar LISISO/* . </PreviousLISExtractCommand>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID1,TestID3</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Install Previous LIS -> Upgrade to latest LIS -> Uninstall LIS -> ReInstall Prevous LIS. Verify that LIS install/upgrade/uninstall Successful with out any errors and warnings. -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-3</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<PreviousLISVersion>PREVIOUS</PreviousLISVersion>
<PreviousLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/previous-lis-rpms.tar.gz^tar -xzf previous-lis-rpms.tar.gz^cp -ar LISISO/* . </PreviousLISExtractCommand>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID1,TestID3,TestID4,TestID5</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Upgrade Kernel (don't reboot) -> Install Current LIS and Verify that LIS aborting install (LIS negative scenario test) -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-4</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID7,TestID8</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Install Current LIS and Upgrade Kernel with reboot. Verify that install/upgrade Successful with out any errors and warnings and boot with Inbuilt LIS drives. -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-5</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID2,TestID6</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Install Previous LIS -> upgrade to Current LIS -> Upgrade Kernel with reboot. Verify that install/upgrade Successful with out any errors and warnings and boot with Inbuilt LIS drives. -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-6</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<PreviousLISVersion>PREVIOUS</PreviousLISVersion>
<PreviousLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/previous-lis-rpms.tar.gz^tar -xzf previous-lis-rpms.tar.gz^cp -ar LISISO/* . </PreviousLISExtractCommand>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID1,TestID3,TestID6</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Upgrade Kernel -> reboot -> Install Current LIS and Verify that LIS installed successful -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-7</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID6,TestID2</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<!-- Install Current LIS -> Uninstall LIS. Verify that install/uninstall Successful with out any errors and warnings,microsoft-hyper-v lib modules should be Empty and boot with Inbuilt LIS drives. -->
<testName>ICA-LIS-BUILD-TEST-SCENARIO-8</testName>
<testScript></testScript>
<testScriptps1>ICA-LIS-BUILD-TEST.ps1</testScriptps1>
<CurrentLISVersion>LATEST</CurrentLISVersion>
<CurrentLISExtractCommand>rm -rf */ *.sh *.tar*^wget https://konkasoftpackages.blob.core.windows.net/testpackages/lis-builds/latest-lis-rpms.tar.gz^tar -xzf latest-lis-rpms.tar.gz^cp -ar LISISO/* . </CurrentLISExtractCommand>
<setupType>A2</setupType>
<files>.\remote-scripts\azuremodules.sh</files>
<SubtestValues>TestID2,TestID4</SubtestValues>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-LTP-BASIC-TEST</testName>
<testScript>
@ -7433,6 +7544,12 @@
<Name>ICA-DEPLOYMENT-ALL-SIZES-LOOP-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>LEGACY-DEPLOYMENT</cycleName>
<test>
<Name>ICA-DEPLOYMENT-ALL-SIZES-LOOP-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>UITEST</cycleName>
<test>
@ -8388,6 +8505,33 @@
<test>
<Name>ICA-IPERF3-TCP-IPV4-SAMEVNET-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>LIS-BUILD</cycleName>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-1</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-2</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-3</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-4</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-5</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-6</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-7</Name>
</test>
<test>
<Name>ICA-LIS-BUILD-TEST-SCENARIO-8</Name>
</test>
</Cycle>
<Cycle>
<cycleName>DEBUG</cycleName>

Просмотреть файл

@ -19,4 +19,5 @@ S.No.,Region,VMSize,StorageAccount (Classic),StorageAccount (ARM)
18,UK WEST,Standard_DS4_v2,konkaciukwest1,konkaciukwest
19,North Europe,A10,konkacinortheurope,konkacineuropev2
20,West Europe,Standard_G3,konkaciwesteurope,konkaciwesteuropev2
21,Japan East,A11,konkacijapaneast1,konkacijapaneast
21,Japan East,A11,konkacijapaneast1,konkacijapaneast
22,West US 2,,,konkaciwestus2v2

1 S.No. Region VMSize StorageAccount (Classic) StorageAccount (ARM)
19 18 UK WEST Standard_DS4_v2 konkaciukwest1 konkaciukwest
20 19 North Europe A10 konkacinortheurope konkacineuropev2
21 20 West Europe Standard_G3 konkaciwesteurope konkaciwesteuropev2
22 21 Japan East A11 konkacijapaneast1 konkacijapaneast
23 22 West US 2 konkaciwestus2v2

Просмотреть файл

@ -84,6 +84,44 @@ $DeploymentCount = $NumberOfSizes*5
}
return $DeploymentStatistics
}
#Do this only when CustomKernel or CustomLIS is set
if (($cycleName.ToUpper() -eq "DEPLOYMENT") -and ($customKernel -or $customLIS))
{
#create a resource group and use the VHD for Deployment Test
$isDeployed = DeployVMS -setupType "SingleVM" -Distro $Distro -xmlConfig $xmlConfig -GetDeploymentStatistics $True
foreach ($VM in $allVMData)
{
$ResourceGroupUnderTest = $VM.ResourceGroupName
$VHDuri = (Get-AzureRMVM -ResourceGroupName $VM.ResourceGroupName).StorageProfile.OsDisk.Vhd.Uri
#Deprovision VM
LogMsg "Executing: waagent -deprovision..."
$DeprovisionInfo = RunLinuxCmd -username $user -password $password -ip $VM.PublicIP -port $VM.SSHPort -command "/usr/sbin/waagent -force -deprovision" -runAsSudo
LogMsg $DeprovisionInfo
LogMsg "Execution of waagent -deprovision done successfully"
LogMsg "Stopping Virtual Machine ...."
$out = Stop-AzureRmVM -ResourceGroupName $VM.ResourceGroupName -Name $VM.RoleName -Force
WaitFor -seconds 60
}
#get the VHD file name from the VHD uri
$VHDuri = Split-Path $VHDuri -Leaf
$Distros = @($xmlConfig.config.Azure.Deployment.Data.Distro)
#add OSVHD element to $xml so that deployment will pick the vhd
foreach ($distroname in $Distros)
{
if ($distroname.Name -eq $Distro)
{
$xmlConfig.config.Azure.Deployment.Data.Distro[$Distros.IndexOf($distroname)].OsVHD = $VHDuri.ToString()
}
}
#Finally set customKernl and customLIS to null which are not required to be installed after deploying Virtual machine
$customKernel = $null
Set-Variable -Name customKernel -Value $customKernel -Scope Global
$customLIS = $null
Set-Variable -Name customLIS -Value $customLIS -Scope Global
}
While ($count -lt $DeploymentCount)
{
$count += 1
@ -95,6 +133,7 @@ $DeploymentCount = $NumberOfSizes*5
Set-Variable -Name OverrideVMSize -Value $($VMSizes[$VMSizeNumber]) -Scope Global -Force
$xmlConfig.config.Azure.Deployment.SingleVM.HostedService.Tag = $($VMSizes[$VMSizeNumber]).Replace("_","-")
$isDeployed = DeployVMS -setupType "SingleVM" -Distro $Distro -xmlConfig $xmlConfig -GetDeploymentStatistics $True
$DeploymentStatistics.VMSize = $($VMSizes[$VMSizeNumber])
$DeploymentStatistics.attempt = $count
if ( !$UseAzureResourceManager )
@ -113,10 +152,15 @@ $DeploymentCount = $NumberOfSizes*5
{
if ( $UseAzureResourceManager )
{
$successCount += 1
LogMsg "ATTEMPT : $count/$DeploymentCount : Deploying $($VMSizes[$VMSizeNumber]) VM.. SUCCESS"
LogMsg "deployment Time = $($DeploymentStatistics.DeploymentTime)"
$deployResult = "PASS"
#Added restart check for the deployment
$isRestarted = RestartAllDeployments -allVMData $allVMData
if($isRestarted)
{
$successCount += 1
LogMsg "ATTEMPT : $count/$DeploymentCount : Deploying $($VMSizes[$VMSizeNumber]) VM.. SUCCESS"
LogMsg "deployment Time = $($DeploymentStatistics.DeploymentTime)"
$deployResult = "PASS"
}
}
else
{
@ -243,6 +287,11 @@ $DeploymentCount = $NumberOfSizes*5
{
$testResult = "Aborted"
}
#delete the resource group with captured VHD
elseif ($testResult -eq "PASS")
{
$out = DeleteResourceGroup -RGName $ResourceGroupUnderTest
}
$resultArr += $testResult
}
$result = GetFinalResultHeader -resultarr $resultArr

Просмотреть файл

@ -0,0 +1,819 @@
# This script deploys the VMs for the LIS-BUILD functional test and trigger the test based on given TESTIDs.
# 1. dos2unix, tar, , wge must be installed in the test image
# 2. It requires the current & previous LIS builds at specified location mentioned in the test definition
#
# Author: Sivakanth Rebba
# Email: v-sirebb@microsoft.com
#
###################################################################################
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$Subtests = $currentTestData.SubtestValues
$SubtestValues = $Subtests.Split(",")
$LISVersion = ""
$PreviousLISExtractCommand = $currentTestData.PreviousLISExtractCommand
$CurrentLISExtractCommand = $currentTestData.CurrentLISExtractCommand
$LISExtractCommand = ""
$result = ""
$testResult = ""
$resultArr = @()
Function CreateTestVMNode
{
param(
[string] $ServiceName,
[string] $VIP,
[string] $SSHPort,
[string] $username,
[string] $password,
[string] $DIP,
[string] $DNSUrl,
[string] $logDir )
$objNode = New-Object -TypeName PSObject
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ServiceName -Value $ServiceName -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name VIP -Value $VIP -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name SSHPort -Value $SSHPort -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name username -Value $username -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name password -Value $password -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name DIP -Value $nodeDip -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name logDir -Value $LogDir -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name DNSURL -Value $DNSUrl -Force
return $objNode
}
Function GetVMBasicInfo($VMObject, $PrevTestStatus, $metaData)
{
if ( $PrevTestStatus -eq "PASS" )
{
LogMsg "STARTING TEST : $metaData"
Set-Content -Value "**************modinfo hv_vmbus $metaData installing LIS******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_status = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_status -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Set-Content -Value "**************lsmod | egrep 'hv|hyper' $metaData installing LIS******************" -Path "$($VMObject.logDir)\lsmod_hv_module_status.txt"
$lsmod_hv_modules_status = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $lsmod_hv_modules_status -Path "$($VMObject.logDir)\lsmod_hv_module_status.txt"
$BasicInfoCmds = "date^last^uname -r^uname -a^modinfo hv_vmbus^modinfo hv_storvsc^cat /etc/*-release^df -hT^fdisk -l^cat /etc/fstab^hostname^ll `/`boot^python -V^waagent --version^lsmod | egrep 'hv|hyper'^pgrep -lf kvp^pgrep -lf fcopy^pgrep -lf vss"
$BasicInfoCmds = ($BasicInfoCmds).Split("^")
Set-Content -Value "**************$BasicInfoCmd $metaData installing LIS******************" -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
foreach($BasicInfoCmd in $BasicInfoCmds)
{
$basic_VM_cmd_info_status = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command $BasicInfoCmd -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $basic_VM_cmd_info_status -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
}
}
}
Function InstallLIS($VMObject, $PrevTestStatus, $metaData, $ISAbortIgnore="No")
{
if ( $PrevTestStatus -eq "PASS" )
{
LogMsg "STARTING TEST : $metaData"
$LISExtractCommands = $LISExtractCommand.Split("^")
$BasicInfoCmds = "date^last^uname -r^uname -a^modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils^cat /etc/*-release^df -hT^fdisk -l^cat /etc/fstab^hostname^python -V^waagent --version^lsmod | egrep 'hv|hyper'^pgrep -lf kvp^pgrep -lf fcopy^pgrep -lf vss"
$BasicInfoCmds = ($BasicInfoCmds).Split("^")
Set-Content -Value "**************$BasicInfoCmd $metaData******************" -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
foreach($BasicInfoCmd in $BasicInfoCmds)
{
Add-Content -Value "************** Status of $BasicInfoCmd******************" -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
$basic_VM_cmd_info_status = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command $BasicInfoCmd -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $basic_VM_cmd_info_status -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
}
Set-Content -Value "**************modinfo hv_vmbus before installing LIS $LISVersion******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_before_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_before_installing_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Set-Content -Value "***************modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils before installing LIS $LISVersion******************" -Path "$($VMObject.logDir)\hv_modules_status.txt"
$hv_modules_before_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $hv_modules_before_installing_LIS -Path "$($VMObject.logDir)\hv_modules_status.txt"
foreach ( $LISExtractCommand in $LISExtractCommands )
{
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command $LISExtractCommand -runAsSudo
}
$installLISConsoleOutput = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "./install.sh" -runAsSudo -runMaxAllowedTime 1200 -ignoreLinuxExitCode 2>&1
LogMsg "`n$installLISConsoleOutput"
Set-Content -Value $installLISConsoleOutput -Path "$($VMObject.logDir)\InstallLISConsoleOutput.txt"
if($installLISConsoleOutput -imatch "is already installed")
{
LogMsg "Latest LIS version is already installed."
$ExitCode = "PASS"
}
else
{
if($installLISConsoleOutput -imatch "warning")
{
LogErr "LIS install is failed due to found warnings."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\installLISConsoleOutput.txt" | Select-String "warning"
LogMsg "$ErrorWarningStatus"
Add-Content -Value "**************modinfo hv_vmbus after installing LIS $LISVersion******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_after_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_after_installing_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_installing_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_installing_LIS `n********************************************************"
$ExitCode = "PASS"
}
elseif($installLISConsoleOutput -imatch "error")
{
LogErr "Latest LIS install is failed due to found errors."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\installLISConsoleOutput.txt" | Select-String "error"
LogMsg "$ErrorWarningStatus"
$modinfo_hv_vmbus_after_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_installing_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_installing_LIS `n********************************************************"
$ExitCode = "FAIL"
}
elseif($installLISConsoleOutput -imatch "abort")
{
if($ISAbortIgnore -imatch "YES")
{
LogMsg "Latest LIS install is Abort due to System is not rebooted after kernel upgrade."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\installLISConsoleOutput.txt" | Select-String "abort"
LogMsg "$ErrorWarningStatus"
Add-Content -Value "**************modinfo hv_vmbus after installing LIS $LISVersion******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_after_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_after_installing_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_installing_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_installing_LIS `n********************************************************"
$ExitCode = "PASS"
}
else
{
LogErr "Latest LIS install is failed due to lis build aborted."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\installLISConsoleOutput.txt" | Select-String "abort"
LogMsg "$ErrorWarningStatus"
$modinfo_hv_vmbus_after_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_installing_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_installing_LIS `n********************************************************"
$ExitCode = "FAIL"
}
}
else
{
#Reboot VM..
$restartStatus = RestartAllDeployments -allVMData $allVMData
if ( $restartStatus -eq "True")
{
#Verify LIS Version
Add-Content -Value "**************modinfo hv_vmbus after installing LIS $LISVersion******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_after_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_after_installing_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Set-Content -Value "***************modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils after installing LIS $LISVersion******************" -Path "$($VMObject.logDir)\hv_modules_status.txt"
$hv_modules_after_installing_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $hv_modules_after_installing_LIS -Path "$($VMObject.logDir)\hv_modules_status.txt"
if ( $modinfo_hv_vmbus_before_installing_LIS -ne $modinfo_hv_vmbus_after_installing_LIS )
{
LogMsg "New LIS version detected. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_installing_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_installing_LIS `n********************************************************"
$ExitCode = "PASS"
}
else
{
LogErr "New LIS version NOT detected."
$ExitCode = "FAIL"
}
}
else
{
LogErr "VM is not accessible after reboot. Further Tests will be aborted."
$ExitCode = "ABORTED"
}
}
}
}
elseif ( $PrevTestStatus -eq "FAIL" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous failed test"
}
elseif ( $PrevTestStatus -eq "ABORTED" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous Aborted test"
}
return $ExitCode
}
Function UpgradeLIS($VMObject, $PrevTestStatus, $metaData)
{
if ( $PrevTestStatus -eq "PASS" )
{
LogMsg "STARTING TEST : $metaData"
$LISExtractCommands = $LISExtractCommand.Split("^")
Set-Content -Value "**************modinfo hv_vmbus before upgrading LIS $LISVersion******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_before_upgrading_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_before_upgrading_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Set-Content -Value "***************modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils before upgrading LIS $LISVersion******************" -Path "$($VMObject.logDir)\hv_modules_status.txt"
$hv_modules_before_upgrading_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $hv_modules_before_upgrading_LIS -Path "$($VMObject.logDir)\hv_modules_status.txt"
foreach ( $LISExtractCommand in $LISExtractCommands )
{
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command $LISExtractCommand -runAsSudo
}
$upgradelLISConsoleOutput = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "./upgrade.sh" -runAsSudo -runMaxAllowedTime 1200
LogMsg "`n$upgradelLISConsoleOutput"
Set-Content -Value $upgradelLISConsoleOutput -Path "$($VMObject.logDir)\UpgradeLISConsoleOutput.txt"
if($upgradelLISConsoleOutput -imatch "is already installed")
{
LogMsg "Latest LIS version is already installed."
$ExitCode = "PASS"
}
else
{
#Verification of Errors & Warnings in LIS installation process
if($upgradelLISConsoleOutput -imatch "error" -or $upgradelLISConsoleOutput -imatch "warning" -or $upgradelLISConsoleOutput -imatch "abort")
{
LogErr "Latest LIS install is failed due found errors or warnings or aborted."
$ExitCode = "FAIL"
}
else
{
#Reboot VM..
$restartStatus = RestartAllDeployments -allVMData $allVMData
if ( $restartStatus -eq "True")
{
#Verify LIS Version
Add-Content -Value "**************modinfo hv_vmbus after upgrading LIS $LISVersion******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_after_upgrading_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_after_upgrading_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Add-Content -Value "***************modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils after upgrading LIS $LISVersion******************" -Path "$($VMObject.logDir)\hv_modules_status.txt"
$hv_modules_after_upgrading_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $hv_modules_after_upgrading_LIS -Path "$($VMObject.logDir)\hv_modules_status.txt"
if ( $modinfo_hv_vmbus_before_upgrading_LIS -ne $modinfo_hv_vmbus_after_upgrading_LIS )
{
LogMsg "New upgraded LIS version detected. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_upgrading_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_upgrading_LIS `n********************************************************"
$ExitCode = "PASS"
}
else
{
LogErr "New LIS version NOT detected."
$ExitCode = "FAIL"
}
}
else
{
LogErr "VM is not accessible after reboot. Further Tests will be aborted."
$ExitCode = "ABORTED"
}
}
}
}
elseif ( $PrevTestStatus -eq "FAIL" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous failed test"
}
elseif ( $PrevTestStatus -eq "ABORTED" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous Aborted test"
}
return $ExitCode
}
Function UninstallLIS($VMObject, $PrevTestStatus, $metaData)
{
if ( $PrevTestStatus -eq "PASS" )
{
LogMsg "STARTING TEST : $metaData"
Set-Content -Value "**************modinfo hv_vmbus before uninstalling LIS******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_before_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_before_uninstalling_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Set-Content -Value "***************modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils before uninstalling LIS $LISVersion******************" -Path "$($VMObject.logDir)\hv_modules_status.txt"
$hv_modules_before_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $hv_modules_before_uninstalling_LIS -Path "$($VMObject.logDir)\hv_modules_status.txt"
Set-Content -Value "**************Microsoft HyperV lib modules before uninstalling LIS******************" -Path "$($VMObject.logDir)\microsoft_hyperv_lib_modules_status.txt"
$isHypervModulesEmptyBeforeUninstall = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "ls /lib/modules/`$(uname -r)`/extra/microsoft-hyper-v" -runAsSudo -ignoreLinuxExitCode 2>&1
Add-Content -Value $isHypervModulesEmptyBeforeUninstall -Path "$($VMObject.logDir)\microsoft_hyperv_lib_modules_status.txt"
foreach ( $LISExtractCommand in $LISExtractCommands )
{
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command $LISExtractCommand -runAsSudo
}
$uninstallLISConsoleOutput = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "./uninstall.sh" -runAsSudo -runMaxAllowedTime 1200
LogMsg "`n$uninstallLISConsoleOutput"
Set-Content -Value $uninstallLISConsoleOutput -Path "$($VMObject.logDir)\uninstallLISConsoleOutput.txt"
if($uninstallLISConsoleOutput -imatch "No LIS RPM's are present")
{
LogMsg "LIS already uninstalled and It has Inbuilt LIS drivers"
$ExitCode = "PASS"
}
else
{
#Verification of Errors & Warnings in LIS installation process
if($uninstallLISConsoleOutput -imatch "warning")
{
LogErr "LIS uninstall is failed due to found warnings."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\uninstallLISConsoleOutput.txt" | Select-String "warning"
LogMsg "$ErrorWarningStatus"
$modinfo_hv_vmbus_after_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_uninstalling_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_uninstalling_LIS `n********************************************************"
Add-Content -Value "**************Microsoft HyperV lib modules before uninstalling LIS******************" -Path "$($VMObject.logDir)\microsoft_hyperv_lib_modules_status.txt"
$isHypervModulesEmptyAfterUninstall = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command 'ls /lib/modules/`$(uname -r)`/extra/microsoft-hyper-v 2>&1' -runAsSudo -ignoreLinuxExitCode 2>&1
Add-Content -Value $isHypervModulesEmptyAfterUninstall -Path "$($VMObject.logDir)\microsoft_hyperv_lib_modules_status.txt"
if ( ($modinfo_hv_vmbus_before_uninstalling_LIS -ne $modinfo_hv_vmbus_after_uninstalling_LIS ) -and ($isHypervModulesEmptyAfterUninstall -imatch "No such file or directory"))
{
LogMsg "Downgraded to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_uninstalling_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_uninstalling_LIS `n********************************************************"
LogMsg "**************Microsoft HyperV lib midules are EMPTY ****************************"
$ExitCode = "PASS"
}
else
{
LogErr "Uninstall LIS failed and Inbuilt LIS drivers NOT detected OR Microsoft HyperV lib midules are NOT EMPTY"
$ExitCode = "FAIL"
}
}
elseif($uninstallLISConsoleOutput -imatch "error")
{
LogErr "Latest LIS install is failed due to found errors."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\uninstallLISConsoleOutput.txt" | Select-String "error"
LogMsg "$ErrorWarningStatus"
$modinfo_hv_vmbus_after_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_uninstalling_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_uninstalling_LIS `n********************************************************"
$ExitCode = "FAIL"
}
elseif($uninstallLISConsoleOutput -imatch "abort")
{
LogErr "Latest LIS install is failed due to lis build aborted."
$ErrorWarningStatus = Get-Content -Path "$($VMObject.logDir)\uninstallLISConsoleOutput.txt" | Select-String "abort"
LogMsg "$ErrorWarningStatus"
$modinfo_hv_vmbus_after_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
LogMsg "Downgrade to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_uninstalling_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_uninstalling_LIS `n********************************************************"
$ExitCode = "FAIL"
}
else
{
#Reboot VM..
$restartStatus = RestartAllDeployments -allVMData $allVMData
if ( $restartStatus -eq "True")
{
#Verify LIS Version
Add-Content -Value "**************modinfo hv_vmbus after uninstalling LIS******************" -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
$modinfo_hv_vmbus_after_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_after_uninstalling_LIS -Path "$($VMObject.logDir)\modinfo_hv_vmbus_status.txt"
Add-Content -Value "***************modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils after uninstalling LIS $LISVersion******************" -Path "$($VMObject.logDir)\hv_modules_status.txt"
$hv_modules_after_uninstalling_LIS = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $hv_modules_after_uninstalling_LIS -Path "$($VMObject.logDir)\hv_modules_status.txt"
Add-Content -Value "**************Microsoft HyperV lib modules after uninstalling LIS******************" -Path "$($VMObject.logDir)\microsoft_hyperv_lib_modules_status.txt"
$isHypervModulesEmptyAfterUninstall = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command 'ls /lib/modules/`$(uname -r)`/extra/microsoft-hyper-v 2>&1' -runAsSudo -ignoreLinuxExitCode 2>&1
Add-Content -Value $isHypervModulesEmptyAfterUninstall -Path "$($VMObject.logDir)\microsoft_hyperv_lib_modules_status.txt"
if ( ($modinfo_hv_vmbus_before_uninstalling_LIS -ne $modinfo_hv_vmbus_after_uninstalling_LIS ) -and ($isHypervModulesEmptyAfterUninstall -imatch "No such file or directory"))
{
LogMsg "Downgraded to Previous LIS version. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_uninstalling_LIS `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_uninstalling_LIS `n********************************************************"
LogMsg "**************Microsoft HyperV lib midules are EMPTY ****************************"
$ExitCode = "PASS"
}
else
{
LogErr "Uninstall LIS failed and Inbuilt LIS drivers NOT detected OR Microsoft HyperV lib midules are NOT EMPTY"
$ExitCode = "FAIL"
}
}
else
{
LogErr "VM is not accessible after reboot. Further Tests will be aborted."
$ExitCode = "ABORTED"
}
}
}
}
elseif ( $PrevTestStatus -eq "FAIL" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous failed test"
}
elseif ( $PrevTestStatus -eq "ABORTED" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous Aborted test"
}
return $ExitCode
}
Function isLinuxProcessRunning ($VMObject, $ProcessName)
{
LogMsg "Verifying if $ProcessName is running.."
$psef = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "ps -ef"
$foundProcesses = 0
foreach ( $line in $psef.Split("`n"))
{
if (( $line -imatch $ProcessName) -and !( $line -imatch "--color=auto"))
{
$foundProcesses += 1
$linuxUID = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[0]
$linuxPID = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[1]
$linuxPPID = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[2]
$linuxC = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[3]
$linuxSTIME = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[4]
$linuxTTY = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[5]
$linuxTIME = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[6]
$linuxCMD = $line.Trim().Replace("$linuxUID","").Replace("$linuxPID","").Replace("$linuxPPID","").Replace("$linuxC","").Replace("$linuxSTIME","").Replace("$linuxTTY","").Replace("$linuxTIME","").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ")
LogMsg "FOUND PROCESS : UID=$linuxUID, PID=$linuxPID, RUNNING TIME=$linuxTIME, COMMAND=$linuxCMD"
}
}
return $foundProcesses
}
Function UpgradeKernel($VMObject, $PrevTestStatus, $metaData, $isReboot = "YES")
{
if ( $PrevTestStatus -eq "PASS" )
{
LogMsg "Starting Test : $metaData"
$BasicInfoCmds = "date^modinfo hv_vmbus hv_storvsc hv_netvsc hv_utils^cat /etc/*-release^uname -r^uname -a"
$BasicInfoCmds = ($BasicInfoCmds).Split("^")
Set-Content -Value "**************$BasicInfoCmd $metaData******************" -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
foreach($BasicInfoCmd in $BasicInfoCmds)
{
Add-Content -Value "************** Status of $BasicInfoCmd******************" -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
$basic_VM_cmd_info_status = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command $BasicInfoCmd -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $basic_VM_cmd_info_status -Path "$($VMObject.logDir)\basic_VM_info_status.txt"
}
Set-Content -Value "**************modinfo hv_vmbus before upgrading Kernel******************" -Path "$($VMObject.LogDir)\InfoBeforeKernelUpgrade.txt"
$modinfo_hv_vmbus_before_upgrading_Kernel = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_before_upgrading_Kernel -Path "$($VMObject.logDir)\InfoBeforeKernelUpgrade.txt"
$dmesgBeforeUpgrade = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "dmesg"
Set-Content -Value $dmesgBeforeUpgrade -Path "$($VMObject.LogDir)\dmesgBeforeKernelUpgrade.txt"
Add-Content -Value "**************uname -r before upgrading Kernel******************" -Path "$($VMObject.LogDir)\InfoBeforeKernelUpgrade.txt"
$unameBeforeUpgrade = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "uname -r"
Add-Content -Value $unameBeforeUpgrade -Path "$($VMObject.logDir)\InfoBeforeKernelUpgrade.txt"
$dmesgBeforeUpgrade = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "dmesg"
$UpdateConsole = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "yum install -y kernel" -runAsSudo -runMaxAllowedTime 1500
Set-Content -Value $UpdateConsole -Path "$($VMObject.LogDir)\UpdateConsoleOutput.txt"
$dmesgafterUpgrade = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "dmesg"
Set-Content -Value $dmesgAfterUpgrade -Path "$($VMObject.LogDir)\dmesgAfterKernelUpgrade.txt"
Add-Content -Value "**************uname -r after upgrading Kernel before reboot ******************" -Path "$($VMObject.LogDir)\InfoAfterKernelUpgrade.txt"
$unameAfterUpgrade = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "uname -r"
Add-Content -Value $unameAfterUpgrade -Path "$($VMObject.logDir)\InfoAfterKernelUpgrade.txt"
if($isReboot -imatch "NO")
{
if(($UpdateConsole -imatch "already installed") -or ($UpdateConsole -imatch "Nothing to do"))
{
LogMsg "VM has latest kernel already installed, So LIS negative scenario test is skipped.."
LogMsg "Kernel version : $unameBeforeUpgrade `n $UpdateConsole."
$ExitCode = "ABORTED"
}
elseif($UpdateConsole -imatch "Error")
{
LogMsg "Kernel upgrade is Failed, So LIS negative scenario test is skipped.."
LogMsg "Kernel version : $unameBeforeUpgrade `n $UpdateConsole."
$ExitCode = "FAIL"
}
else
{
if($unameBeforeUpgrade -ne $unameAfterUpgrade)
{
LogMsg "Kernel upgraded from : $unameBeforeUpgrade to $unameAfterUpgrade."
LogMsg "Upgraded to latest Kernel version. `n************** PREVIOUS KERNEL VERSION ************** `n$unameBeforeUpgrade `n******************************************************** `n************** CURRENT KERNEL VERSION ************** `n$unameAfterUpgrade `n********************************************************"
$ExitCode = "PASS"
}
else
{
LogMsg "Re Upgrade the kernel.."
$ReUpdateConsole = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "yum install -y kernel" -runAsSudo -runMaxAllowedTime 1500
if(($ReUpdateConsole -imatch "already installed") -or ($ReUpdateConsole -imatch"Nothing to do"))
{
LogMsg "Kernel upgrade : SUCESS."
LogMsg "Kernel version : $unameBeforeUpgrade `n $ReUpdateConsole."
$ExitCode = "PASS"
}
else
{
LogMsg "Kernel upgrade is Failed, So LIS negative scenario test is skipped.."
LogMsg "Kernel version : $unameBeforeUpgrade `n $ReUpdateConsole."
$ExitCode = "FAIL"
}
}
}
}
else
{
if(($UpdateConsole -imatch "already installed") -or ($UpdateConsole -imatch "Nothing to do"))
{
LogMsg "VM has latest kernel already installed, So LIS scenario test is skipped.."
LogMsg "Kernel version : $unameBeforeUpgrade `n $UpdateConsole."
$ExitCode = "ABORTED"
}
elseif($UpdateConsole -imatch "Error")
{
if($UpdateConsole -imatch "already installed" )
{
LogMsg "Kernel upgrade : SUCESS."
LogMsg "Kernel version : $unameBeforeUpgrade `n $UpdateConsole."
$ExitCode = "PASS"
}
LogMsg "Kernel upgrade is Failed, So LIS scenario test is skipped.."
LogMsg "Kernel version : $unameBeforeUpgrade `n $UpdateConsole."
$ExitCode = "FAIL"
}
else
{
LogMsg "Kernel upgrade is success, So LIS scenario test forwared with reboot VM.."
$restartStatus = RestartAllDeployments -allVMData $allVMData
if ( $restartStatus -eq "True")
{
#Verify Kernel and LIS Version
Add-Content -Value "**************modinfo hv_vmbus after upgrading Kernel******************" -Path "$($VMObject.LogDir)\InfoAfterKernelUpgrade.txt"
$modinfo_hv_vmbus_after_upgrading_Kernel = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "modinfo hv_vmbus" -runAsSudo -ignoreLinuxExitCode
Add-Content -Value $modinfo_hv_vmbus_after_upgrading_Kernel -Path "$($VMObject.logDir)\InfoAfterKernelUpgrade.txt"
Add-Content -Value "**************uname -r after upgrading Kernel******************" -Path "$($VMObject.LogDir)\InfoAfterKernelUpgrade.txt"
$unameAfterUpgrade = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "uname -r"
Add-Content -Value $unameAfterUpgrade -Path "$($VMObject.logDir)\InfoAfterKernelUpgrade.txt"
if ( ($unameBeforeUpgrade -ne $unameAfterUpgrade) -and ($modinfo_hv_vmbus_before_upgrading_Kernel -ne $modinfo_hv_vmbus_after_upgrading_Kernel))
{
LogMsg "Kernel upgraded from : $unameBeforeUpgrade to $unameAfterUpgrade."
LogMsg "Upgraded to latest Kernel version. `n************** PREVIOUS KERNEL VERSION ************** `n$unameBeforeUpgrade `n******************************************************** `n************** CURRENT KERNEL VERSION ************** `n$unameAfterUpgrade `n********************************************************"
LogMsg "LIS Inbuilt drivers are detected.. After Kernel Upgrade. `n************** PREVIOUS LIS VERSION ************** `n$modinfo_hv_vmbus_before_upgrading_Kernel `n******************************************************** `n************** CURRENT LIS VERSION ************** `n$modinfo_hv_vmbus_after_upgrading_Kernel `n********************************************************"
$ExitCode = "PASS"
}
else
{
LogErr "New LIS version NOT detected."
$ExitCode = "FAIL"
}
}
else
{
LogErr "VM is not accessible after reboot. Further Tests will be aborted."
$ExitCode = "ABORTED"
}
}
}
}
elseif ( $PrevTestStatus -eq "FAIL" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous failed test"
}
elseif ( $PrevTestStatus -eq "ABORTED" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous Aborted test"
}
return $ExitCode
}
Function ReinstallLIS($VMObject, $PrevTestStatus, $metaData)
{
if ( $PrevTestStatus -eq "PASS" )
{
$UninstallLIS = UninstallLIS -VMObject $VMObject -PrevTestStatus "PASS" -metaData "Uninstalling LIS."
$ExitCode = InstallLIS -VMObject $VMObject -PrevTestStatus $UninstallLIS -metaData "$metaData"
}
elseif ( $PrevTestStatus -eq "FAIL" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous failed test"
}
elseif ( $PrevTestStatus -eq "ABORTED" )
{
$ExitCode = "ABORTED"
LogMsg "Skipping TEST : $metaData due to previous Aborted test"
}
return $ExitCode
}
Function PrepareVMForLIS4Test ($VMObject, $DetectedDistro)
{
if ( $DetectedDistro -imatch "CENTOS" )
{
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "yum install --nogpgcheck -y ./epel-release-7-5.noarch.rpm " -runAsSudo -ignoreLinuxExitCode
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "yum install --nogpgcheck -y wget tar" -runAsSudo
}
elseif ( $DetectedDistro -imatch "REDHAT" )
{
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "yum install --nogpgcheck -y wget tar" -runAsSudo
}
elseif ( $DetectedDistro -imatch "ORACLE" )
{
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "yum install --nogpgcheck -y wget tar sysstat" -runAsSudo
}
else
{
LogMsg "LIS is not Support for detected DISTRO"
}
}
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if($isDeployed)
{
$testVMData = $allVMData
$VMObject = CreateTestVMNode -ServiceName $allVMData -VIP $testVMData.PublicIP -SSHPort $testVMData.SSHPort -username $user -password $password -DNSUrl $hs1ServiceUrl -logDir $LogDir
$DetectedDistro = DetectLinuxDistro -VIP $testVMData.PublicIP -SSHport $testVMData.SSHPort -testVMUser $user -testVMPassword $password
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files $currentTestData.files -username $user -password $password -upload
$out = RunLinuxCmd -username $VMObject.username -password $VMObject.password -ip $VMObject.VIP -port $VMObject.SSHPort -command "chmod +x *.sh" -runAsSudo
$out = PrepareVMForLIS4Test -VMObject $VMObject -DetectedDistro $DetectedDistro
$testResult = "PASS"
foreach($TestID in $SubtestValues)
{
try
{
#Make $testResult = $Null
$PrevTestResult = $testResult
$testResult = $null
switch ($TestID.Trim())
{
"manual" #Do manual work if necessory.
{
LogMsg "Manual override started.."
$ManualWork = $null
While ( !$ManualWork )
{
$ManualWork = Read-Host -Prompt "Please tell, what you are trying to do in one line"
}
$metaData = $ManualWork
LogMsg "Please complete your manual work."
LogMsg "ssh $user@$hs1ServiceUrl -p $testVMData.SSHPort"
$isManaulWorkDone = $null
While ( !( $isManaulWorkDone -eq "YES" ) -and !( $isManaulWorkDone -eq "NO" ) )
{
$isManaulWorkDone = Read-Host -Prompt "Did you finished your work? [YES/NO]"
}
if ( $isManaulWorkDone -eq "YES" )
{
$ProceedForAutomation = $null
While ( !( $ProceedForAutomation -eq "YES" ) -and !( $ProceedForAutomation -eq "NO" ) )
{
$ProceedForAutomation = Read-Host -Prompt "Can Automation proceed? [YES/NO]"
}
if ( $ProceedForAutomation -eq "YES")
{
$testResult = "PASS"
}
else
{
$StopAutomationReason = $null
While ( !$StopAutomationReason )
{
$StopAutomationReason = Read-Host -Prompt "Please tell, why automation should stop in one line."
}
$testResult = "FAIL"
}
}
else
{
$manualWorkNotDoneReason = $null
While ( !$manualWorkNotDoneReason )
{
$manualWorkNotDoneReason = Read-Host -Prompt "Please tell, why manual work is not completed in one line."
}
$testResult = "ABORTED"
}
}
"TestID1" #Install Previous LIS version
{
$LISVersion = $PreviousLISVersion
$LISExtractCommand = $PreviousLISExtractCommand
$metaData = "Pass1 - Install LIS Previous version $LISVersion and Reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
if ( $DetectedDistro -imatch "CENTOS" -or $DetectedDistro -imatch "REDHAT" -or $DetectedDistro -imatch "ORACLE" )
{
$testResult = InstallLIS -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData
}
else
{
LogMsg "Skipping LIS installation for $DetectedDistro"
$testResult = "PASS"
}
}
"TestID2" #Install Current LIS version
{
$LISVersion = $CurrentLISVersion
$LISExtractCommand = $CurrentLISExtractCommand
$metaData = "Pass1 - Install LIS Current version $LISVersion and Reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
if ( $DetectedDistro -imatch "CENTOS" -or $DetectedDistro -imatch "REDHAT" -or $DetectedDistro -imatch "ORACLE" )
{
$testResult = InstallLIS -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData
}
else
{
LogMsg "Skipping LIS installation for $DetectedDistro"
$testResult = "PASS"
}
}
"TestID3" #Upgrade to Current LIS version
{
$LISVersion = $CurrentLISVersion
$LISExtractCommand = $CurrentLISExtractCommand
$metaData = "Pass2 - Upgrade to LIS Current version $LISVersion and Reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
if ( $DetectedDistro -imatch "CENTOS" -or $DetectedDistro -imatch "REDHAT" -or $DetectedDistro -imatch "ORACLE" )
{
$testResult = UpgradeLIS -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData
}
else
{
LogMsg "Skipping LIS up-gradation for $DetectedDistro"
$testResult = "PASS"
}
}
"TestID4" #UnInstall to Current LIS version
{
$LISVersion = $CurrentLISVersion
$LISExtractCommand = $CurrentLISExtractCommand
$metaData = "Pass3 - Uninstall LIS Current version $LISVersion and Reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
if ( $DetectedDistro -imatch "CENTOS" -or $DetectedDistro -imatch "REDHAT" -or $DetectedDistro -imatch "ORACLE" )
{
$testResult = UninstallLIS -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData
}
else
{
LogMsg "Skipping LIS uninstallation for $DetectedDistro"
$testResult = "PASS"
}
}
"TestID5" #ReInstall Previous LIS version
{
$LISVersion = $PreviousLISVersion
$LISExtractCommand = $PreviousLISExtractCommand
$metaData = "Pass4 - ReInstall LIS Previous version $LISVersion and Reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
if ( $DetectedDistro -imatch "CENTOS" -or $DetectedDistro -imatch "REDHAT" -or $DetectedDistro -imatch "ORACLE" )
{
$testResult = ReinstallLIS -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData
}
else
{
LogMsg "Skipping LIS installation for $DetectedDistro"
$testResult = "PASS"
}
}
"TestID6" # Upgrade kernel with reboot and Verify VM boot with Inbuilt LIS drivers
{
$metaData = "Pass2 - Upgrade kernel with reboot and Verify VM boot with Inbuilt LIS drivers"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
$testResult = UpgradeKernel -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData -isReboot "YES"
}
"TestID7" # Upgrade kernel without reboot
{
$metaData = "Pass1 - Upgrade kernel without reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
$testResult = UpgradeKernel -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData -isReboot "NO"
}
"TestID8" #Install Current LIS version after upgrade kernel without reboot
{
$LISVersion = $CurrentLISVersion
$LISExtractCommand = $CurrentLISExtractCommand
$metaData = "Pass2 - Install LIS Current version $LISVersion after upgrade kernel without reboot"
mkdir "$LogDir\$metaData" -Force | Out-Null
$VMObject.LogDir = "$LogDir\$metaData"
if ( $DetectedDistro -imatch "CENTOS" -or $DetectedDistro -imatch "REDHAT" -or $DetectedDistro -imatch "ORACLE" )
{
$testResult = InstallLIS -VMObject $VMObject -PrevTestStatus $PrevTestResult -metaData $metaData -ISAbortIgnore "YES"
}
else
{
LogMsg "Skipping LIS installation for $DetectedDistro"
$testResult = "PASS"
}
}
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
$resultSummary += CreateResultSummary -testResult $testResult -metaData "$metaData" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
}
}
}
else
{
$testResult = "Aborted"
$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,$resultSummary

Просмотреть файл

@ -1,5 +1,6 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
Import-Module .\TestLibs\LISALibrary.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
@ -47,7 +48,7 @@ if ($isDeployed)
#
# PROVISION VMS FOR LISA WILL ENABLE ROOT USER AND WILL MAKE ENABLE PASSWORDLESS AUTHENTICATION ACROSS ALL VMS IN SAME HOSTED SERVICE.
#
##ProvisionVMsForLisa -allVMData $allVMData
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
#endregion

Просмотреть файл

@ -40,15 +40,15 @@ function check_exit_status ()
function detect_linux_ditribution_version()
{
local distro_version="Unknown"
if [ -f /etc/os-release ] ; then
distro_version=`cat /etc/os-release|sed 's/"//g'|grep "VERSION_ID="| sed 's/VERSION_ID=//'| sed 's/\r//'`
elif [ -f /etc/centos-release ] ; then
if [ -f /etc/centos-release ] ; then
distro_version=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/oracle-release ] ; then
distro_version=`cat /etc/oracle-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/redhat-release ] ; then
distro_version=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
fi
elif [ -f /etc/os-release ] ; then
distro_version=`cat /etc/os-release|sed 's/"//g'|grep "VERSION_ID="| sed 's/VERSION_ID=//'| sed 's/\r//'`
fi
echo $distro_version
}

Просмотреть файл

@ -76,9 +76,9 @@ InstallIPERF3()
UpdateSummary "Unknown Distro, test aborted"
return 1
fi
}
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message

Просмотреть файл

@ -123,7 +123,7 @@ LinuxRelease()
echo "CENTOS";;
*SUSE*)
echo "SLES";;
Red*Hat*)
*Red*Hat*)
echo "RHEL";;
Debian*)
echo "DEBIAN";;
@ -164,14 +164,16 @@ ConfigRhel()
javaConfig=`echo "" | update-alternatives --config java | grep "*"`
tokens=( $javaConfig )
javaPath=${tokens[2]}
if [ ! -e $javaPath ]; then
javaPath=${tokens[3]}
javaPath2=${javaPath#"("}
javaPath2=${javaPath2%")"}
if [ ! -e $javaPath2 ]; then
LogMsg "Error: Unable to find the Java install path"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
temp=`dirname $javaPath`
temp=`dirname $javaPath2`
JAVA_HOME=`dirname $temp`
if [ ! -e $JAVA_HOME ]; then
LogMsg "Error: Invalid JAVA_HOME computed: ${JAVA_HOME}"