From 427e9ec62023ce0bc286e8f814787e48fa6bf74b Mon Sep 17 00:00:00 2001 From: Adrian Suhov Date: Fri, 26 Oct 2018 13:20:10 +0300 Subject: [PATCH 1/6] azure,hyperv: Added 10 functional SR-IOV test cases This adds 9 new TCs for both Azure and Hyper-V: --VERIFY-SRIOV-LSPCI --SRIOV-VERIFY-VF-BASIC-CONNECTION --SRIOV-VERIFY-VF-BASIC-CONNECTION-MAX-VCPU --SRIOV-VERIFY-VF-MULTIPLE-CONNECTION --SRIOV-VERIFY-VF-MAX-CONNECTION --SRIOV-VERIFY-VF-MAX-CONNECTION-MAX-VCPU --SRIOV-IPERF-STRESS --SRIOV-DISABLEVF-ON-GUEST --SRIOV-RELOAD-MODULE One Hyper-V only TC was added also: --SRIOV-VERIFY-VF-BASIC-CONNECTION-ONE-VCPU One existing TC was modified and was added HyperV support: --VERIFY-SRIOV-LSPCI -> sriov_lspci.sh was removed and SRIOV-Verify-lspci.sh will now be the test script for this test case One existing TC was removed because more comprehensive Azure/HyperV test cases were added: --VERIFY-IFUP-IFDOW-ETH0-RMMOD-MODPROBE-HV_NETVSC-SRIOV use case is now done by SRIOV-DISABLEVF-ON-GUEST and SRIOV-RELOAD-MODULE test cases --- Testscripts/Linux/SR-IOV-Utils.sh | 13 +- Testscripts/Linux/SRIOV-DisableVF.sh | 108 ++++++++ Testscripts/Linux/SRIOV-Iperf-Stress.sh | 92 +++++++ Testscripts/Linux/SRIOV-ModuleReload.sh | 138 ++++++++++ Testscripts/Linux/SRIOV-Verify-lspci.sh | 32 +++ .../Linux/SRIOV-VerifyVF-Connection.sh | 119 +++++++++ Testscripts/Linux/sriov-lspci.sh | 42 --- Testscripts/Linux/utils.sh | 2 - ...down-ifup-eth0-rmmod-modprobe-hv-netvsc.sh | 2 +- Testscripts/Windows/SETUP-NET-Add-NIC.ps1 | 3 +- .../Windows/SETUP-SR-IOV-Configure.ps1 | 4 +- Testscripts/Windows/SRIOV-RUN-COMMON-TEST.ps1 | 164 ++++++++++++ XML/TestCases/FunctionalTests-SRIOV.xml | 247 ++++++++++++++++-- .../FunctionalTestsConfigurations.xml | 72 ++++- 14 files changed, 963 insertions(+), 75 deletions(-) create mode 100644 Testscripts/Linux/SRIOV-DisableVF.sh create mode 100644 Testscripts/Linux/SRIOV-Iperf-Stress.sh create mode 100644 Testscripts/Linux/SRIOV-ModuleReload.sh create mode 100644 Testscripts/Linux/SRIOV-Verify-lspci.sh create mode 100644 Testscripts/Linux/SRIOV-VerifyVF-Connection.sh delete mode 100644 Testscripts/Linux/sriov-lspci.sh create mode 100644 Testscripts/Windows/SRIOV-RUN-COMMON-TEST.ps1 diff --git a/Testscripts/Linux/SR-IOV-Utils.sh b/Testscripts/Linux/SR-IOV-Utils.sh index 3dc712fb6..39b422c84 100644 --- a/Testscripts/Linux/SR-IOV-Utils.sh +++ b/Testscripts/Linux/SR-IOV-Utils.sh @@ -74,8 +74,8 @@ VerifyVF() fi interface=$(ls /sys/class/net/ | grep -v 'eth0\|eth1\|lo' | head -1) - ifconfig -a | grep $interface - if [ $? -ne 0 ]; then + ip a | grep $interface + if [ $? -ne 0 ]; then LogErr "VF device, $interface , was not found!" SetTestStateFailed exit 1 @@ -235,6 +235,15 @@ InstallDependencies() # Check if iPerf3 is already installed iperf3 -v > /dev/null 2>&1 if [ $? -ne 0 ]; then + update_repos + gcc -v + if [ $? -ne 0 ]; then + install_package "gcc" + fi + make -v + if [ $? -ne 0 ]; then + install_package "make" + fi wget $iperf3_url if [ $? -ne 0 ]; then LogErr "Failed to download iperf3 from $iperf3_url" diff --git a/Testscripts/Linux/SRIOV-DisableVF.sh b/Testscripts/Linux/SRIOV-DisableVF.sh new file mode 100644 index 000000000..5fe137263 --- /dev/null +++ b/Testscripts/Linux/SRIOV-DisableVF.sh @@ -0,0 +1,108 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License. +# +# Description: +# Disable VF, verify SR-IOV Failover is working +# +######################################################################## +remote_user="root" +if [ ! -e sriov_constants.sh ]; then + cp /${remote_user}/sriov_constants.sh . +fi +# Source SR-IOV_Utils.sh. This is the script that contains all the +# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) +. SR-IOV-Utils.sh || { + echo "ERROR: unable to source SR-IOV_Utils.sh!" + echo "TestAborted" > state.txt + exit 0 +} + +# Check if the SR-IOV driver is in use +VerifyVF +if [ $? -ne 0 ]; then + LogErr "VF is not loaded! Make sure you are using compatible hardware" + SetTestStateFailed + exit 0 +fi +# Create an 1gb file to be sent from VM1 to VM2 +Create1Gfile +if [ $? -ne 0 ]; then + LogErr "Could not create the 1gb file on VM1!" + SetTestStateFailed + exit 0 +fi + +# Check if the VF count inside the VM is the same as the expected count +vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep -c pci) +if [ $vf_count -ne $NIC_COUNT ]; then + LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + SetTestStateFailed + exit 0 +fi +UpdateSummary "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + +# Extract VF name +synthetic_interface=$(ip addr | grep $VF_IP1 | awk '{print $NF}') +LogMsg "Synthetic interface found: $synthetic_interface" +vf_interface=$(find /sys/devices/* -name "*${synthetic_interface}*" | grep "pci" | sed 's/\// /g' | awk '{print $12}') +LogMsg "Virtual function found: $vf_interface" + +# Put VF down +ip link set dev $vf_interface down +ping -c 11 "$VF_IP2" >/dev/null 2>&1 +if [ 0 -eq $? ]; then + LogMsg "Successfully pinged $VF_IP2 with VF down" +else + LogErr "Unable to ping $VF_IP2 with VF down" + SetTestStateFailed + exit 0 +fi +# Send 1GB file from VM1 to VM2 via synthetic interface +scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$VF_IP2":/tmp/"$output_file" +if [ 0 -ne $? ]; then + LogErr "Unable to send the file from VM1 to VM2 ($VF_IP2)" + SetTestStateFailed + exit 0 +else + LogMsg "Successfully sent $output_file to $VF_IP2" +fi +# Get TX value for synthetic interface after sending the file +tx_value=$(cat /sys/class/net/${synthetic_interface}/statistics/tx_packets) +LogMsg "TX value after sending the file: $tx_value" +if [ $tx_value -lt 10000 ]; then + LogErr "Insufficient TX packets sent on ${synthetic_interface}" + SetTestStateFailed + exit 0 +fi + +# Put VF up +ip link set dev $vf_interface up +ping -c 11 "$VF_IP2" >/dev/null 2>&1 +if [ 0 -ne $? ]; then + LogErr "Unable to ping $VF_IP2 with VF down" + SetTestStateFailed + exit 0 +fi +# Send 1GB file from VM1 to VM2 via VF +scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$VF_IP2":/tmp/"$output_file" +if [ 0 -ne $? ]; then + LogErr "Unable to send the file from VM1 to VM2 ($VF_IP2)" + SetTestStateFailed + exit 0 +else + LogMsg "Successfully sent $output_file to $VF_IP2" +fi +# Get TX value for VF after sending the file +tx_value=$(cat /sys/class/net/${vf_interface}/statistics/tx_packets) +LogMsg "TX value after sending the file: $tx_value" +if [ $tx_value -lt 10000 ]; then + LogErr "Insufficient TX packets sent on ${vf_interface}" + SetTestStateFailed + exit 0 +fi + +UpdateSummary "Successfully disabled and enabled VF" +SetTestStateCompleted +exit 0 \ No newline at end of file diff --git a/Testscripts/Linux/SRIOV-Iperf-Stress.sh b/Testscripts/Linux/SRIOV-Iperf-Stress.sh new file mode 100644 index 000000000..c08c1521f --- /dev/null +++ b/Testscripts/Linux/SRIOV-Iperf-Stress.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License. +# +# Description: +# This SR-IOV test will run iPerf3 for 30 minutes and checks +# if network connectivity is lost at any point +# +######################################################################## +remote_user="root" +if [ ! -e sriov_constants.sh ]; then + cp /${remote_user}/sriov_constants.sh . +fi +export PATH="/usr/local/bin:${PATH}" +# Source SR-IOV_Utils.sh. This is the script that contains all the +# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) +. SR-IOV-Utils.sh || { + echo "ERROR: unable to source SR-IOV_Utils.sh!" + echo "TestAborted" > state.txt + exit 0 +} + +# Check if the SR-IOV driver is in use +VerifyVF +if [ $? -ne 0 ]; then + LogErr "VF is not loaded! Make sure you are using compatible hardware" + SetTestStateFailed + exit 0 +fi + +# Check if the VF count inside the VM is the same as the expected count +vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep pci | wc -l) +if [ $vf_count -ne $NIC_COUNT ]; then + LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + SetTestStateFailed + exit 0 +fi +UpdateSummary "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + +# Start iPerf server on dependency VM +ssh -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$remote_user"@"$VF_IP2" 'iperf3 -s > perfResults.log &' +if [ $? -ne 0 ]; then + LogErr "Could not start iPerf3 on VM2 (VF_IP: ${VF_IP2})" + SetTestStateFailed + exit 0 +fi + +# Start iPerf client +iperf3 -t 1800 -c ${VF_IP2} --logfile perfResults.log +if [ $? -ne 0 ]; then + LogErr "Could not start iPerf3 on VM1 (VF_IP: ${VF_IP1})" + SetTestStateFailed + exit 0 +fi + +# Check for errors +if [ ! -e perfResults.log ]; then + LogErr "iPerf3 didn't run!" + SetTestStateFailed + exit 0 +fi + +iperf_errors=$(cat perfResults.log | grep -i error) +if [ $? -eq 0 ]; then + LogErr "iPerf3 had errors while running" + LogErr $iperf_errors + SetTestStateFailed + exit 0 +fi + +# Get the throughput +throughput=$(tail -4 perfResults.log | head -1 | awk '{print $7}') +UpdateSummary "iPerf3 throughput is $throughput gbps" + +# Check the connection again +ping -c 11 ${VF_IP2} > pingResults.log +if [ $? -ne 0 ]; then + LogErr "Could not ping from VM1 to VM2 after iPerf3 finished the run" + SetTestStateFailed + exit 0 +fi +cat pingResults.log | grep " 0%" +if [ $? -ne 0 ]; then + LogErr "Ping shows that packets were lost between VM1 and VM" + SetTestStateFailed + exit 0 +fi + +UpdateSummary "Ping was succesful between VM1 and VM2 after iPerf3 finished the run" +SetTestStateCompleted +exit 0 \ No newline at end of file diff --git a/Testscripts/Linux/SRIOV-ModuleReload.sh b/Testscripts/Linux/SRIOV-ModuleReload.sh new file mode 100644 index 000000000..2b1767c26 --- /dev/null +++ b/Testscripts/Linux/SRIOV-ModuleReload.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License. +# +# Description: +# Unload/load modules using modprobe, verify SR-IOV Failover is working +# +######################################################################## +remote_user="root" +if [ ! -e sriov_constants.sh ]; then + cp /${remote_user}/sriov_constants.sh . +fi +# Source SR-IOV_Utils.sh. This is the script that contains all the +# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) +. SR-IOV-Utils.sh || { + echo "ERROR: unable to source SR-IOV_Utils.sh!" + echo "TestAborted" > state.txt + exit 0 +} + +# Check if the SR-IOV driver is in use +VerifyVF +if [ $? -ne 0 ]; then + LogErr "VF is not loaded! Make sure you are using compatible hardware" + SetTestStateFailed + exit 0 +fi +# Create an 1gb file to be sent from VM1 to VM2 +Create1Gfile +if [ $? -ne 0 ]; then + LogErr "Could not create the 1gb file on VM1!" + SetTestStateFailed + exit 0 +fi + +# Check if the VF count inside the VM is the same as the expected count +vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep -c pci) +if [ $vf_count -ne $NIC_COUNT ]; then + LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + SetTestStateFailed + exit 0 +fi +UpdateSummary "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + +# Extract VF name +synthetic_interface=$(ip addr | grep $VF_IP1 | awk '{print $NF}') +LogMsg "Synthetic interface found: $synthetic_interface" +vf_interface=$(find /sys/devices/* -name "*${synthetic_interface}*" | grep "pci" | sed 's/\// /g' | awk '{print $12}') +LogMsg "Virtual function found: $vf_interface" +# Extract module name +module_name_in_use=$(lspci -vvv | grep -i kernel | tail -1 | awk '{print $NF}') +mlnx_sts=$(echo "$module_name_in_use" | grep -c mlx) +# If it's a Mellanox module, we first need to put down mlx_en module +if [ $mlnx_sts -eq 1 ]; then + module_version=$(echo $module_name_in_use | sed 's/_/ /g' | awk '{print $1}') + primary_module="${module_version}_en" +fi + +# Unload modules +LogMsg "Unloading the modules" +if [ $mlnx_sts -eq 1 ]; then + modprobe -r $primary_module +fi +modprobe -r $module_name_in_use + +# Check if the VF count inside the VM is the same as the expected count +vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep -c pci) +if [ $vf_count -eq $NIC_COUNT ]; then + LogErr "VF is still up! Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + SetTestStateFailed + exit 0 +fi +ping -c 11 "$VF_IP2" >/dev/null 2>&1 +if [ 0 -eq $? ]; then + LogMsg "Successfully pinged $VF_IP2 after unloading $module_name_in_use" +else + LogErr "Unable to ping $VF_IP2 after unloading $module_name_in_use" + SetTestStateFailed + exit 0 +fi +# Send 1GB file from VM1 to VM2 via synthetic interface +scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$VF_IP2":/tmp/"$output_file" +if [ 0 -ne $? ]; then + LogErr "Unable to send the file from VM1 to VM2 (${VF_IP2})" + SetTestStateFailed + exit 0 +else + LogMsg "Successfully sent $output_file to $VF_IP2" +fi +# Get TX value for synthetic interface after sending the file +tx_value=$(cat /sys/class/net/${synthetic_interface}/statistics/tx_packets) +LogMsg "TX value after sending the file: $tx_value" +if [ $tx_value -lt 10000 ]; then + LogErr "Insufficient TX packets sent on ${synthetic_interface}" + SetTestStateFailed + exit 0 +fi + +# Load the module again +if [ $mlnx_sts -eq 1 ]; then + modprobe $primary_module +fi +modprobe $module_name_in_use +# Check if the VF count inside the VM is the same as the expected count +vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep -c pci) +if [ $vf_count -ne $NIC_COUNT ]; then + LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + SetTestStateFailed + exit 0 +fi +ping -c 11 "$VF_IP2" >/dev/null 2>&1 +if [ 0 -ne $? ]; then + LogErr "Unable to ping $VF_IP2 after reloading $module_name_in_use module" + SetTestStateFailed + exit 0 +fi +# Send 1GB file from VM1 to VM2 via VF +scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$VF_IP2":/tmp/"$output_file" +if [ 0 -ne $? ]; then + LogErr "Unable to send the file from VM1 to VM2 - $VF_IP2" + SetTestStateFailed + exit 0 +else + LogMsg "Successfully sent $output_file to $VF_IP2" +fi +# Get TX value for VF after sending the file +tx_value=$(cat /sys/class/net/${vf_interface}/statistics/tx_packets) +LogMsg "TX value after sending the file: $tx_value" +if [ $tx_value -lt 10000 ]; then + LogErr "insufficient TX packets sent on ${vf_interface}" + SetTestStateFailed + exit 0 +fi + +UpdateSummary "Successfully unloaded and loaded ${module_name_in_use} module" +SetTestStateCompleted +exit 0 \ No newline at end of file diff --git a/Testscripts/Linux/SRIOV-Verify-lspci.sh b/Testscripts/Linux/SRIOV-Verify-lspci.sh new file mode 100644 index 000000000..60527a2bd --- /dev/null +++ b/Testscripts/Linux/SRIOV-Verify-lspci.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License. +# +# Description: +# Verify with lspci if the necessary module is loaded. Also verify +# if VF is present in /sys/devices +# +###################################################################### +remoteUser="root" +echo "NIC_COUNT=1" >> sriov_constants.sh + +# Source SR-IOV_Utils.sh. This is the script that contains all the +# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) +. SR-IOV-Utils.sh || { + echo "ERROR: unable to source SR-IOV_Utils.sh!" + echo "TestAborted" > state.txt + exit 0 +} + +# Check if the SR-IOV driver is in use +VerifyVF +if [ $? -ne 0 ]; then + LogErr "VF is not loaded! Make sure you are using compatible hardware" + SetTestStateFailed + exit 0 +fi + +UpdateSummary "VF is in use" +SetTestStateCompleted +exit 0 \ No newline at end of file diff --git a/Testscripts/Linux/SRIOV-VerifyVF-Connection.sh b/Testscripts/Linux/SRIOV-VerifyVF-Connection.sh new file mode 100644 index 000000000..3acdc61b5 --- /dev/null +++ b/Testscripts/Linux/SRIOV-VerifyVF-Connection.sh @@ -0,0 +1,119 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License. +# Description: +# Basic SR-IOV test checks connectivity SR-IOV between two VMs +# Steps: +# 1. Verify/install pciutils package +# 2. Using the lspci command, examine the NIC with SR-IOV support +# 3. Check network capability +# 4. Send a 1GB file from VM1 to VM2 +# Note: This script can handle multiple SR-IOV interfaces +# +######################################################################## +remote_user="root" +if [ ! -e sriov_constants.sh ]; then + cp /${remote_user}/sriov_constants.sh . +fi + +# Source SR-IOV_Utils.sh. This is the script that contains all the +# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) +. SR-IOV-Utils.sh || { + echo "ERROR: unable to source SR-IOV_Utils.sh!" + echo "TestAborted" > state.txt + exit 0 +} + +# Check if the SR-IOV driver is in use +VerifyVF +if [ $? -ne 0 ]; then + LogErr "VF is not loaded! Make sure you are using compatible hardware" + SetTestStateFailed + exit 0 +fi + +# Create an 1gb file to be sent from VM1 to VM2 +Create1Gfile +if [ $? -ne 0 ]; then + LogErr "Could not create the 1gb file on VM1!" + SetTestStateFailed + exit 0 +fi + +# Check if the VF count inside the VM is the same as the expected count +vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep pci | wc -l) +if [ $vf_count -ne $NIC_COUNT ]; then + LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + SetTestStateFailed + exit 0 +fi +UpdateSummary "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" + +__iterator=1 +__ip_iterator_1=1 +__ip_iterator_2=2 +# Ping and send file from VM1 to VM2 +while [ $__iterator -le $vf_count ]; do + # Extract VF_IP values + ip_variable_name="VF_IP$__ip_iterator_1" + static_IP_1="${!ip_variable_name}" + ip_variable_name="VF_IP$__ip_iterator_2" + static_IP_2="${!ip_variable_name}" + + synthetic_interface_vm_1=$(ip addr | grep $static_IP_1 | awk '{print $NF}') + LogMsg "Synthetic interface found: $synthetic_interface_vm_1" + vf_interface_vm_1=$(find /sys/devices/* -name "*${synthetic_interface_vm_1}*" | grep "pci" | sed 's/\// /g' | awk '{print $12}') + LogMsg "Virtual function found: $vf_interface_vm_1" + + # Ping the remote host + ping -c 11 "$static_IP_2" >/dev/null 2>&1 + if [ 0 -eq $? ]; then + LogMsg "Successfully pinged $VF_IP2 through $synthetic_interface_vm_1" + else + LogErr "Unable to ping $VF_IP2 through $synthetic_interface_vm_1" + SetTestStateFailed + exit 0 + fi + + # Send 1GB file from VM1 to VM2 via eth1 + scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$static_IP_2":/tmp/"$output_file" + if [ 0 -ne $? ]; then + LogErr "Unable to send the file from VM1 to VM2 ($static_IP_2)" + SetTestStateFailed + exit 0 + else + LogMsg "Successfully sent $output_file to $VF_IP2" + fi + + tx_value=$(cat /sys/class/net/${vf_interface_vm_1}/statistics/tx_packets) + LogMsg "TX value after sending the file: $tx_value" + if [ $tx_value -lt 400000 ]; then + LogErr "insufficient TX packets sent" + SetTestStateFailed + exit 0 + fi + + # Get the VF name from VM2 + cmd_to_send="ip addr | grep \"$static_IP_2\" | awk '{print \$NF}'" + synthetic_interface_vm_2=$(ssh -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$remote_user"@"$static_IP_2" $cmd_to_send) + cmd_to_send="find /sys/devices/* -name "*${synthetic_interface_vm_2}*" | grep pci | sed 's/\// /g' | awk '{print \$12}'" + vf_interface_vm_2=$(ssh -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$remote_user"@"$static_IP_2" $cmd_to_send) + + rx_value=$(ssh -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$remote_user"@"$static_IP_2" cat /sys/class/net/${vf_interface_vm_2}/statistics/rx_packets) + LogMsg "RX value after sending the file: $rx_value" + if [ $rx_value -lt 400000 ]; then + LogErr "insufficient RX packets received" + SetTestStateFailed + exit 0 + fi + UpdateSummary "Successfully sent file from VM1 to VM2 through $synthetic_interface_vm_1" + + __ip_iterator_1=$(($__ip_iterator_1 + 2)) + __ip_iterator_2=$(($__ip_iterator_2 + 2)) + : $((__iterator++)) +done + +LogMsg "Updating test case state to completed" +SetTestStateCompleted +exit 0 \ No newline at end of file diff --git a/Testscripts/Linux/sriov-lspci.sh b/Testscripts/Linux/sriov-lspci.sh deleted file mode 100644 index 738a042ec..000000000 --- a/Testscripts/Linux/sriov-lspci.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the Apache License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# -# Sample script to run sysbench. -# In this script, we want to bench-mark device IO performance on a mounted folder. -# You can adapt this script to other situations easily like for stripe disks as RAID0. -# The only thing to keep in mind is that each different configuration you're testing -# must log its output to a different directory. -# - -# Source utils.sh -. utils.sh || { - echo "ERROR: unable to source utils.sh!" - echo "TestAborted" > state.txt - exit 2 -} - -# Source constants file and initialize most common variables -UtilsInit - -LogMsg "*********INFO: Starting test execution ... *********" -OUTPUT="$(lspci)" -LogMsg "${OUTPUT}" - -lspci | grep -i "Mellanox" - -if [[ "$?" == "0" ]]; -then - SetTestStateCompleted -else - SetTestStateFailed -fi - -LogMsg "*********INFO: Script execution completed. *********" -exit 0 \ No newline at end of file diff --git a/Testscripts/Linux/utils.sh b/Testscripts/Linux/utils.sh index a680255ea..6ff03ead7 100644 --- a/Testscripts/Linux/utils.sh +++ b/Testscripts/Linux/utils.sh @@ -128,8 +128,6 @@ UtilsInit() return 3 fi - [ -n "$TC_COVERED" ] && UpdateSummary "Test covers $TC_COVERED" || UpdateSummary "Starting unknown test due to missing TC_COVERED variable" - GetDistro && LogMsg "Testscript running on $DISTRO" || LogMsg "Warning: test running on unknown distro!" LogMsg "Successfully initialized testscript!" diff --git a/Testscripts/Linux/verify-ifdown-ifup-eth0-rmmod-modprobe-hv-netvsc.sh b/Testscripts/Linux/verify-ifdown-ifup-eth0-rmmod-modprobe-hv-netvsc.sh index 6b4fbdb41..b0d57485f 100644 --- a/Testscripts/Linux/verify-ifdown-ifup-eth0-rmmod-modprobe-hv-netvsc.sh +++ b/Testscripts/Linux/verify-ifdown-ifup-eth0-rmmod-modprobe-hv-netvsc.sh @@ -116,4 +116,4 @@ else fi LogMsg "*********INFO: Script execution completed. *********" -exit 0 +exit 0 \ No newline at end of file diff --git a/Testscripts/Windows/SETUP-NET-Add-NIC.ps1 b/Testscripts/Windows/SETUP-NET-Add-NIC.ps1 index a9e2ea9ff..1ed1fd2e2 100644 --- a/Testscripts/Windows/SETUP-NET-Add-NIC.ps1 +++ b/Testscripts/Windows/SETUP-NET-Add-NIC.ps1 @@ -141,13 +141,12 @@ function Main { } else { Add-VMNetworkAdapter -VMName $VMName -StaticMacAddress $macAddress -IsLegacy:$legacy -ComputerName $HvServer } - if ($? -ne "True") { LogErr "Error: Add-VMNetworkAdapter failed" $retVal = $False } else { if ($networkName -like '*SRIOV*') { - $(get-vm -name $VMName -ComputerName $HvServer).NetworkAdapters | Where-Object { $_.SwitchName -like 'SRIOV' } | Set-VMNetworkAdapter -IovWeight 1 + $(Get-VM -Name $VMName -ComputerName $HvServer).NetworkAdapters | Where-Object { $_.SwitchName -like '*SRIOV*' } | Set-VMNetworkAdapter -IovWeight 1 if ($? -ne $True) { LogErr "Error: Unable to enable SRIOV" $retVal = $False diff --git a/Testscripts/Windows/SETUP-SR-IOV-Configure.ps1 b/Testscripts/Windows/SETUP-SR-IOV-Configure.ps1 index 1d7cbb3d7..b0addcc11 100644 --- a/Testscripts/Windows/SETUP-SR-IOV-Configure.ps1 +++ b/Testscripts/Windows/SETUP-SR-IOV-Configure.ps1 @@ -123,7 +123,7 @@ function Main { } if (Get-VM -Name $VM2Name -ComputerName $DependencyVmHost | Where-Object { $_.State -like "Running" }) { - Stop-VM $VM2Name -ComputerName $DependencyVmHost -Force + Stop-VM $VM2Name -ComputerName $DependencyVmHost -Force -TurnOff if (-not $?) { LogErr "Unable to shut $VM2Name down (in order to add a new network Adapter)" return $False @@ -196,7 +196,7 @@ function Main { Remove-Item sriov_constants.sh -Force -EA SilentlyContinue "SSH_PRIVATE_KEY=id_rsa" | Out-File sriov_constants.sh "NETMASK=${netmask}" | Out-File sriov_constants.sh -Append - [array]::Reverse($vfIP) + [array]::Sort($vfIP) for ($i=0; $i -lt $vfIterator; $i++){ # get ip from array $j = $i + 1 diff --git a/Testscripts/Windows/SRIOV-RUN-COMMON-TEST.ps1 b/Testscripts/Windows/SRIOV-RUN-COMMON-TEST.ps1 new file mode 100644 index 000000000..8d6207856 --- /dev/null +++ b/Testscripts/Windows/SRIOV-RUN-COMMON-TEST.ps1 @@ -0,0 +1,164 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License. +param ([string] $TestParams) + +function Main { + param ( + $TestParams + ) + try { + $vmRootUser = "root" + $timeout = 600 + if ($testPlatform -eq "Azure") { + LogMsg "Setting Azure constants" + Remove-Item sriov_constants.sh -Force -EA SilentlyContinue + $TestParams.NIC_COUNT + foreach ($vmData in $allVMData) { + if ($vmData.RoleName -imatch "dependency") { + $dependencyVmData = $vmData + $dependencyVmNICs = ((Get-AzureRmVM -Name $dependencyVmData.RoleName ` + -ResourceGroupName $dependencyVmData.ResourceGroupName).NetworkProfile).NetworkInterfaces + $dependencyVmExtraNICs = $dependencyVmNICs | Where-Object {$_.Primary -eq $False} + + } else { + $testVmData = $vmData + $testVmNICs = ((Get-AzureRmVM -Name $testVmData.RoleName ` + -ResourceGroupName $testVmData.ResourceGroupName).NetworkProfile).NetworkInterfaces + $testVmExtraNICs = $testVmNICs | Where-Object {$_.Primary -eq $False} + } + } + $vmPort = $testVmData.SSHPort + $publicIp = $testVmData.PublicIP + + # Clean unnecessary variables from constants.sh + RunLinuxCmd -ip $publicIp -port $vmPort -username $user -password $password -command ` + "sed -i '/VF_/d' constants.sh ; sed -i '/MAX_/d' constants.sh ; sed -i '/NIC_/d' constants.sh ;" ` + -ignoreLinuxExitCode:$true + + LogMsg "Will add VF_IP1=$($testVmData.InternalIP) to constants" + "VF_IP1=$($testVmData.InternalIP)" | Out-File sriov_constants.sh + LogMsg "Will add VF_IP2=$($dependencyVmData.InternalIP) to constants" + "VF_IP2=$($dependencyVmData.InternalIP)" | Out-File sriov_constants.sh -Append + + # Extract IP addresses from both VMs + $ipIndex = 3 + foreach ($nic in $testVmExtraNICs) { + try { + $index = $testVmExtraNICs.IndexOf($nic) + } catch { + $index = 0 + } + $testVMNicName = $($testVmExtraNICs[$index].Id).substring($($testVmExtraNICs[$index].Id).LastIndexOf("/")+1) + $dependencyVMNicName = $($dependencyVmExtraNICs[$index].Id).substring($($dependencyVmExtraNICs[$index].Id).LastIndexOf("/")+1) + $testIPaddr = (Get-AzureRmNetworkInterface -Name $testVMNicName -ResourceGroupName ` + $testVmData.ResourceGroupName | Get-AzureRmNetworkInterfaceIpConfig ` + | Select-Object PrivateIpAddress).PrivateIpAddress + $dependencyIPaddr = (Get-AzureRmNetworkInterface -Name $dependencyVMNicName -ResourceGroupName ` + $dependencyVmData.ResourceGroupName | Get-AzureRmNetworkInterfaceIpConfig ` + | Select-Object PrivateIpAddress).PrivateIpAddress + + LogMsg "Will add VF_IP${ipIndex}=${testIPaddr} to constants" + "VF_IP${ipIndex}=${testIPaddr}" | Out-File sriov_constants.sh -Append + $ipIndex++ + LogMsg "Will add VF_IP${ipIndex}=${dependencyIPaddr} to constants" + "VF_IP${ipIndex}=${dependencyIPaddr}" | Out-File sriov_constants.sh -Append + $ipIndex++ + } + if ($ipIndex -gt 3) { + "NIC_COUNT=$($index+2)" | Out-File sriov_constants.sh -Append + } else { + "NIC_COUNT=1" | Out-File sriov_constants.sh -Append + } + + "SSH_PRIVATE_KEY=id_rsa" | Out-File sriov_constants.sh -Append + # Send sriov_constants.sh to VM + RemoteCopy -upload -uploadTo $publicIp -Port $vmPort ` + -files "sriov_constants.sh" -Username $user -password $password + if (-not $?) { + LogErr "Failed to send sriov_constants.sh to VM1!" + return $False + } + + if ($TestParams.Set_SSH -eq "yes") { + LogMsg "Setting SSH keys for both VMs" + RemoteCopy -uploadTo $publicIp -port $vmPort -files ` + ".\Testscripts\Linux\enablePasswordLessRoot.sh,.\Testscripts\Linux\utils.sh,.\Testscripts\Linux\SR-IOV-Utils.sh" ` + -username $vmRootUser -password $password -upload + RemoteCopy -uploadTo $publicIp -port $dependencyVmData.SSHPort -files ` + ".\Testscripts\Linux\enablePasswordLessRoot.sh,.\Testscripts\Linux\utils.sh,.\Testscripts\Linux\SR-IOV-Utils.sh" ` + -username $vmRootUser -password $password -upload + RunLinuxCmd -ip $publicIp -port $vmPort -username $vmRootUser -password ` + $password -command "chmod +x ~/*.sh" + RunLinuxCmd -ip $publicIp -port $dependencyVmData.SSHPort -username $vmRootUser -password ` + $password -command "chmod +x ~/*.sh" + RunLinuxCmd -ip $publicIp -port $vmPort -username $vmRootUser -password ` + $password -command "./enablePasswordLessRoot.sh ; cp -rf /root/.ssh /home/$VMUsername" + + # Copy keys from VM1 and setup VM2 + RemoteCopy -download -downloadFrom $publicIp -port $vmPort -files ` + "/root/sshFix.tar" -username $vmRootUser -password $password -downloadTo $LogDir + RemoteCopy -uploadTo $publicIp -port $dependencyVmData.SSHPort -files "$LogDir\sshFix.tar" ` + -username $vmRootUser -password $password -upload + RunLinuxCmd -ip $publicIp -port $dependencyVmData.SSHPort -username $vmRootUser -password ` + $password -command "./enablePasswordLessRoot.sh ; cp -rf /root/.ssh /home/$VMUsername" + } + + # Install dependencies on both VMs + if ($TestParams.Install_Dependencies -eq "yes") { + RunLinuxCmd -username $vmRootUser -password $password -ip $publicIp -port $vmPort ` + -command "cp /home/$user/sriov_constants.sh . ; . SR-IOV-Utils.sh; InstallDependencies" + if (-not $?) { + LogErr "Failed to install dependencies on $($testVmData.RoleName)" + return $False + } + RemoteCopy -upload -uploadTo $publicIp -Port $dependencyVmData.SSHPort ` + -files "sriov_constants.sh" -Username $user -password $password + if (-not $?) { + LogErr "Failed to send sriov_constants.sh to VM1!" + return $False + } + RunLinuxCmd -username $vmRootUser -password $password -ip $publicIp -port $dependencyVmData.SSHPort ` + -command "cp /home/$user/sriov_constants.sh . ; . SR-IOV-Utils.sh; InstallDependencies" + if (-not $?) { + LogErr "Failed to install dependencies on $($dependencyVmData.RoleName)" + return $False + } + } + + } elseif ($testPlatform -eq "HyperV") { + $vmPort = $allVMData.SSHPort + $publicIp = $allVMData.PublicIP + } + + if ($CurrentTestData.Timeout) { + $timeout = $CurrentTestData.Timeout + } + $cmdToSend = "echo '${password}' | sudo -S -s eval `"export HOME=``pwd``;bash $($TestParams.Remote_Script) > $($TestParams.Remote_Script)_summary.log 2>&1`"" + RunLinuxCmd -ip $publicIp -port $vmPort -username $user -password ` + $password -command $cmdToSend -runMaxAllowedTime $timeout + + $testResult = Collect-TestLogs -LogsDestination $LogDir -ScriptName $TestParams.Remote_Script.Split('.')[0] -TestType "sh" ` + -PublicIP $publicIp -SSHPort $vmPort -Username $user -password $password ` + -TestName $currentTestData.testName + + $resultArr += $testResult + LogMsg "Test Completed." + LogMsg "Test Result: $testResult" + } + catch { + $ErrorMessage = $_.Exception.Message + $ErrorLine = $_.InvocationInfo.ScriptLineNumber + LogErr "EXCEPTION : $ErrorMessage at line: $ErrorLine" + } + Finally { + if (!$testResult) { + $testResult = "ABORTED" + } + $resultArr += $testResult + } + + $currentTestResult.TestResult = GetFinalResultHeader -resultarr $resultArr + return $currentTestResult.TestResult +} + +Main -TestParams (ConvertFrom-StringData $TestParams.Replace(";","`n")) \ No newline at end of file diff --git a/XML/TestCases/FunctionalTests-SRIOV.xml b/XML/TestCases/FunctionalTests-SRIOV.xml index f4b418a5f..9a624fa82 100644 --- a/XML/TestCases/FunctionalTests-SRIOV.xml +++ b/XML/TestCases/FunctionalTests-SRIOV.xml @@ -6,30 +6,14 @@ SRIOV - sriov-lspci.sh - .\Testscripts\Linux\sriov-lspci.sh,.\TestScripts\Linux\utils.sh + .\Testscripts\Windows\SETUP-NET-Add-NIC.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + .\Testscripts\Linux\SRIOV-Verify-lspci.sh,.\TestScripts\Linux\utils.sh,.\Testscripts\Linux\SR-IOV-Utils.sh - TC_COVERED=Functional_SRIOV_LSPCI + Remote_Script=SRIOV-Verify-lspci.sh + NIC_1=NetworkAdapter,External,SRIOV_MLNX - Azure - Functional - SRIOV - sriov,hv_netvsc - - - VERIFY-IFUP-IFDOW-ETH0-RMMOD-MODPROBE-HV_NETVSC-SRIOV - SingleVM - Standard_D13_v2 - - SRIOV - - - TestIterations=10 - - VERIFY-TEST-SCRIPT-IN-LINUX-GUEST.ps1 - verify-ifdown-ifup-eth0-rmmod-modprobe-hv-netvsc.sh - .\Testscripts\Linux\verify-ifdown-ifup-eth0-rmmod-modprobe-hv-netvsc.sh,.\TestScripts\Linux\utils.sh - Azure + Azure,HyperV Functional SRIOV sriov,hv_netvsc @@ -63,6 +47,225 @@ SRIOV sriov,network + + SRIOV-VERIFY-VF-BASIC-CONNECTION + .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMs + + SRIOV + + .\Testscripts\Linux\SRIOV-VerifyVF-Connection.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-VerifyVF-Connection.sh + Set_SSH=yes + NIC_COUNT=1 + VF_IP1=10.0.0.40 + VF_IP2=10.0.0.60 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-VERIFY-VF-BASIC-CONNECTION-ONE-VCPU + .\TestScripts\Windows\SETUP-Change-CPU.ps1,.\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-VerifyVF-Connection.sh + SRIOVVMs + .\Testscripts\Linux\SRIOV-VerifyVF-Connection.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + VCPU=1 + NIC_COUNT=1 + VF_IP1=10.0.0.41 + VF_IP2=10.0.0.61 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + HyperV + Functional + SRIOV + sriov,network + + + SRIOV-VERIFY-VF-BASIC-CONNECTION-MAX-VCPU + .\TestScripts\Windows\SETUP-Change-CPU.ps1,.\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMs + Standard_D64_v3 + + SRIOV + + .\Testscripts\Linux\SRIOV-VerifyVF-Connection.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-VerifyVF-Connection.sh + Set_SSH=yes + VCPU=max + NIC_COUNT=1 + VF_IP1=10.0.0.42 + VF_IP2=10.0.0.62 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-VERIFY-VF-MULTIPLE-CONNECTION + .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMsTwoNICs + + SRIOV + + .\Testscripts\Linux\SRIOV-VerifyVF-Connection.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-VerifyVF-Connection.sh + Set_SSH=yes + NIC_COUNT=2 + VF_IP1=10.0.0.43 + VF_IP2=10.0.0.63 + VF_IP3=10.0.1.43 + VF_IP4=10.0.1.63 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-VERIFY-VF-MAX-CONNECTION + .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMsMaxNICs + Standard_D14_v2 + + SRIOV + + .\Testscripts\Linux\SRIOV-VerifyVF-Connection.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-VerifyVF-Connection.sh + Set_SSH=yes + NIC_COUNT=7 + MAX_NICS=yes + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-VERIFY-VF-MAX-CONNECTION-MAX-VCPU + .\TestScripts\Windows\SETUP-Change-CPU.ps1,.\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMsMaxNICs + Standard_D64_v3 + + SRIOV + + .\Testscripts\Linux\SRIOV-VerifyVF-Connection.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-VerifyVF-Connection.sh + Set_SSH=yes + VCPU=max + NIC_COUNT=7 + MAX_NICS=yes + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-IPERF-STRESS + .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMs + + SRIOV + + .\Testscripts\Linux\SRIOV-Iperf-Stress.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-Iperf-Stress.sh + Set_SSH=yes + Install_Dependencies=yes + NIC_COUNT=1 + VF_IP1=10.0.0.44 + VF_IP2=10.0.0.64 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + 2400 + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-DISABLEVF-ON-GUEST + .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMs + + SRIOV + + .\Testscripts\Linux\SRIOV-DisableVF.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-DisableVF.sh + Set_SSH=yes + NIC_COUNT=1 + VF_IP1=10.0.0.45 + VF_IP2=10.0.0.65 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + + + SRIOV-RELOAD-MODULE + .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 + SRIOV-RUN-COMMON-TEST.ps1 + SRIOVVMs + + SRIOV + + .\Testscripts\Linux\SRIOV-ModuleReload.sh,.\Testscripts\Linux\SR-IOV-Utils.sh,.\Testscripts\Linux\utils.sh + + Remote_Script=SRIOV-ModuleReload.sh + Set_SSH=yes + NIC_COUNT=1 + VF_IP1=10.0.0.46 + VF_IP2=10.0.0.66 + NETMASK=255.255.255.0 + Switch_Name=SRIOV_MLNX + SECRET_PARAMS=(VM2Name,CheckpointName) + + Azure,HyperV + Functional + SRIOV + sriov,network + SRIOV-DISABLEVF-PING .\Testscripts\Windows\SETUP-SR-IOV-Configure.ps1 diff --git a/XML/VMConfigurations/FunctionalTestsConfigurations.xml b/XML/VMConfigurations/FunctionalTestsConfigurations.xml index 78fe9cb7f..67f4cd7c7 100644 --- a/XML/VMConfigurations/FunctionalTestsConfigurations.xml +++ b/XML/VMConfigurations/FunctionalTestsConfigurations.xml @@ -519,7 +519,7 @@ SSH tcp 22 - 22 + 1111 @@ -533,10 +533,78 @@ SSH tcp 22 - 22 + 1112 + + NO + + + + Standard_D12_v2 + Standard_D12_v2 + + + SSH + tcp + 22 + 1111 + + + 1 + + + yes + + Standard_D12_v2 + Standard_D12_v2 + dependency-vm + + SSH + tcp + 22 + 1112 + + + 1 + + + + + NO + + + + Standard_D12_v2 + Standard_D12_v2 + + + SSH + tcp + 22 + 1111 + + + 7 + + + yes + + Standard_D12_v2 + Standard_D12_v2 + dependency-vm + + SSH + tcp + 22 + 1112 + + + 7 + + + From 24b86ab811045aa670d49613c00528c03192e45d Mon Sep 17 00:00:00 2001 From: Ju-Hyoung Lee Date: Mon, 29 Oct 2018 14:22:30 -0700 Subject: [PATCH 2/6] fixed a typo (#333) --- Run-LisaV2.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Run-LisaV2.ps1 b/Run-LisaV2.ps1 index d33abfee2..5abbe2a33 100644 --- a/Run-LisaV2.ps1 +++ b/Run-LisaV2.ps1 @@ -105,7 +105,7 @@ try { Set-Variable -Name shortRandomWord -Value $(-join ((65..90) | Get-Random -Count 4 | ForEach-Object {[char]$_})) -Scope Global if ( $WorkingDirectory.Length -gt $MaxDirLength) { $OriginalWorkingDirectory = $WorkingDirectory - Write-Output "Current working directory '$WorkingDirectory' length is greather than $MaxDirLength." + Write-Output "Current working directory '$WorkingDirectory' length is greater than $MaxDirLength." $TempWorkspace = "$(Split-Path $OriginalWorkingDirectory -Qualifier)" New-Item -ItemType Directory -Path "$TempWorkspace\LISAv2" -Force -ErrorAction SilentlyContinue | Out-Null New-Item -ItemType Directory -Path "$TempWorkspace\LISAv2\$shortRandomWord$shortRandomNumber" -Force -ErrorAction SilentlyContinue | Out-Null From f05b4f6f28b5905b3e958065eb548eb2bc196a54 Mon Sep 17 00:00:00 2001 From: Santosh Date: Tue, 30 Oct 2018 02:55:21 +0530 Subject: [PATCH 3/6] vhdx resize tests: Remove copy files to /root (#327) This is no longer needed after merge of PR #289 --- Testscripts/Windows/STOR-VHDX-RESIZE-GROWFS.ps1 | 10 ---------- Testscripts/Windows/STOR-VHDX-RESIZE-GROWSHRINK.ps1 | 9 --------- 2 files changed, 19 deletions(-) diff --git a/Testscripts/Windows/STOR-VHDX-RESIZE-GROWFS.ps1 b/Testscripts/Windows/STOR-VHDX-RESIZE-GROWFS.ps1 index 878b8f58d..568c459e7 100644 --- a/Testscripts/Windows/STOR-VHDX-RESIZE-GROWFS.ps1 +++ b/Testscripts/Windows/STOR-VHDX-RESIZE-GROWFS.ps1 @@ -64,7 +64,6 @@ Function Set-HardDiskSize $sd = "sdb" } $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'deviceName=/dev/$sd' >> constants.sh" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/constants.sh /root/" -runAsSudo # Do a request & rescan to refresh the disks info $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "fdisk -l > /dev/null" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 1 > /sys/block/$sd/device/rescan" -runAsSudo @@ -82,7 +81,6 @@ Function Set-HardDiskSize # if file size larger than 2T (2048G), use parted to format disk $guestScript = "STOR_VHDXResize_PartitionDisk.sh" $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'rerun=yes' >> constants.sh" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/constants.sh /root/" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "./$guestScript" -runAsSudo if (-not $ret) { $testResult = "FAIL" @@ -141,13 +139,6 @@ Function Main Throw "$controllerType $vhdxDrive.ControllerNumber $vhdxDrive.ControllerLocation virtual disk is not a .vhdx file." } - # Copy files from home of user to home of root - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "chmod +x *.sh" - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/STOR_VHDXResize_ReadWrite.sh /root/" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/STOR_VHDXResize_PartitionDisk.sh /root/" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/STOR_VHDXResize_GrowFSAfterResize.sh /root/" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/check_traces.sh /root/" -runAsSudo - $fileSystems = $testParameters.fileSystems.Trim("(",")") $fileSystems = @($fileSystems.Split(" ")) foreach ($fs in $fileSystems) { @@ -168,7 +159,6 @@ Function Main $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'fs=$fs' >> constants.sh" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "sed -i '/rerun=yes/d' constants.sh" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'deviceName=/dev/sdc' >> constants.sh" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/constants.sh /root/" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "./STOR_VHDXResize_GrowFSAfterResize.sh" -runAsSudo if (-not $ret) { $testResult = "FAIL" diff --git a/Testscripts/Windows/STOR-VHDX-RESIZE-GROWSHRINK.ps1 b/Testscripts/Windows/STOR-VHDX-RESIZE-GROWSHRINK.ps1 index 70da664e8..0785acb65 100644 --- a/Testscripts/Windows/STOR-VHDX-RESIZE-GROWSHRINK.ps1 +++ b/Testscripts/Windows/STOR-VHDX-RESIZE-GROWSHRINK.ps1 @@ -62,7 +62,6 @@ Function Set-HardDiskSize $sd = "sdb" } $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'deviceName=/dev/$sd' >> constants.sh" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/constants.sh /root/" -runAsSudo # Do a request & rescan to refresh the disks info $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "fdisk -l > /dev/null" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 1 > /sys/block/$sd/device/rescan" -runAsSudo @@ -80,12 +79,10 @@ Function Set-HardDiskSize # if file size larger than 2T (2048G), use parted to format disk if ([int]($newSize/1gb) -gt 2048) { $guestScript = "STOR_VHDXResize_PartitionDiskOver2TB.sh" - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/$guestScript /root/" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "./$guestScript" -runAsSudo -runMaxAllowedTime 1200 } else { $guestScript = "STOR_VHDXResize_PartitionDisk.sh" $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'rerun=yes' >> constants.sh" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/constants.sh /root/" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "./$guestScript" -runAsSudo } if (-not $ret) { @@ -158,14 +155,8 @@ Function Main Throw "Insufficent disk free space, This test case requires ${testParameters.NewSize} free, Current free space is $($diskInfo.FreeSpace)" } - # Copy files from home of user to home of root - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/STOR_VHDXResize_ReadWrite.sh /root/" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/STOR_VHDXResize_PartitionDisk.sh /root/" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/check_traces.sh /root/" -runAsSudo - # Make sure if we can perform Read/Write operations on the guest VM $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "echo 'deviceName=/dev/sdc' >> constants.sh" -runAsSudo - $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "cp -f /home/$user/constants.sh /root/" -runAsSudo $ret = RunLinuxCmd -ip $ip -port $port -username $user -password $password -command "./STOR_VHDXResize_PartitionDisk.sh" -runAsSudo if (-not $ret) { $testResult = "FAIL" From 378204b62d13d517124d37325c16c11db81d0ceb Mon Sep 17 00:00:00 2001 From: Sean Spratt Date: Mon, 29 Oct 2018 15:37:55 -0700 Subject: [PATCH 4/6] Fixed CreationTime -- Simplified Tag/VmSize/VmLocation. CreationTime can also be read from VM Tag. (#319) * Partial: Fixed CreationTime, vmindex, and began to add ColumnsToDisplay. AND logic still broken. * Added back in DisableNameChecking * Corrected Filter logic, Updated Age loading for undefined CreationTime. * Removing vm tag from ALL results when -IncludeAge, not just the undefined ones. --- Utilities/Get-AzureVMs.ps1 | 191 ++++++++++++++++++++----------------- 1 file changed, 101 insertions(+), 90 deletions(-) diff --git a/Utilities/Get-AzureVMs.ps1 b/Utilities/Get-AzureVMs.ps1 index 7aab0879c..2d33bed59 100644 --- a/Utilities/Get-AzureVMs.ps1 +++ b/Utilities/Get-AzureVMs.ps1 @@ -14,10 +14,10 @@ param #Load libraries Get-ChildItem ..\Libraries -Recurse | Where-Object { $_.FullName.EndsWith(".psm1") } | ForEach-Object { Import-Module $_.FullName -Force -Global -DisableNameChecking } - #When given -UseSecretsFile or an AzureSecretsFile path, we will attempt to search the path or the environment variable. if( $UseSecretsFile -or $AzureSecretsFile ) { + LogMsg "Evaluating Secrets File" #Read secrets file and terminate if not present. if ($AzureSecretsFile) { @@ -45,6 +45,7 @@ if( $UseSecretsFile -or $AzureSecretsFile ) } } +# Determine the age by finding the creation time for the osdrive of the VM. function Get-VMAgeFromDisk() { param @@ -90,136 +91,146 @@ function Get-VMAgeFromDisk() $ageDays } + #Get all VMs and enumerate thru them adding items to results list. $allVMs = Get-AzureRmVM $allRGs = Get-AzureRmResourceGroup $results = @() - - -$usingRegion = $false -$usingVmSize = $false -$usingTags = $false - foreach ($vm in $allVMs) { - $include = $false - $hasFailed = $false + $rg = $allRGs | Where-Object ResourceGroupName -eq $vm.ResourceGroupName + + $result = New-Object psobject + $result | Add-Member VMName $($vm.Name) + $result | Add-Member Size $($vm.HardwareProfile.VmSize) + $result | Add-Member Region $($vm.Location) + $result | Add-Member ResourceGroupName $($rg.ResourceGroupName) - #Check to see if the Region is being used. - if( $Region -ne "" ) + #Timestamp Date + $PotentialDate = (($result.ResourceGroupName).Split("-") | Select-Object -Last 1) + '000000' + $PossibleDate = $( $PotentialDate -match "^\d" -and $PotentialDate.Length -eq 18 ) + if( $PossibleDate -eq $true ) { - $usingRegion = $true - if( $vm.Location -like $Region ) + $when = $([datetime]([long]$PotentialDate)) + $ageInDays = ([datetime]::Now - $when).Days + $result | Add-Member Age $ageInDays + } + #Get Tags (And Tag date if Timestamp wasn't there.) + if( $rg.Tags ) + { + if( $rg.Tags.BuildURL ) { - $include = $true + $result | Add-Member BuildURL $rg.Tags.BuildURL } - else { - $include = $false - $hasFailed = $true + if( $rg.Tags.TestName ) + { + $result | Add-Member TestName $rg.Tags.TestName } - } - #Check to see if the VmSize is being used. - if( $VmSize -ne "" -and $hasFailed -eq $false ) - { - $usingVmSize = $true - if( $vm.HardwareProfile.VmSize -like $VmSize ) + if( $rg.Tags.BuildUser ) { - $include = $true + $result | Add-Member BuildUser $rg.Tags.BuildUser } - else { - $include = $false - $hasFailed = $true + if( $rg.Tags.BuildMachine ) + { + $result | Add-Member BuildMachine $rg.Tags.BuildMachine } - } - #Check to see if the comma seperated values in Tags are like any tags on the ResourceGroup. - if( $Tags -ne "" -and $hasFailed -eq $false ) - { - $include = $false - $usingTags = $true - $eachTag = $Tags -Split "," - $rg = $allRGs | Where ResourceGroupName -eq $vm.ResourceGroupName - foreach( $tag in $eachTag ) + if( $rg.Tags.CreationTime ) { - if( $rg.Tags.BuildUrl -like $tag ) - { - $include = $true - } - if( $rg.Tags.BuildUser -like $tag ) + $result | Add-Member CreationTime $rg.Tags.CreationTime + #Update the age if we haven't already collected it. + #This script is unlikely to execute unless we stop using a timestamp in our resource names. + if( $null -ieq $result.Age ) { - $include = $true - } - if( $rg.Tags.BuildMachine -like $tag ) - { - $include = $true - } - if( $rg.Tags.TestName -like $tag ) - { - $include = $true + $ageInDays = ([datetime]::Now - $rg.Tags.CreationTime).Days + $result | Add-Member Age $ageInDays } } - if( $include -eq $false ) + } + #Check to see if the VM itself has it's own CreationTime tag. If so, use that. + #CreationTime tags can be added to individual VMs using Az CLI + # Example: az vm update --resource-group $rgName --name $vmName --set tags.CreationTime='08/08/2018 17:04:53' + if( !($null -ieq $vm.Tags.CreationTime) ) + { + if( $result.Age ) { - $hasFailed = $true + $result.PSObject.Properties.Remove( 'Age' ) } + $vmCreate = [datetime]"$($vm.Tags.CreationTime)" + $ageInDays = ([datetime]::Now - $vmCreate).Days + $result | Add-Member Age $ageInDays } - if( $hasFailed -eq $false ) + #Finally compute the long time running age for remaining machines by looking at the disk details. + if( $null -ieq $result.Age ) # Tag not present. { - #Check for NO filters. - if( $usingRegion -eq $usingVmSize -and $usingVmSize -eq $usingTags -and $usingVmSize -eq $false ) + #This is a time-consuming process and shouldn't be used without intent. + if( $IncludeAge ) { - $include = $true + $result | Add-Member vm $vm } + $result | Add-Member Age "Undefined" } + $results += $result +} - if( $include -eq $true ) +#Apply the filters. +# Region AND Size AND Tags +# Since we have already accumulated ALL the items, let's walk thru the selected filters +# and remove entries that do not match. +if( $Region ) +{ + $filteredResults = @() + foreach( $result in $results ) { - $result = @{ - 'VMName' = $vm.Name - 'VMSize' = $vm.HardwareProfile.VmSize - 'VMRegion' = $vm.Location - 'ResourceGroupName' = $vm.ResourceGroupName - 'vm' = $vmIndex + if( $result.Region -like $Region ) + { + $filteredResults += $result } - $results += $result } + $results = $filteredResults } -$results = $results | Foreach-Object { [pscustomobject] $_ } -#Now add the resource group details. -foreach( $result in $results ) +if( $VmSize ) { - $rg = $allRGs | Where ResourceGroupName -eq $result.ResourceGroupName - $result | Add-Member BuildURL $rg.Tags.BuildURL - $result | Add-Member BuildUser $rg.Tags.BuildUser - $result | Add-Member TestName $rg.Tags.TestName - $result | Add-Member CreationDate $rg.Tags.CreationDate - - if( $rg.Tags.CreationDate ) - { - $days = ([DateTime]::Now - $rg.Tags.CreationDate).Days - $result | Add-Member RGAge $days + $filteredResults = @() + foreach( $result in $results ) + { + if( $result.Size -like $VmSize ) + { + $filteredResults += $result + } } - else { - $result | Add-Member RGAge "" + $results = $filteredResults +} +if( $Tags ) +{ + $filteredResults = @() + foreach( $result in $results ) + { + if( ($result.BuildUser -like $Tags) -or + ($result.BuildMachine -like $Tags) -or + ($result.TestName -like $Tags) -or + ($result.BuildURL -like $Tags ) ) + { + $filteredResults += $result + } } + $results = $filteredResults } -#Perform costly age check +#Finally compute ages for 'Undefined' ages when -IncludeAge switch is being used. +#If this option is used, we will retrieve details from the blob or managed disk. if( $IncludeAge ) { - $ageIndex = 0 - LogMsg "Collecting VM age from disk details for $($results.Length) machines." foreach( $result in $results ) { - $result | Add-Member VMAge (Get-VMAgeFromDisk $allVms[$result.vm]) - $ageIndex = $ageIndex + 1 + if( $result.Age -eq "Undefined" ) + { + $result.PsObject.Properties.Remove( 'Age' ) + $result | Add-Member Age $(Get-VMAgeFromDisk $result.vm) + } + $result.PsObject.Properties.Remove( 'vm' ) } } -#trim out the vm index. -foreach( $result in $results ) -{ - $result.PSObject.Properties.Remove('vm') -} #output the table -$results | Format-Table \ No newline at end of file +$results | Format-Table -Property VMname, Region, Size, Age, BuildUser, TestName, ResourceGroupName \ No newline at end of file From 867d5f731bbb2d9775c2bd85b2c3cc2d7216ca51 Mon Sep 17 00:00:00 2001 From: "Lili Deng (Wicresoft North America Ltd)" Date: Thu, 25 Oct 2018 18:29:32 -0700 Subject: [PATCH 5/6] Support performance testing against CoreOS --- Libraries/CommonFunctions.psm1 | 2 +- Libraries/Test-Framework.psm1 | 2 +- .../Linux/BVT-CORE-TIME-CLOCKSOURCE.sh | 2 +- Testscripts/Linux/enableRoot.sh | 12 ++- Testscripts/Linux/fio_jason_parser.sh | 15 ++- Testscripts/Linux/perf_fio.sh | 76 ++++++--------- Testscripts/Linux/perf_iperf3.sh | 28 +++--- Testscripts/Linux/perf_lagscope.sh | 16 ++- Testscripts/Linux/perf_netperf.sh | 57 ++++++----- Testscripts/Linux/perf_ntttcp.sh | 75 ++++++++------ Testscripts/Linux/utils.sh | 97 +++++++++++++++++-- .../Windows/NESTED-HYPERV-STORAGE-PERF.ps1 | 2 +- .../Windows/NESTED-KVM-STORAGE-PERF.ps1 | 2 +- .../PERF-STORAGE-MULTIDISK-RAID0-FIO.ps1 | 4 +- Testscripts/Windows/PERF-STORAGE-OVER-NFS.ps1 | 2 +- 15 files changed, 253 insertions(+), 139 deletions(-) diff --git a/Libraries/CommonFunctions.psm1 b/Libraries/CommonFunctions.psm1 index a398bea9a..140843979 100644 --- a/Libraries/CommonFunctions.psm1 +++ b/Libraries/CommonFunctions.psm1 @@ -180,7 +180,7 @@ Function ProvisionVMsForLisa($allVMData, $installPackagesOnRoleNames) foreach ( $vmData in $allVMData ) { LogMsg "Configuring $($vmData.RoleName) for LISA test..." - RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\Testscripts\Linux\enableRoot.sh,.\Testscripts\Linux\enablePasswordLessRoot.sh,.\Testscripts\Linux\provisionLinuxForLisa.sh" -username $user -password $password -upload + RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\Testscripts\Linux\utils.sh,.\Testscripts\Linux\enableRoot.sh,.\Testscripts\Linux\enablePasswordLessRoot.sh,.\Testscripts\Linux\provisionLinuxForLisa.sh" -username $user -password $password -upload $Null = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "chmod +x /home/$user/*.sh" -runAsSudo $rootPasswordSet = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort ` -username $user -password $password -runAsSudo ` diff --git a/Libraries/Test-Framework.psm1 b/Libraries/Test-Framework.psm1 index 6420c886c..f870e89ee 100644 --- a/Libraries/Test-Framework.psm1 +++ b/Libraries/Test-Framework.psm1 @@ -255,7 +255,7 @@ function Enable-RootUser { foreach ($VM in $VMData) { RemoteCopy -upload -uploadTo $VM.PublicIP -Port $VM.SSHPort ` - -files ".\Testscripts\Linux\enableRoot.sh" -Username $Username -password $Password + -files ".\Testscripts\Linux\utils.sh,.\Testscripts\Linux\enableRoot.sh" -Username $Username -password $Password $cmdResult = RunLinuxCmd -Command "bash enableRoot.sh -password ${RootPassword}" -runAsSudo ` -Username $Username -password $Password -ip $VM.PublicIP -Port $VM.SSHPort if (-not $cmdResult) { diff --git a/Testscripts/Linux/BVT-CORE-TIME-CLOCKSOURCE.sh b/Testscripts/Linux/BVT-CORE-TIME-CLOCKSOURCE.sh index e52b87f08..86903ba17 100644 --- a/Testscripts/Linux/BVT-CORE-TIME-CLOCKSOURCE.sh +++ b/Testscripts/Linux/BVT-CORE-TIME-CLOCKSOURCE.sh @@ -53,7 +53,7 @@ CheckSource() fi # check dmesg with hyperv_clocksource - if [[ detect_linux_distribution -eq clear-linux-os ]]; then + if [[ $(detect_linux_distribution) == clear-linux-os ]]; then __dmesg_output=$(dmesg | grep -e "clocksource $clocksource") else __dmesg_output=$(grep -rnw '/var/log' -e "clocksource $clocksource" --ignore-case) diff --git a/Testscripts/Linux/enableRoot.sh b/Testscripts/Linux/enableRoot.sh index 0c0ed1317..0c4fbcc78 100644 --- a/Testscripts/Linux/enableRoot.sh +++ b/Testscripts/Linux/enableRoot.sh @@ -10,7 +10,10 @@ while echo $1 | grep ^- > /dev/null; do shift done -. utils.sh +. utils.sh || { + echo "Error: missing utils.sh file." + exit 10 +} password=$password sshd_configFilePath="/etc/ssh/sshd_config" @@ -25,7 +28,7 @@ if [ $? == 0 ]; then if [ $? == 0 ]; then echo "$sshd_configFilePath verifed for root login." echo "ROOT_PASSWRD_SET" - if [[ detect_linux_distribution -eq clear-linux-os ]]; then + if [[ $(detect_linux_distribution) == clear-linux-os ]]; then echo "Clear OS system, need extra steps" echo 'PermitRootLogin yes' >> $sshd_configFilePath echo 'ClientAliveInterval 1200' >> $sshd_configFilePath @@ -33,6 +36,11 @@ if [ $? == 0 ]; then sed -i 's/.*ExecStart=.*/ExecStart=\/usr\/sbin\/sshd -D $OPTIONS -f \/etc\/ssh\/sshd_config/g' /usr/lib/systemd/system/sshd.service systemctl daemon-reload fi + if [[ $(detect_linux_distribution) == coreos ]]; then + echo "Enable root against COREOS" + echo 'PermitRootLogin yes' >> $sshd_configFilePath + systemctl daemon-reload + fi service $sshdServiceName restart || systemctl restart sshd.service sshdServiceStatus=$? if [ $sshdServiceStatus != 0 ]; then diff --git a/Testscripts/Linux/fio_jason_parser.sh b/Testscripts/Linux/fio_jason_parser.sh index 23779e0e4..40ecddc4f 100644 --- a/Testscripts/Linux/fio_jason_parser.sh +++ b/Testscripts/Linux/fio_jason_parser.sh @@ -1,5 +1,9 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the Apache License. +. utils.sh || { + echo "Error: missing utils.sh file." + exit 10 +} csv_file=perf_fio.csv csv_file_tmp=output_tmp.csv echo $file_name @@ -7,6 +11,7 @@ echo $csv_file rm -rf $csv_file echo "Iteration,TestType,BlockSize,Threads,Jobs,TotalIOPS,ReadIOPS,MaxOfReadMeanLatency,ReadMaxLatency,ReadBw,WriteIOPS,MaxOfWriteMeanLatency,WriteMaxLatency,WriteBw" > $csv_file_tmp +bc_cmd=`echo $(Get_BC_Command)` json_list=(`ls *.json`) count=0 while [ "x${json_list[$count]}" != "x" ] @@ -14,7 +19,7 @@ do file_name=${json_list[$count]} Iteration=`echo -e $file_name |gawk -f JSON.awk|grep '"jobname"'| tail -1| sed 's/.*]//'| sed 's/[[:blank:]]//g'| sed 's/"iteration\(.*\)"/\1/'` Jobs=`echo -e $file_name |awk -f JSON.awk|grep '"jobname"'| wc -l` - ReadIOPS=`echo -e $file_name |awk -f JSON.awk|grep '"read","iops"'| sed 's/.*]//' | paste -sd+ - | bc` + ReadIOPS=`echo -e $file_name |awk -f JSON.awk|grep '"read","iops"'| sed 's/.*]//' | paste -sd+ - | ${bc_cmd}` MaxOfReadMeanLatency=`echo -e $file_name |awk -f JSON.awk|grep '"read","lat","mean"'| sed 's/.*]//'| sed 's/[[:blank:]]//g'|sort -g|tail -1` if [[ $MaxOfReadMeanLatency == '' ]];then MaxOfReadMeanLatency=`echo -e $file_name |awk -f JSON.awk|grep '"read","lat_ns","mean"' | sed 's/.*]//'| sed 's/[[:blank:]]//g'|sort -g|tail -1|awk '{print $1/1000}'` @@ -25,8 +30,8 @@ do ReadMaxLatency=`echo -e $file_name |awk -f JSON.awk|grep '"read","lat_ns","max"' | sed 's/.*]//'| sed 's/[[:blank:]]//g'|sort -g|tail -1|awk '{print $1/1000}'` fi - ReadBw=`echo -e $file_name |awk -f JSON.awk|grep '"read","bw"'| sed 's/.*]//'| sed 's/[[:blank:]]//g'| paste -sd+ - | bc` - WriteIOPS=`echo -e $file_name |awk -f JSON.awk|grep '"write","iops"'| sed 's/.*]//' | paste -sd+ - | bc` + ReadBw=`echo -e $file_name |awk -f JSON.awk|grep '"read","bw"'| sed 's/.*]//'| sed 's/[[:blank:]]//g'| paste -sd+ - | ${bc_cmd}` + WriteIOPS=`echo -e $file_name |awk -f JSON.awk|grep '"write","iops"'| sed 's/.*]//' | paste -sd+ - | ${bc_cmd}` MaxOfWriteMeanLatency=`echo -e $file_name |awk -f JSON.awk|grep '"write","lat","mean"'| sed 's/.*]//'| sed 's/[[:blank:]]//g'|sort -g|tail -1` if [[ $MaxOfWriteMeanLatency == '' ]];then MaxOfWriteMeanLatency=`echo -e $file_name |awk -f JSON.awk|grep '"write","lat_ns","mean"' | sed 's/.*]//'| sed 's/[[:blank:]]//g'|sort -g|tail -1|awk '{print $1/1000}'` @@ -37,10 +42,10 @@ do WriteMaxLatency=`echo -e $file_name |awk -f JSON.awk|grep '"write","lat_ns","max"' | sed 's/.*]//'| sed 's/[[:blank:]]//g'|sort -g|tail -1|awk '{print $1/1000}'` fi - WriteBw=`echo -e $file_name |awk -f JSON.awk|grep '"write","bw"'| sed 's/.*]//'| sed 's/[[:blank:]]//g'| paste -sd+ - | bc` + WriteBw=`echo -e $file_name |awk -f JSON.awk|grep '"write","bw"'| sed 's/.*]//'| sed 's/[[:blank:]]//g'| paste -sd+ - | ${bc_cmd}` IFS='-' read -r -a array <<< "$file_name" TestType=${array[2]} - BlockSize=${array[3]} + BlockSize=${array[3]} Threads=`echo "${array[4]}"| sed "s/td\.json//"` TotalIOPS=`echo $ReadIOPS $WriteIOPS | awk '{printf "%d\n", $1+$2}'` echo "$Iteration,$TestType,$BlockSize,$Threads,$Jobs,$TotalIOPS,$ReadIOPS,$MaxOfReadMeanLatency,$ReadMaxLatency,$ReadBw,$WriteIOPS,$MaxOfWriteMeanLatency,$WriteMaxLatency,$WriteBw" >> $csv_file_tmp diff --git a/Testscripts/Linux/perf_fio.sh b/Testscripts/Linux/perf_fio.sh index 22f5703d0..7c64896d0 100644 --- a/Testscripts/Linux/perf_fio.sh +++ b/Testscripts/Linux/perf_fio.sh @@ -54,8 +54,8 @@ UpdateTestState() RunFIO() { - UpdateTestState ICA_TESTRUNNING - FILEIO="--size=${fileSize} --direct=1 --ioengine=libaio --filename=fiodata --overwrite=1 " + UpdateTestState $ICA_TESTRUNNING + FILEIO="--size=${fileSize} --direct=1 --ioengine=libaio --filename=${mdVolume} --overwrite=1 " #################################### #All run config set here @@ -102,11 +102,6 @@ RunFIO() echo "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE chmod 666 $LOGFILE - echo "Preparing Files: $FILEIO" - echo "Preparing Files: $FILEIO" >> $LOGFILE - LogMsg "Preparing Files: $FILEIO" - # Remove any old files from prior runs (to be safe), then prepare a set of new files. - rm fiodata echo "--- Kernel Version Information ---" >> $LOGFILE uname -a >> $LOGFILE cat /proc/version >> $LOGFILE @@ -117,23 +112,15 @@ RunFIO() fi echo "--- PCI Bus Information ---" >> $LOGFILE lspci >> $LOGFILE - echo "--- Drive Mounting Information ---" >> $LOGFILE - mount >> $LOGFILE - echo "--- Disk Usage Before Generating New Files ---" >> $LOGFILE df -h >> $LOGFILE fio --cpuclock-test >> $LOGFILE - fio $FILEIO --readwrite=read --bs=1M --runtime=1 --iodepth=128 --numjobs=8 --name=prepare - echo "--- Disk Usage After Generating New Files ---" >> $LOGFILE - df -h >> $LOGFILE - echo "=== End Preparation $(date +"%x %r %Z") ===" >> $LOGFILE - LogMsg "Preparing Files: $FILEIO: Finished." #################################### #Trigger run from here for testmode in $modes; do io=$startIO while [ $io -le $maxIO ] do - Thread=$startThread + Thread=$startThread while [ $Thread -le $maxThread ] do if [ $Thread -ge 8 ] @@ -143,7 +130,7 @@ RunFIO() numjobs=$Thread fi iostatfilename="${IOSTATLOGDIR}/iostat-fio-${testmode}-${io}K-${Thread}td.txt" - nohup iostat -x 5 -t -y > $iostatfilename & + nohup $iostat_cmd -x 5 -t -y > $iostatfilename & #capture blktrace output during test #LogMsg "INFO: start blktrace for 40 sec on device sdd and sdf" #blk_operation="${blk_base}/blktrace-fio-${testmode}-${io}K-${Thread}td/" @@ -153,19 +140,22 @@ RunFIO() echo "-- iteration ${iteration} ----------------------------- ${testmode} test, ${io}K bs, ${Thread} threads, ${numjobs} jobs, 5 minutes ------------------ $(date +"%x %r %Z") ---" >> $LOGFILE LogMsg "Running ${testmode} test, ${io}K bs, ${Thread} threads ..." jsonfilename="${JSONFILELOG}/fio-result-${testmode}-${io}K-${Thread}td.json" - fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --output-format=json --output=$jsonfilename --name="iteration"${iteration} >> $LOGFILE + echo "${fio_cmd} $FILEIO --readwrite=${testmode} --bs=${io}K --runtime=${ioruntime} --iodepth=${Thread} --numjobs=${numjobs} --output-format=json --output=${jsonfilename} --name='iteration'${iteration}" >> $LOGFILE + $fio_cmd $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --output-format=json --output=$jsonfilename --name="iteration"${iteration} >> $LOGFILE #fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --name="iteration"${iteration} --group_reporting >> $LOGFILE iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'` kill -9 $iostatPID - Thread=$(( Thread*2 )) + Thread=$(( Thread*2 )) iteration=$(( iteration+1 )) + if [[ $(detect_linux_distribution) == coreos ]]; then + Kill_Process 127.0.0.1 fio + fi done io=$(( io * io_increment )) done done #################################### echo "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE - rm fiodata compressedFileName="${HOMEDIR}/FIOTest-$(date +"%m%d%Y-%H%M%S").tar.gz" LogMsg "INFO: Please wait...Compressing all results to ${compressedFileName}..." @@ -203,20 +193,6 @@ CreateRAID0() LogMsg "INFO: Creating RAID of ${count} devices." sleep 1 mdadm --create ${mdVolume} --level 0 --raid-devices ${count} /dev/sd[c-z][1-5] - sleep 1 - time mkfs -t $1 -F ${mdVolume} - mkdir ${mountDir} - sleep 1 - mount -o nobarrier ${mdVolume} ${mountDir} - if [ $? -ne 0 ]; then - LogMsg "Error: Unable to create raid" - exit 1 - else - LogMsg "${mdVolume} mounted to ${mountDir} successfully." - fi - - #LogMsg "INFO: adding fstab entry" - #echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab } CreateLVM() @@ -245,16 +221,6 @@ CreateLVM() pvcreate /dev/sd[c-z][1-5] vgcreate ${vggroup} /dev/sd[c-z][1-5] lvcreate -l 100%FREE -i 12 -I 64 ${vggroup} -n lv1 - time mkfs -t $1 -F /dev/${vggroup}/lv1 - mkdir ${mountDir} - mount -o nobarrier /dev/${vggroup}/lv1 ${mountDir} - if [ $? -ne 0 ]; then - LogMsg "Error: Unable to create LVM " - exit 1 - fi - - #LogMsg "INFO: adding fstab entry" - #echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab } ############################################################ @@ -272,18 +238,30 @@ else mdVolume="/dev/md0" fi vggroup="vg1" -mountDir="/data" cd ${HOMEDIR} install_fio +if [ $? -ne 0 ]; then + LogMsg "Error: install fio failed" + UpdateTestState "TestAborted" + exit 1 +fi + +if [[ $(detect_linux_distribution) == coreos ]]; then + Delete_Containers + fio_cmd="docker run -v $HOMEDIR/FIOLog/jsonLog:$HOMEDIR/FIOLog/jsonLog --device ${mdVolume} lisms/fio" + iostat_cmd="docker run --network host lisms/toolbox iostat" +else + fio_cmd="fio" + iostat_cmd="iostat" +fi + #Creating RAID before triggering test -CreateRAID0 ext4 -#CreateLVM ext4 +CreateRAID0 +#CreateLVM #Run test from here LogMsg "*********INFO: Starting test execution*********" -cd ${mountDir} -mkdir sampleDIR RunFIO LogMsg "*********INFO: Script execution reach END. Completed !!!*********" diff --git a/Testscripts/Linux/perf_iperf3.sh b/Testscripts/Linux/perf_iperf3.sh index 0b5981593..4b1d9b3fd 100644 --- a/Testscripts/Linux/perf_iperf3.sh +++ b/Testscripts/Linux/perf_iperf3.sh @@ -138,7 +138,6 @@ fi LogMsg "Configuring client ${client}..." ssh ${client} ". $UTIL_FILE && install_iperf3 $IPversion" -ssh ${client} "which iperf3" if [ $? -ne 0 ]; then LogMsg "Error: iperf installation failed in ${client}.." UpdateTestState "TestAborted" @@ -147,13 +146,20 @@ fi LogMsg "Configuring server ${server}..." ssh ${server} ". $UTIL_FILE && install_iperf3 $IPversion" -ssh ${server} "which iperf3" if [ $? -ne 0 ]; then LogMsg "Error: iperf installation failed in ${server}.." UpdateTestState "TestAborted" exit 1 fi +if [[ $(detect_linux_distribution) == coreos ]]; then + iperf3_cmd="docker run --network host lisms/iperf3" + ssh root@${server} ". $UTIL_FILE && Delete_Containers" + ssh root@${client} ". $UTIL_FILE && Delete_Containers" +else + iperf3_cmd="iperf3" +fi + ssh ${server} "rm -rf iperf-server-*" ssh ${client} "rm -rf iperf-client-*" ssh ${client} "rm -rf iperf-server-*" @@ -173,15 +179,15 @@ for current_buffer in "${bufferLengths[@]}"; do num_threads_n=$(($current_test_connections / $num_threads_P)) fi - ssh ${server} "killall iperf3" - ssh ${client} "killall iperf3" + Kill_Process ${server} iperf3 + Kill_Process ${client} iperf3 LogMsg "Starting $num_threads_n iperf3 server instances on $server.." startPort=750 currentPort=$startPort currentIperfInstanses=0 while [ $currentIperfInstanses -lt $num_threads_n ]; do currentIperfInstanses=$(($currentIperfInstanses+1)) - serverCommand="iperf3 -s -1 -J -i10 -f g -p ${currentPort} > iperf-server-${testType}-IPv${IPversion}-buffer-${current_buffer}-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1" + serverCommand="${iperf3_cmd} -s -1 -J -i10 -f g -p ${currentPort} > iperf-server-${testType}-IPv${IPversion}-buffer-${current_buffer}-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1" ssh ${server} $serverCommand & LogMsg "Executed: $serverCommand" currentPort=$(($currentPort+1)) @@ -205,10 +211,10 @@ for current_buffer in "${bufferLengths[@]}"; do currentIperfInstanses=$(($currentIperfInstanses+1)) if [[ "$testType" == "udp" ]]; then - clientCommand="iperf3 -c $testServer -u -b 0 -J -f g -i10 -l ${current_buffer} -t ${testDuration} -p ${currentPort} -P $num_threads_P -${IPversion} > iperf-client-${testType}-IPv${IPversion}-buffer-${current_buffer}-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1" + clientCommand="${iperf3_cmd} -c $testServer -u -b 0 -J -f g -i10 -l ${current_buffer} -t ${testDuration} -p ${currentPort} -P $num_threads_P -${IPversion} > iperf-client-${testType}-IPv${IPversion}-buffer-${current_buffer}-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1" fi if [[ "$testType" == "tcp" ]]; then - clientCommand="iperf3 -c $testServer -b 0 -J -f g -i10 -l ${current_buffer} -t ${testDuration} -p ${currentPort} -P $num_threads_P -${IPversion} > iperf-client-${testType}-IPv${IPversion}-buffer-${current_buffer}-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1" + clientCommand="${iperf3_cmd} -c $testServer -b 0 -J -f g -i10 -l ${current_buffer} -t ${testDuration} -p ${currentPort} -P $num_threads_P -${IPversion} > iperf-client-${testType}-IPv${IPversion}-buffer-${current_buffer}-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1" fi ssh ${client} $clientCommand & @@ -220,18 +226,18 @@ for current_buffer in "${bufferLengths[@]}"; do sleep ${testDuration} timeoutSeconds=900 sleep 5 - var=`ps -C "iperf3 -c" --no-headers | wc -l` + var=`ps -C "${iperf3_cmd} -c" --no-headers | wc -l` echo $var while [[ $var -gt 0 ]]; do timeoutSeconds=`expr $timeoutSeconds - 1` if [ $timeoutSeconds -eq 0 ]; then LogMsg "Iperf3 running buffer ${current_buffer}K $num_threads_P X $num_threads_n. Timeout." LogMsg "killing all iperf3 client threads." - killall iperf3 + Kill_Process ${client} iperf3 sleep 1 else sleep 1 - var=`ps -C "iperf3 -c" --no-headers | wc -l` + var=`ps -C "${iperf3_cmd} -c" --no-headers | wc -l` LogMsg "Iperf3 running buffer ${current_buffer}K $num_threads_P X $num_threads_n. Waiting to finish $var instances." fi done @@ -241,4 +247,4 @@ for current_buffer in "${bufferLengths[@]}"; do done done scp ${server}:iperf-server-* ./ -UpdateTestState ICA_TESTCOMPLETED +UpdateTestState $ICA_TESTCOMPLETED \ No newline at end of file diff --git a/Testscripts/Linux/perf_lagscope.sh b/Testscripts/Linux/perf_lagscope.sh index 16e75ab75..f87cfb076 100644 --- a/Testscripts/Linux/perf_lagscope.sh +++ b/Testscripts/Linux/perf_lagscope.sh @@ -77,7 +77,6 @@ fi LogMsg "Configuring client ${client}..." ssh ${client} ". $UTIL_FILE && install_lagscope" -ssh ${client} "which lagscope" if [ $? -ne 0 ]; then LogMsg "Error: lagscope installation failed in ${client}.." UpdateTestState "TestAborted" @@ -86,21 +85,28 @@ fi LogMsg "Configuring server ${server}..." ssh ${server} ". $UTIL_FILE && install_lagscope" -ssh ${server} "which lagscope" if [ $? -ne 0 ]; then LogMsg "Error: lagscope installation failed in ${server}.." UpdateTestState "TestAborted" exit 1 fi +if [[ $(detect_linux_distribution) == coreos ]]; then + cmd="docker run --network host lisms/lagscope" + ssh root@${server} ". $UTIL_FILE && Delete_Containers" + ssh root@${client} ". $UTIL_FILE && Delete_Containers" +else + cmd="lagscope" +fi + #Now, start the ntttcp client on client VM. LogMsg "Now running Lagscope test" LogMsg "Starting server." -ssh root@${server} "lagscope -r -D" -sleep 1 +ssh root@${server} "${cmd} -r" & +sleep 20 LogMsg "lagscope client running..." -ssh root@${client} "lagscope -s${server} -i0 -n${pingIteration} -H > lagscope-n${pingIteration}-output.txt" +ssh root@${client} "${cmd} -s${server} -i0 -n${pingIteration} -H > lagscope-n${pingIteration}-output.txt" LogMsg "Test finsished." UpdateTestState ICA_TESTCOMPLETED diff --git a/Testscripts/Linux/perf_netperf.sh b/Testscripts/Linux/perf_netperf.sh index 42b1ac38f..2bbec75d3 100644 --- a/Testscripts/Linux/perf_netperf.sh +++ b/Testscripts/Linux/perf_netperf.sh @@ -83,7 +83,6 @@ scp *.sh ${server}: LogMsg "Configuring client ${client}..." ssh ${client} ". $UTIL_FILE && install_netperf" -ssh ${client} "which netperf" if [ $? -ne 0 ]; then LogMsg "Error: netperf installation failed in ${client}.." UpdateTestState $ICA_TESTABORTED @@ -92,56 +91,63 @@ fi LogMsg "Configuring server ${server}..." ssh ${server} ". $UTIL_FILE && install_netperf" -ssh ${server} "which netperf" if [ $? -ne 0 ]; then LogMsg "Error: netperf installation failed in ${server}.." UpdateTestState $ICA_TESTABORTED exit 1 fi -ssh ${server} "killall netserver" -ssh ${client} "killall netperf" +if [[ $(detect_linux_distribution) == coreos ]]; then + netperf_cmd="docker run --network host lisms/netperf" + sar_cmd="docker run --network host lisms/toolbox sar" + ssh root@${server} ". $UTIL_FILE && Delete_Containers" + ssh root@${client} ". $UTIL_FILE && Delete_Containers" +else + netperf_cmd="" + sar_cmd="sar" +fi + +Kill_Process ${server} netserver +Kill_Process ${client} netperf if [[ "$test_type" == "singlepps" ]]; then #netperf server preparation... - server_command="netserver -p 30000 > netperf-server-output.txt 2>&1" + server_command="nohup ${netperf_cmd} netserver -p 30000 -D > netperf-server-output.txt 2>&1 &" ssh ${server} $server_command LogMsg "${server} : Executed: $server_command" - #Start the sar monitor on server. - server_sar_command="sar -n DEV 1 ${test_duration} > netperf-server-sar-output.txt" - ssh ${server} $server_sar_command & - LogMsg "${server} : Executed: $server_sar_command" - + #Start the netperf client - client_command="netperf -H ${server} -p 30000 -t TCP_RR -n 32 -l ${test_duration} -D 1 -- -O 'THROUGHPUT, THROUGHPUT_UNITS, MIN_LATENCY, MAX_LATENCY, MEAN_LATENCY, REQUEST_SIZE, RESPONSE_SIZE, STDDEV_LATENCY' > netperf-client-output.txt" + client_command="${netperf_cmd} netperf -H ${server} -p 30000 -t TCP_RR -n 32 -l ${test_duration} -D 1 -- -O 'THROUGHPUT, THROUGHPUT_UNITS, MIN_LATENCY, MAX_LATENCY, MEAN_LATENCY, REQUEST_SIZE, RESPONSE_SIZE, STDDEV_LATENCY' > netperf-client-output.txt" ssh ${client} $client_command & LogMsg "${client} : Executed: $client_command" + + #Start the sar monitor on server. + server_sar_command="${sar_cmd} -n DEV 1 ${test_duration} > netperf-server-sar-output.txt" + ssh ${server} $server_sar_command & + LogMsg "${server} : Executed: $server_sar_command" + #netperf client preparation... - client_sar_command="sar -n DEV 1 ${test_duration} > netperf-client-sar-output.txt" + client_sar_command="${sar_cmd} -n DEV 1 ${test_duration} > netperf-client-sar-output.txt" ssh ${client} $client_sar_command & LogMsg "${client} : Executed: $client_sar_command" - + #Wait for tests to finish. LogMsg "${client} : Waiting ${test_duration} seconds to finish tests..." sleep $test_duration LogMsg "${client} : Tests Completed." UpdateTestState $ICA_TESTCOMPLETED - elif [[ "$test_type" == "maxpps" ]]; then +elif [[ "$test_type" == "maxpps" ]]; then #netperf server preparation... current_port=30000 max_port=30031 while [ $current_port -le $max_port ]; do - server_command="netserver -p $current_port > netperf-server-output.txt 2>&1" + server_command="nohup ${netperf_cmd} netserver -p $current_port -D > netperf-server-output.txt 2>&1 &" ssh ${server} $server_command LogMsg "Executed: $server_command" current_port=$(($current_port+1)) done - #Start the sar monitor on server. - server_sar_command="sar -n DEV 1 ${test_duration} > netperf-server-sar-output.txt" - ssh ${server} $server_sar_command & - LogMsg "${server} : Executed: $server_sar_command" - + #netperf client preparation... current_job=1 max_jobs=16 @@ -151,14 +157,19 @@ if [[ "$test_type" == "singlepps" ]]; then touch netperf-client-output.txt while [ $current_job -le $max_jobs ]; do while [ $current_port -le $max_port ]; do - client_command="netperf -H ${server} -p $current_port -t TCP_RR -n 32 -l ${test_duration} -D 1 -- -O 'THROUGHPUT, THROUGHPUT_UNITS, MIN_LATENCY, MAX_LATENCY, MEAN_LATENCY, REQUEST_SIZE, RESPONSE_SIZE, STDDEV_LATENCY' >> netperf-client-output.txt 2>&1" - ssh ${client} $client_command & + client_command="nohup ${netperf_cmd} netperf -H ${server} -p $current_port -t TCP_RR -n 32 -l ${test_duration} -D 1 -- -O 'THROUGHPUT, THROUGHPUT_UNITS, MIN_LATENCY, MAX_LATENCY, MEAN_LATENCY, REQUEST_SIZE, RESPONSE_SIZE, STDDEV_LATENCY' >> netperf-client-output.txt 2>&1 &" + ssh ${client} $client_command LogMsg "Executed: $client_command" current_port=$(($current_port+1)) done current_job=$(($current_job+1)) done - client_sar_command="sar -n DEV 1 ${test_duration} > netperf-client-sar-output.txt" + + #Start the sar monitor on server. + server_sar_command="${sar_cmd} -n DEV 1 ${test_duration} > netperf-server-sar-output.txt" + ssh ${server} $server_sar_command & + LogMsg "${server} : Executed: $server_sar_command" + client_sar_command="${sar_cmd} -n DEV 1 ${test_duration} > netperf-client-sar-output.txt" ssh ${client} $client_sar_command & LogMsg "${client} : Executed: $client_sar_command" #Wait for tests to finish. diff --git a/Testscripts/Linux/perf_ntttcp.sh b/Testscripts/Linux/perf_ntttcp.sh index 77ef7d0f2..1dfa1fb90 100644 --- a/Testscripts/Linux/perf_ntttcp.sh +++ b/Testscripts/Linux/perf_ntttcp.sh @@ -84,7 +84,6 @@ fi LogMsg "Configuring client ${client}..." ssh ${client} ". $UTIL_FILE && install_ntttcp" -ssh ${client} "which ntttcp" if [ $? -ne 0 ]; then LogMsg "Error: ntttcp installation failed in ${client}.." UpdateTestState "TestAborted" @@ -93,13 +92,29 @@ fi LogMsg "Configuring server ${server}..." ssh ${server} ". $UTIL_FILE && install_ntttcp" -ssh ${server} "which ntttcp" if [ $? -ne 0 ]; then LogMsg "Error: ntttcp installation failed in ${server}.." UpdateTestState "TestAborted" exit 1 fi +if [[ $(detect_linux_distribution) == coreos ]]; then + ntttcp_cmd="docker run --network host lisms/ntttcp" + lagscope_cmd="docker run --network host lisms/lagscope" + mpstat_cmd="docker run --network host lisms/toolbox mpstat" + dstat_cmd="docker run --network host lisms/toolbox dstat" + sar_cmd="docker run --network host lisms/toolbox sar" + ssh root@${server} ". $UTIL_FILE && Delete_Containers" + ssh root@${client} ". $UTIL_FILE && Delete_Containers" +else + ntttcp_cmd="ntttcp" + lagscope_cmd="lagscope" + mpstat_cmd="mpstat" + dstat_cmd="dstat" + sar_cmd="sar" +fi + +bc_cmd=`echo $(Get_BC_Command)` log_folder="ntttcp-${testType}-test-logs" max_server_threads=64 @@ -112,13 +127,13 @@ Get_Throughput() throughput=$(echo $throughput | sed 's/Gbps//') elif [[ $throughput =~ "Mbps" ]]; then - throughput=$(echo "scale=5; $(echo $throughput | sed 's/Mbps//')/1024" | bc) + throughput=$(echo "scale=5; $(echo $throughput | sed 's/Mbps//')/1024" | ${bc_cmd}) elif [[ $throughput =~ "Kbps" ]]; then - throughput=$(echo "scale=5; $(echo $throughput | sed 's/Kbps//')/1024/1024" | bc) + throughput=$(echo "scale=5; $(echo $throughput | sed 's/Kbps//')/1024/1024" | ${bc_cmd}) elif [[ $throughput =~ "bps" ]]; then - throughput=$(echo "scale=5; $(echo $throughput | sed 's/Kbps//')/1024/1024/1024" | bc) + throughput=$(echo "scale=5; $(echo $throughput | sed 's/Kbps//')/1024/1024/1024" | ${bc_cmd}) else throughput=0 fi @@ -135,10 +150,10 @@ Get_Average_Latency() avglatency=$(echo $avglatency | sed 's/us//') elif [[ $avglatency =~ "ms" ]]; then - avglatency=$(echo "scale=5; $(echo $avglatency | sed 's/ms//')/1000" | bc) + avglatency=$(echo "scale=5; $(echo $avglatency | sed 's/ms//')/1000" | ${bc_cmd}) elif [[ $avglatency =~ "sec" ]]; then - avglatency=$(echo "scale=5; $(echo $avglatency | sed 's/sec//')/1000/1000" | bc) + avglatency=$(echo "scale=5; $(echo $avglatency | sed 's/sec//')/1000/1000" | ${bc_cmd}) else avglatency=0 fi @@ -177,7 +192,7 @@ Run_Ntttcp() testType="tcp" echo "test_connections,throughput_in_Gbps,cycles/byte,avglatency_in_us" > $result_file fi - + for current_test_threads in $testConnections; do if [[ $current_test_threads -lt $max_server_threads ]]; then @@ -193,14 +208,14 @@ Run_Ntttcp() tx_log_prefix="sender-${testType}-${bufferLength}k-p${num_threads_P}X${num_threads_n}.log" rx_log_prefix="receiver-${testType}-${bufferLength}k-p${num_threads_P}X${num_threads_n}.log" run_msg="Running ${testType} ${bufferLength}k Test: $current_test_threads connections : $num_threads_P X $num_threads_n" - server_ntttcp_cmd="ulimit -n 204800 && ntttcp -u -b ${bufferLength}k -P ${num_threads_P} -t ${testDuration} -e -W 1 -C 1" - client_ntttcp_cmd="ulimit -n 204800 && ntttcp -s${server} -u -b ${bufferLength}k -P ${num_threads_P} -n ${num_threads_n} -t ${testDuration} -W 1 -C 1" + server_ntttcp_cmd="ulimit -n 204800 && ${ntttcp_cmd} -u -b ${bufferLength}k -P ${num_threads_P} -t ${testDuration} -e -W 1 -C 1" + client_ntttcp_cmd="ulimit -n 204800 && ${ntttcp_cmd} -s${server} -u -b ${bufferLength}k -P ${num_threads_P} -n ${num_threads_n} -t ${testDuration} -W 1 -C 1" else tx_log_prefix="sender-${testType}-p${num_threads_P}X${num_threads_n}.log" rx_log_prefix="receiver-${testType}-p${num_threads_P}X${num_threads_n}.log" run_msg="Running ${testType} Test: $current_test_threads connections : $num_threads_P X $num_threads_n" - server_ntttcp_cmd="ulimit -n 204800 && ntttcp -P ${num_threads_P} -t ${testDuration} -e -W 1 -C 1" - client_ntttcp_cmd="ulimit -n 204800 && ntttcp -s${server} -P ${num_threads_P} -n ${num_threads_n} -t ${testDuration} -W 1 -C 1" + server_ntttcp_cmd="ulimit -n 204800 && ${ntttcp_cmd} -P ${num_threads_P} -t ${testDuration} -e -W 1 -C 1" + client_ntttcp_cmd="ulimit -n 204800 && ${ntttcp_cmd} -s${server} -P ${num_threads_P} -n ${num_threads_n} -t ${testDuration} -W 1 -C 1" ssh ${server} "for i in {1..$testDuration}; do ss -ta | grep ESTA | grep -v ssh | wc -l >> ./$log_folder/tcp-connections-p${num_threads_P}X${num_threads_n}.log; sleep 1; done" & fi @@ -211,21 +226,21 @@ Run_Ntttcp() tx_ntttcp_log_file="$log_folder/ntttcp-${tx_log_prefix}" tx_lagscope_log_file="$log_folder/lagscope-${tx_log_prefix}" rx_ntttcp_log_file="$log_folder/ntttcp-${rx_log_prefix}" - ssh ${server} "pkill -f ntttcp" + Kill_Process ${server} ntttcp LogMsg "ServerCmd: $server_ntttcp_cmd > ./$log_folder/ntttcp-${rx_log_prefix}" ssh ${server} "${server_ntttcp_cmd}" > "./$log_folder/ntttcp-${rx_log_prefix}" & - ssh ${server} "pkill -f lagscope" - ssh ${server} "lagscope -r" & - ssh ${server} "pkill -f dstat" - ssh ${server} "dstat -dam" > "./$log_folder/dstat-${rx_log_prefix}" & - ssh ${server} "pkill -f mpstat" - ssh ${server} "mpstat -P ALL 1 ${testDuration}" > "./$log_folder/mpstat-${rx_log_prefix}" & + Kill_Process ${server} lagscope + ssh ${server} "${lagscope_cmd} -r" & + Kill_Process ${server} dstat + ssh ${server} "${dstat_cmd} -dam" > "./$log_folder/dstat-${rx_log_prefix}" & + Kill_Process ${server} mpstat + ssh ${server} "${mpstat_cmd} -P ALL 1 ${testDuration}" > "./$log_folder/mpstat-${rx_log_prefix}" & sleep 2 - sar -n DEV 1 ${testDuration} > "./$log_folder/sar-${tx_log_prefix}" & - dstat -dam > "./$log_folder/dstat-${tx_log_prefix}" & - mpstat -P ALL 1 ${testDuration} > "./$log_folder/mpstat-${tx_log_prefix}" & - lagscope -s${server} -t ${testDuration} -V > "./$log_folder/lagscope-${tx_log_prefix}" & + ${sar_cmd} -n DEV 1 ${testDuration} > "./$log_folder/sar-${tx_log_prefix}" & + ${dstat_cmd} -dam > "./$log_folder/dstat-${tx_log_prefix}" & + ${mpstat_cmd} -P ALL 1 ${testDuration} > "./$log_folder/mpstat-${tx_log_prefix}" & + ${lagscope_cmd} -s${server} -t ${testDuration} -V > "./$log_folder/lagscope-${tx_log_prefix}" & LogMsg "ClientCmd: ${client_ntttcp_cmd} > ./${log_folder}/ntttcp-${tx_log_prefix}" ssh ${client} "${client_ntttcp_cmd}" > "./${log_folder}/ntttcp-${tx_log_prefix}" @@ -240,9 +255,9 @@ Run_Ntttcp() then data_loss=`printf %.2f 0` else - data_loss=`printf %.2f $(echo "scale=5; 100*(($tx_throughput-$rx_throughput)/$tx_throughput)" | bc)` + data_loss=`printf %.2f $(echo "scale=5; 100*(($tx_throughput-$rx_throughput)/$tx_throughput)" | ${bc_cmd})` fi - + LogMsg "Test Results: " LogMsg "---------------" LogMsg "Throughput in Gbps: Tx: $tx_throughput , Rx: $rx_throughput" @@ -253,7 +268,7 @@ Run_Ntttcp() then echo "$current_test_threads,$tx_throughput,$rx_throughput,$data_loss" >> $result_file else - testType="tcp" + testType="tcp" echo "$current_test_threads,$tx_throughput,$tx_cyclesperbytes,$avg_latency" >> $result_file fi LogMsg "current test finished. wait for next one... " @@ -266,10 +281,10 @@ Run_Ntttcp() LogMsg "Now running ${testType} test using NTTTCP" Run_Ntttcp -pkill -f dstat -ssh ${server} "pkill -f lagscope" -ssh ${server} "pkill -f dstat" -ssh ${server} "pkill -f mpstat" +Kill_Process ${client} dstat +Kill_Process ${server} lagscope +Kill_Process ${server} dstat +Kill_Process ${server} mpstat column -s, -t $result_file > ./$log_folder/report.log cp $log_folder/* . cat report.log diff --git a/Testscripts/Linux/utils.sh b/Testscripts/Linux/utils.sh index 007c0341e..f7602f469 100644 --- a/Testscripts/Linux/utils.sh +++ b/Testscripts/Linux/utils.sh @@ -2580,11 +2580,20 @@ function install_fio () { iptables -F ;; + coreos) + docker pull lisms/fio + docker pull lisms/toolbox + ;; + *) echo "Unsupported distribution for install_fio" return 1 esac - which fio + if [[ $(detect_linux_distribution) == coreos ]]; then + docker images | grep -i lisms/fio + else + which fio + fi if [ $? -ne 0 ]; then return 1 fi @@ -2655,11 +2664,19 @@ function install_iperf3 () { iptables -F ;; + coreos) + docker pull lisms/iperf3 + ;; + *) echo "Unsupported distribution for install_iperf3" return 1 esac - which iperf3 + if [[ $(detect_linux_distribution) == coreos ]]; then + docker images | grep -i lisms/iperf3 + else + which iperf3 + fi if [ $? -ne 0 ]; then return 1 fi @@ -2709,11 +2726,19 @@ function install_lagscope () { iptables -F ;; + coreos) + docker pull lisms/lagscope + ;; + *) echo "Unsupported distribution for install_lagscope" return 1 esac - which lagscope + if [[ $(detect_linux_distribution) == coreos ]]; then + docker images | grep -i lisms/lagscope + else + which lagscope + fi if [ $? -ne 0 ]; then return 1 fi @@ -2767,11 +2792,21 @@ function install_ntttcp () { iptables -F ;; + coreos) + docker pull lisms/ntttcp + docker pull lisms/toolbox + docker pull lisms/lagscope + ;; + *) echo "Unsupported distribution for install_ntttcp" return 1 esac - which ntttcp + if [[ $(detect_linux_distribution) == coreos ]]; then + docker images | grep -i lisms/ntttcp + else + which ntttcp + fi if [ $? -ne 0 ]; then return 1 fi @@ -2821,11 +2856,20 @@ function install_netperf () { iptables -F ;; + coreos) + docker pull lisms/netperf + docker pull lisms/toolbox + ;; + *) echo "Unsupported distribution for build_netperf" return 1 esac - which netperf + if [[ $(detect_linux_distribution) == coreos ]]; then + docker images | grep -i lisms/netperf + else + which netperf + fi if [ $? -ne 0 ]; then return 1 fi @@ -3295,7 +3339,48 @@ function stop_firewall() { esac return 0 } -function Update_Kernel() { + +Kill_Process() +{ + ip=$1 + if [[ $(detect_linux_distribution) == coreos ]]; then + output="default" + while [[ ${#output} != 0 ]]; do + output=`ssh $ip "docker ps -a | grep $2 "` + if [[ ${#output} == 0 ]]; then + break + fi + pid=$(echo $output | awk '{print $1}') + ssh $ip "docker stop $pid; docker rm $pid" + done + else + ssh $ip "killall $2" + fi +} + +Delete_Containers() +{ + containers=`docker ps -a | grep -v 'CONTAINER ID' | awk '{print $1}'` + for containerID in ${containers} + do + docker stop $containerID > /dev/null 2>&1 + docker rm $containerID > /dev/null 2>&1 + done +} + +Get_BC_Command() +{ + bc_cmd="" + if [[ $(detect_linux_distribution) != coreos ]]; then + bc_cmd="bc" + else + Delete_Containers + docker run -t -d lisms/toolbox > /dev/null 2>&1 + containerID=`docker ps | grep -v 'CONTAINER ID' | awk '{print $1}'` + bc_cmd="docker exec -i $containerID bc" + fi + echo $bc_cmd +}function Update_Kernel() { GetDistro case "$DISTRO" in suse*) diff --git a/Testscripts/Windows/NESTED-HYPERV-STORAGE-PERF.ps1 b/Testscripts/Windows/NESTED-HYPERV-STORAGE-PERF.ps1 index 091214bb8..c6c2b648a 100644 --- a/Testscripts/Windows/NESTED-HYPERV-STORAGE-PERF.ps1 +++ b/Testscripts/Windows/NESTED-HYPERV-STORAGE-PERF.ps1 @@ -101,7 +101,7 @@ collect_VM_properties nested_properties.csv $scriptContent2 = @" chmod +x *.sh -cp fio_jason_parser.sh gawk JSON.awk /home/$username/FIOLog/jsonLog/ +cp fio_jason_parser.sh gawk JSON.awk utils.sh /home/$username/FIOLog/jsonLog/ cd /home/$username/FIOLog/jsonLog/ bash fio_jason_parser.sh cp perf_fio.csv /home/$username/ diff --git a/Testscripts/Windows/NESTED-KVM-STORAGE-PERF.ps1 b/Testscripts/Windows/NESTED-KVM-STORAGE-PERF.ps1 index ebb11f5cb..19b760f33 100644 --- a/Testscripts/Windows/NESTED-KVM-STORAGE-PERF.ps1 +++ b/Testscripts/Windows/NESTED-KVM-STORAGE-PERF.ps1 @@ -17,7 +17,7 @@ wget https://ciwestusv2.blob.core.windows.net/scriptfiles/JSON.awk wget https://ciwestusv2.blob.core.windows.net/scriptfiles/gawk wget https://ciwestusv2.blob.core.windows.net/scriptfiles/fio_jason_parser.sh chmod +x *.sh -cp fio_jason_parser.sh gawk JSON.awk /root/FIOLog/jsonLog/ +cp fio_jason_parser.sh gawk JSON.awk utils.sh /root/FIOLog/jsonLog/ cd /root/FIOLog/jsonLog/ ./fio_jason_parser.sh cp perf_fio.csv /root diff --git a/Testscripts/Windows/PERF-STORAGE-MULTIDISK-RAID0-FIO.ps1 b/Testscripts/Windows/PERF-STORAGE-MULTIDISK-RAID0-FIO.ps1 index 3f1037ae8..cf137c880 100644 --- a/Testscripts/Windows/PERF-STORAGE-MULTIDISK-RAID0-FIO.ps1 +++ b/Testscripts/Windows/PERF-STORAGE-MULTIDISK-RAID0-FIO.ps1 @@ -35,7 +35,7 @@ collect_VM_properties "@ $myString2 = @" chmod +x *.sh -cp fio_jason_parser.sh gawk JSON.awk /root/FIOLog/jsonLog/ +cp fio_jason_parser.sh gawk JSON.awk utils.sh /root/FIOLog/jsonLog/ cd /root/FIOLog/jsonLog/ ./fio_jason_parser.sh cp perf_fio.csv /root @@ -46,7 +46,7 @@ chmod 666 /root/perf_fio.csv RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files ".\$constantsFile,.\$LogDir\StartFioTest.sh,.\$LogDir\ParseFioTestLogs.sh" -username "root" -password $password -upload RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files $currentTestData.files -username "root" -password $password -upload $out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh" -runAsSudo - $testJob = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "./StartFioTest.sh" -RunInBackground -runAsSudo + $testJob = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "bash StartFioTest.sh" -RunInBackground -runAsSudo #endregion #region MONITOR TEST diff --git a/Testscripts/Windows/PERF-STORAGE-OVER-NFS.ps1 b/Testscripts/Windows/PERF-STORAGE-OVER-NFS.ps1 index 6eb126e76..7c4591886 100644 --- a/Testscripts/Windows/PERF-STORAGE-OVER-NFS.ps1 +++ b/Testscripts/Windows/PERF-STORAGE-OVER-NFS.ps1 @@ -66,7 +66,7 @@ collect_VM_properties $myString2 = @" chmod +x *.sh -cp fio_jason_parser.sh gawk JSON.awk /root/FIOLog/jsonLog/ +cp fio_jason_parser.sh gawk JSON.awk utils.sh /root/FIOLog/jsonLog/ cd /root/FIOLog/jsonLog/ ./fio_jason_parser.sh cp perf_fio.csv /root From 27e24d337f4c787d15a50b9cc531d85ff99e3f73 Mon Sep 17 00:00:00 2001 From: "Lili Deng (Wicresoft North America Ltd)" Date: Mon, 29 Oct 2018 20:01:51 -0700 Subject: [PATCH 6/6] Update based on comments. --- Testscripts/Linux/perf_fio.sh | 22 ++++++++-------- Testscripts/Linux/utils.sh | 48 ++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Testscripts/Linux/perf_fio.sh b/Testscripts/Linux/perf_fio.sh index 7c64896d0..326e4160d 100644 --- a/Testscripts/Linux/perf_fio.sh +++ b/Testscripts/Linux/perf_fio.sh @@ -97,12 +97,12 @@ RunFIO() io_increment=128 #################################### - echo "Test log created at: ${LOGFILE}" - echo "===================================== Starting Run $(date +"%x %r %Z") ================================" - echo "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE + LogMsg "Test log created at: ${LOGFILE}" + LogMsg "===================================== Starting Run $(date +"%x %r %Z") ================================" + LogMsg "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" chmod 666 $LOGFILE - echo "--- Kernel Version Information ---" >> $LOGFILE + LogMsg "--- Kernel Version Information ---" uname -a >> $LOGFILE cat /proc/version >> $LOGFILE if [ -f /usr/share/clear/version ]; then @@ -110,7 +110,7 @@ RunFIO() elif [ -f /etc/*-release ]; then cat /etc/*-release >> $LOGFILE fi - echo "--- PCI Bus Information ---" >> $LOGFILE + LogMsg "--- PCI Bus Information ---" lspci >> $LOGFILE df -h >> $LOGFILE fio --cpuclock-test >> $LOGFILE @@ -137,10 +137,10 @@ RunFIO() #mkdir $blk_operation #blktrace -w 40 -d /dev/sdf -D $blk_operation & #blktrace -w 40 -d /dev/sdm -D $blk_operation & - echo "-- iteration ${iteration} ----------------------------- ${testmode} test, ${io}K bs, ${Thread} threads, ${numjobs} jobs, 5 minutes ------------------ $(date +"%x %r %Z") ---" >> $LOGFILE + LogMsg "-- iteration ${iteration} ----------------------------- ${testmode} test, ${io}K bs, ${Thread} threads, ${numjobs} jobs, 5 minutes ------------------ $(date +"%x %r %Z") ---" LogMsg "Running ${testmode} test, ${io}K bs, ${Thread} threads ..." jsonfilename="${JSONFILELOG}/fio-result-${testmode}-${io}K-${Thread}td.json" - echo "${fio_cmd} $FILEIO --readwrite=${testmode} --bs=${io}K --runtime=${ioruntime} --iodepth=${Thread} --numjobs=${numjobs} --output-format=json --output=${jsonfilename} --name='iteration'${iteration}" >> $LOGFILE + LogMsg "${fio_cmd} $FILEIO --readwrite=${testmode} --bs=${io}K --runtime=${ioruntime} --iodepth=${Thread} --numjobs=${numjobs} --output-format=json --output=${jsonfilename} --name='iteration'${iteration}" $fio_cmd $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --output-format=json --output=$jsonfilename --name="iteration"${iteration} >> $LOGFILE #fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --name="iteration"${iteration} --group_reporting >> $LOGFILE iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'` @@ -155,13 +155,13 @@ RunFIO() done done #################################### - echo "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE + LogMsg "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" compressedFileName="${HOMEDIR}/FIOTest-$(date +"%m%d%Y-%H%M%S").tar.gz" LogMsg "INFO: Please wait...Compressing all results to ${compressedFileName}..." tar -cvzf $compressedFileName $LOGDIR/ - echo "Test logs are located at ${LOGDIR}" + LogMsg "Test logs are located at ${LOGDIR}" UpdateTestState ICA_TESTCOMPLETED } @@ -174,7 +174,7 @@ CreateRAID0() LogMsg "INFO: Check and remove RAID first" mdvol=$(cat /proc/mdstat | grep "active raid" | awk {'print $1'}) if [ -n "$mdvol" ]; then - echo "/dev/${mdvol} already exist...removing first" + LogMsg "/dev/${mdvol} already exist...removing first" umount /dev/${mdvol} mdadm --stop /dev/${mdvol} mdadm --remove /dev/${mdvol} @@ -185,7 +185,7 @@ CreateRAID0() count=0 for disk in ${disks} do - echo "formatting disk /dev/${disk}" + LogMsg "formatting disk /dev/${disk}" (echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk} count=$(( $count + 1 )) sleep 1 diff --git a/Testscripts/Linux/utils.sh b/Testscripts/Linux/utils.sh index f7602f469..147abb4bb 100644 --- a/Testscripts/Linux/utils.sh +++ b/Testscripts/Linux/utils.sh @@ -3340,6 +3340,30 @@ function stop_firewall() { return 0 } +function Update_Kernel() { + GetDistro + case "$DISTRO" in + suse*) + zypper ar -f $opensuselink kernel + zypper --gpg-auto-import-keys --non-interactive dup -r kernel + retVal=$? + ;; + ubuntu*|debian*) + sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" + retVal=$? + ;; + redhat* | centos* | fedora*) + yum install -y kernel + retVal=$? + ;; + *) + LogErr "Platform not supported yet!" + retVal=1 + ;; + esac + return $retVal +} + Kill_Process() { ip=$1 @@ -3380,26 +3404,4 @@ Get_BC_Command() bc_cmd="docker exec -i $containerID bc" fi echo $bc_cmd -}function Update_Kernel() { - GetDistro - case "$DISTRO" in - suse*) - zypper ar -f $opensuselink kernel - zypper --gpg-auto-import-keys --non-interactive dup -r kernel - retVal=$? - ;; - ubuntu*|debian*) - sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" - retVal=$? - ;; - redhat* | centos* | fedora*) - yum install -y kernel - retVal=$? - ;; - *) - LogErr "Platform not supported yet!" - retVal=1 - ;; - esac - return $retVal -} +} \ No newline at end of file