test: improvements to vm_setup.sh and pkgdep.sh

Change-Id: Ie433edd7c72f84b62c17bacebd31d61ffa6f30ab
Signed-off-by: Ed Rodriguez <ed.rodriguez@netapp.com>
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/416052
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
John Meneghini 2018-06-19 15:22:48 -04:00 committed by Jim Harris
parent d53545eff7
commit 806f43b26d
2 changed files with 183 additions and 140 deletions

View File

@ -9,9 +9,10 @@ if [ -s /etc/redhat-release ]; then
# Add EPEL repository for CUnit-devel # Add EPEL repository for CUnit-devel
yum --enablerepo=extras install -y epel-release yum --enablerepo=extras install -y epel-release
fi fi
yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ yum install -y gcc gcc-c++ make CUnit-devel libaio-devel \
git astyle python-pep8 lcov python clang-analyzer libuuid-devel \ git astyle python-pep8 lcov python clang-analyzer libuuid-devel \
sg3_utils libiscsi-devel sg3_utils libiscsi-devel
yum install -y --allowerasing openssl-devel
# Additional dependencies for NVMe over Fabrics # Additional dependencies for NVMe over Fabrics
yum install -y libibverbs-devel librdmacm-devel yum install -y libibverbs-devel librdmacm-devel
# Additional dependencies for DPDK # Additional dependencies for DPDK

View File

@ -17,12 +17,12 @@
# intel_iommu=on kvm-intel.nested=1 # intel_iommu=on kvm-intel.nested=1
# We have made a lot of progress with removing hardcoded paths from the tests, # We have made a lot of progress with removing hardcoded paths from the tests,
# but it may be easiest if you create your user with the name sys_sgsw for now.
set -e set -e
UPGRADE=false UPGRADE=false
INSTALL=false INSTALL=false
CONF="librxe,iscsi,rocksdb,fio,flamegraph,tsocks,qemu,vpp,libiscsi"
function usage() function usage()
{ {
@ -30,20 +30,21 @@ function usage()
echo "Please run this script as your regular user. The script will make calls to sudo as needed." echo "Please run this script as your regular user. The script will make calls to sudo as needed."
echo "" echo ""
echo "./vm_setup.sh" echo "./vm_setup.sh"
echo "\t-h --help" echo " -h --help"
echo "\t-u --upgrade Run dnf upgrade" echo " -u --upgrade Run dnf upgrade"
echo "\t-i --install-deps Install dnf based dependencies" echo " -i --install-deps Install dnf based dependencies"
echo " -t --test-conf List of test configurations to enable (${CONF})"
exit 0 exit 0
} }
while getopts 'iuh-:' optchar; do while getopts 'iuht:-:' optchar; do
case "$optchar" in case "$optchar" in
-) -)
case "$OPTARG" in case "$OPTARG" in
help) usage;; help) usage;;
upgrade) UPGRADE=true;; upgrade) UPGRADE=true;;
install-deps) INSTALL=true;; install-deps) INSTALL=true;;
test-conf=*) CONF="${OPTARG#*=}";;
*) echo "Invalid argument '$OPTARG'" *) echo "Invalid argument '$OPTARG'"
usage;; usage;;
esac esac
@ -51,6 +52,7 @@ while getopts 'iuh-:' optchar; do
h) usage;; h) usage;;
u) UPGRADE=true;; u) UPGRADE=true;;
i) INSTALL=true;; i) INSTALL=true;;
t) CONF="$OPTARG";;
*) echo "Invalid argument '$OPTARG'" *) echo "Invalid argument '$OPTARG'"
usage;; usage;;
esac esac
@ -82,9 +84,12 @@ git submodule update --init --recursive
if $INSTALL; then if $INSTALL; then
sudo ./scripts/pkgdep.sh sudo ./scripts/pkgdep.sh
sudo dnf install -y jq if echo $CONF | grep -q tsocks; then
sudo dnf install -y tsocks sudo dnf install -y tsocks
fi
sudo dnf install -y valgrind sudo dnf install -y valgrind
sudo dnf install -y jq
sudo dnf install -y nvme-cli sudo dnf install -y nvme-cli
sudo dnf install -y ceph sudo dnf install -y ceph
sudo dnf install -y gdb sudo dnf install -y gdb
@ -98,6 +103,7 @@ if $INSTALL; then
sudo dnf install -y automake sudo dnf install -y automake
sudo dnf install -y libtool sudo dnf install -y libtool
sudo dnf install -y libmount-devel sudo dnf install -y libmount-devel
sudo dnf install -y iscsi-initiator-utils
sudo dnf install -y isns-utils-devel sudo dnf install -y isns-utils-devel
sudo dnf install -y pmempool sudo dnf install -y pmempool
sudo dnf install -y perl-open sudo dnf install -y perl-open
@ -115,162 +121,198 @@ fi
cd ~ cd ~
# rxe_cfg is used in the NVMe-oF tests if echo $CONF | grep -q librxe; then
# The librxe-dev repository provides a command line tool called rxe_cfg which makes it # rxe_cfg is used in the NVMe-oF tests
# very easy to use Soft-RoCE. The build pool utilizes this command line tool in the absence # The librxe-dev repository provides a command line tool called rxe_cfg which makes it
# of any real RDMA NICs to simulate one for the NVMe-oF tests. # very easy to use Soft-RoCE. The build pool utilizes this command line tool in the absence
if [ -d librxe-dev ]; then # of any real RDMA NICs to simulate one for the NVMe-oF tests.
echo "librxe-dev source already present, not cloning" if hash rxe_cfg 2> /dev/null; then
elif [ hash rxe_cfg ]; then echo "rxe_cfg is already installed. skipping"
echo "rxe_cfg is already installed. skipping" else
else if [ -d librxe-dev ]; then
git clone https://github.com/SoftRoCE/librxe-dev.git echo "librxe-dev source already present, not cloning"
cd librxe-dev else
./configure --libdir=/usr/lib64/ --prefix= git clone https://github.com/SoftRoCE/librxe-dev.git
make -j${jobs} fi
sudo make install
cd ~
fi
# iscsiadm is used in the iscsi_tgt tests cd librxe-dev
# The version of iscsiadm that ships with fedora 26 was broken as of November 3 2017. ./configure --libdir=/usr/lib64/ --prefix=
# There is already a bug report out about it, and hopefully it is fixed soon, but in the event that
# that version is still broken when you do your setup, the below steps will fix the issue.
CURRENT_VERSION=$(iscsiadm --version)
OPEN_ISCSI_VER='iscsiadm version 6.2.0.874'
if [ "$CURRENT_VERSION" == "$OPEN_ISCSI_VER" ]; then
if [ ! -d open-iscsi-install ]; then
mkdir -p open-iscsi-install
cd open-iscsi-install
sudo dnf download --source iscsi-initiator-utils
rpm2cpio $(ls) | cpio -idmv
mkdir -p patches
mv 00* patches/
git clone https://github.com/open-iscsi/open-iscsi
cd open-iscsi
# the configurations of username and email are needed for applying patches to iscsiadm.
git config user.name none
git config user.email none
git checkout 86e8892
for patch in `ls ../patches`; do
git am ../patches/$patch
done
sed -i '427s/.*/-1);/' usr/session_info.c
make -j${jobs} make -j${jobs}
sudo make install sudo make install
cd ~ cd ~
else
echo "custom open-iscsi install located, not reinstalling"
fi fi
fi fi
if echo $CONF | grep -q iscsi; then
# iscsiadm is used in the iscsi_tgt tests
# The version of iscsiadm that ships with fedora 26 was broken as of November 3 2017.
# There is already a bug report out about it, and hopefully it is fixed soon, but in the event that
# that version is still broken when you do your setup, the below steps will fix the issue.
CURRENT_VERSION=$(iscsiadm --version)
OPEN_ISCSI_VER='iscsiadm version 6.2.0.874'
if [ "$CURRENT_VERSION" == "$OPEN_ISCSI_VER" ]; then
if [ ! -d open-iscsi-install ]; then
mkdir -p open-iscsi-install
cd open-iscsi-install
sudo dnf download --source iscsi-initiator-utils
rpm2cpio $(ls) | cpio -idmv
mkdir -p patches
mv 00* patches/
git clone https://github.com/open-iscsi/open-iscsi
cd open-iscsi
# the configurations of username and email are needed for applying patches to iscsiadm.
git config user.name none
git config user.email none
git checkout 86e8892
for patch in `ls ../patches`; do
git am ../patches/$patch
done
sed -i '427s/.*/-1);/' usr/session_info.c
make -j${jobs}
sudo make install
cd ~
else
echo "custom open-iscsi install located, not reinstalling"
fi
fi
fi
sudo mkdir -p /usr/src sudo mkdir -p /usr/src
# Rocksdb is installed for use with the blobfs tests. if echo $CONF | grep -q rocksdb; then
if [ ! -d /usr/src/rocksdb ]; then
git clone https://review.gerrithub.io/spdk/rocksdb
git -C ./rocksdb checkout spdk-v5.6.1
sudo mv rocksdb /usr/src/
else
sudo git -C /usr/src/rocksdb checkout spdk-v5.6.1
echo "rocksdb already in /usr/src. Not checking out again"
fi
# This version of fio is installed in /usr/src/fio to enable # Rocksdb is installed for use with the blobfs tests.
# building the spdk fio plugin. if [ ! -d /usr/src/rocksdb ]; then
if [ ! -d /usr/src/fio ]; then git clone https://review.gerrithub.io/spdk/rocksdb
if [ ! -d fio ]; then git -C ./rocksdb checkout spdk-v5.6.1
git clone http://git.kernel.dk/fio.git sudo mv rocksdb /usr/src/
sudo mv fio /usr/src/
else else
sudo mv fio /usr/src/ sudo git -C /usr/src/rocksdb checkout spdk-v5.6.1
echo "rocksdb already in /usr/src. Not checking out again"
fi fi
(
cd /usr/src/fio &&
git checkout master &&
git pull &&
git checkout fio-3.3 &&
make -j${jobs} &&
sudo make install
)
else
echo "fio already in /usr/src/fio. Not installing"
fi fi
if echo $CONF | grep -q fio; then
# This version of fio is installed in /usr/src/fio to enable
# building the spdk fio plugin.
if [ ! -d /usr/src/fio ]; then
if [ ! -d fio ]; then
git clone http://git.kernel.dk/fio.git
sudo mv fio /usr/src/
else
sudo mv fio /usr/src/
fi
(
cd /usr/src/fio &&
git checkout master &&
git pull &&
git checkout fio-3.3 &&
make -j${jobs} &&
sudo make install
)
else
echo "fio already in /usr/src/fio. Not installing"
fi
fi
cd ~ cd ~
# Flamegraph is used when printing out timing graphs for the tests. if echo $CONF | grep -q flamegraph; then
if [ ! -d /usr/local/FlameGraph ]; then # Flamegraph is used when printing out timing graphs for the tests.
git clone https://github.com/brendangregg/FlameGraph.git if [ ! -d /usr/local/FlameGraph ]; then
mkdir -p /usr/local git clone https://github.com/brendangregg/FlameGraph.git
sudo mv FlameGraph /usr/local/FlameGraph mkdir -p /usr/local
else sudo mv FlameGraph /usr/local/FlameGraph
echo "flamegraph already installed. Skipping" else
echo "flamegraph already installed. Skipping"
fi
fi fi
# Qemu is used in the vhost tests. if echo $CONF | grep -q qemu; then
SPDK_QEMU_BRANCH=spdk-2.12-pre # Qemu is used in the vhost tests.
mkdir -p qemu SPDK_QEMU_BRANCH=spdk-2.12-pre
cd qemu mkdir -p qemu
if [ ! -d "$SPDK_QEMU_BRANCH" ]; then cd qemu
git clone https://github.com/spdk/qemu -b "$SPDK_QEMU_BRANCH" "$SPDK_QEMU_BRANCH" if [ ! -d "$SPDK_QEMU_BRANCH" ]; then
else git clone https://github.com/spdk/qemu -b "$SPDK_QEMU_BRANCH" "$SPDK_QEMU_BRANCH"
echo "qemu already checked out. Skipping" else
fi echo "qemu already checked out. Skipping"
cd "$SPDK_QEMU_BRANCH" fi
# Most tsocks proxies rely on a configuration file in /etc/tsocks.conf. cd "$SPDK_QEMU_BRANCH"
# If using tsocks, please make sure to complete this config before trying to build qemu.
if hash tsocks 2> /dev/null; then declare -a opt_params=("--prefix=/usr/local/qemu/$SPDK_QEMU_BRANCH")
git_param="--with-git='tsocks git'"
# Most tsocks proxies rely on a configuration file in /etc/tsocks.conf.
# If using tsocks, please make sure to complete this config before trying to build qemu.
if echo $CONF | grep -q tsocks; then
if hash tsocks 2> /dev/null; then
opt_params+=(--with-git='tsocks git')
fi
fi
./configure "${opt_params[@]}" --target-list="x86_64-softmmu" --enable-kvm --enable-linux-aio --enable-numa
make -j${jobs}
sudo make install
fi fi
./configure "$git_param" --prefix=/usr/local/qemu/$SPDK_QEMU_BRANCH --target-list="x86_64-softmmu" --enable-kvm --enable-linux-aio --enable-numa
make -j${jobs}
sudo make install
cd ~ cd ~
# Vector packet processing (VPP) is installed for use with iSCSI tests. if echo $CONF | grep -q vpp; then
git clone https://gerrit.fd.io/r/vpp # Vector packet processing (VPP) is installed for use with iSCSI tests.
cd vpp if [ -d vpp ]; then
git checkout v18.01.1 echo "vpp already cloned."
# VPP 18.01.1 does not support OpenSSL 1.1. if [ ! -d vpp/build-root ]; then
# For compilation, a compatibility package is used temporarily. echo "build-root has not been done"
sudo dnf install -y --allowerasing compat-openssl10-devel echo "remove the `pwd` and start again"
# Installing required dependencies for building VPP exit 1
yes | make install-dep fi
else
git clone https://gerrit.fd.io/r/vpp
cd vpp
git checkout v18.01.1
# VPP 18.01.1 does not support OpenSSL 1.1.
# For compilation, a compatibility package is used temporarily.
sudo dnf install -y --allowerasing compat-openssl10-devel
# Installing required dependencies for building VPP
yes | make install-dep
make pkg-rpm -j${jobs} make pkg-rpm -j${jobs}
# Reinstall latest OpenSSL devel package. # Reinstall latest OpenSSL devel package.
sudo dnf install -y --allowerasing openssl-devel sudo dnf install -y --allowerasing openssl-devel
cd build-root cd build-root
sudo dnf install -y \ sudo dnf install -y \
./vpp-lib-18.01.1-release.x86_64.rpm \ ./vpp-lib-18.01.1-release.x86_64.rpm \
./vpp-devel-18.01.1-release.x86_64.rpm \ ./vpp-devel-18.01.1-release.x86_64.rpm \
./vpp-18.01.1-release.x86_64.rpm ./vpp-18.01.1-release.x86_64.rpm
# Since hugepage configuration is done via spdk/scripts/setup.sh, # Since hugepage configuration is done via spdk/scripts/setup.sh,
# this default config is not needed. # this default config is not needed.
# #
# NOTE: Parameters kernel.shmmax and vm.max_map_count are set to # NOTE: Parameters kernel.shmmax and vm.max_map_count are set to
# very low count and cause issues with hugepage total sizes above 1GB. # very low count and cause issues with hugepage total sizes above 1GB.
sudo rm -f /etc/sysctl.d/80-vpp.conf sudo rm -f /etc/sysctl.d/80-vpp.conf
cd ~ cd ~
fi
# We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need
# to later. Cloning from git is just future proofing the machines.
if [ ! -d libiscsi ]; then
git clone https://github.com/sahlberg/libiscsi
else
echo "libiscsi already checked out. Skipping"
fi fi
cd libiscsi
./autogen.sh
./configure --prefix=/usr/local/libiscsi
make -j${jobs}
sudo make install
if echo $CONF | grep -q libiscsi; then
# We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need
# to later. Cloning from git is just future proofing the machines.
if [ ! -d libiscsi ]; then
git clone https://github.com/sahlberg/libiscsi
else
echo "libiscsi already checked out. Skipping"
fi
cd libiscsi
./autogen.sh
./configure --prefix=/usr/local/libiscsi
make -j${jobs}
sudo make install
fi
# create autorun-spdk.conf in home folder. This is sourced by the autotest_common.sh file. # create autorun-spdk.conf in home folder. This is sourced by the autotest_common.sh file.
# By setting any one of the values below to 0, you can skip that specific test. If you are # By setting any one of the values below to 0, you can skip that specific test. If you are