vm_setup.sh: add pre-existing directory checks.

This will allow us to run vm setup multiple times on a vm without it
failing due to pre-existing directories.

Change-Id: Ied17dd40daaa4b5f9a1e2448940d413c7db7cc96
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/405508
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Seth Howell 2018-03-27 16:46:39 -07:00 committed by Daniel Verkamp
parent ac277af97d
commit 08939a7714

View File

@ -74,18 +74,27 @@ mkdir -p spdk_repo
# The librxe-dev repository provides a command line tool called rxe_cfg which makes it # The librxe-dev repository provides a command line tool called rxe_cfg which makes it
# very easy to use Soft-RoCE. The build pool utilizes this command line tool in the absence # very easy to use Soft-RoCE. The build pool utilizes this command line tool in the absence
# of any real RDMA NICs to simulate one for the NVMe-oF tests. # of any real RDMA NICs to simulate one for the NVMe-oF tests.
git clone https://github.com/SoftRoCE/librxe-dev.git if [ -d librxe-dev ]; then
echo "librxe-dev source already present, not cloning"
elif [ hash rxe_cfg ]; then
echo "rxe_cfg is already installed. skipping"
else
git clone https://github.com/SoftRoCE/librxe-dev.git
cd librxe-dev
./configure --libdir=/usr/lib64/ --prefix=
make -j${jobs}
sudo make install
cd ~
fi
sudo dnf install -y perl-Switch librdmacm-utils libibverbs-utils sudo dnf install -y perl-Switch librdmacm-utils libibverbs-utils
cd librxe-dev
./configure --libdir=/usr/lib64/ --prefix=
make -j${jobs}
sudo make install
cd ~
cd spdk_repo cd spdk_repo
mkdir -p output mkdir -p output
git clone https://review.gerrithub.io/spdk/spdk if [ -d spdk ]; then
echo "spdk source already present, not cloning"
else
git clone https://review.gerrithub.io/spdk/spdk
fi
cd spdk cd spdk
git submodule update --init --recursive git submodule update --init --recursive
cd ~ cd ~
@ -96,56 +105,81 @@ cd ~
CURRENT_VERSION=$(iscsiadm --version) CURRENT_VERSION=$(iscsiadm --version)
OPEN_ISCSI_VER='iscsiadm version 6.2.0.874' OPEN_ISCSI_VER='iscsiadm version 6.2.0.874'
if [ "$CURRENT_VERSION" == "$OPEN_ISCSI_VER" ]; then if [ "$CURRENT_VERSION" == "$OPEN_ISCSI_VER" ]; then
mkdir -p open-iscsi-install if [ ! -d open-iscsi-install ]; then
cd open-iscsi-install mkdir -p open-iscsi-install
sudo dnf download --source iscsi-initiator-utils cd open-iscsi-install
rpm2cpio iscsi-initiator-utils-6.2.0.874-3.git86e8892.fc26.src.rpm | cpio -idmv sudo dnf download --source iscsi-initiator-utils
mkdir -p patches rpm2cpio iscsi-initiator-utils-6.2.0.874-3.git86e8892.fc26.src.rpm | cpio -idmv
mv 00* patches/ mkdir -p patches
git clone https://github.com/open-iscsi/open-iscsi mv 00* patches/
git clone https://github.com/open-iscsi/open-iscsi
cd open-iscsi cd open-iscsi
# the configurations of username and email are needed for applying patches to iscsiadm. # the configurations of username and email are needed for applying patches to iscsiadm.
git config user.name none git config user.name none
git config user.email none git config user.email none
git checkout 86e8892 git checkout 86e8892
for patch in `ls ../patches`; do for patch in `ls ../patches`; do
git am ../patches/$patch git am ../patches/$patch
done done
sed -i '427s/.*/-1);/' usr/session_info.c 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
sudo mkdir -p /usr/src sudo mkdir -p /usr/src
# Rocksdb is installed for use with the blobfs tests. # Rocksdb is installed for use with the blobfs tests.
git clone https://review.gerrithub.io/spdk/rocksdb if [ ! -d /usr/src/rocksdb ]; then
git -C ./rocksdb checkout spdk-v5.6.1 git clone https://review.gerrithub.io/spdk/rocksdb
sudo mv rocksdb /usr/src/ git -C ./rocksdb checkout spdk-v5.6.1
sudo mv rocksdb /usr/src/
git clone http://git.kernel.dk/fio.git 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"
cd /usr/src/fio && fi
git checkout fio-3.3 && if [ ! -d /usr/src/fio ]; then
make -j${jobs} && if [ ! -d fio ]; then
sudo make install 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
cd ~ cd ~
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
sudo mv FlameGraph /usr/local/FlameGraph
else
echo "flamegraph already installed. Skipping"
fi
SPDK_QEMU_BRANCH=spdk-2.12-pre SPDK_QEMU_BRANCH=spdk-2.12-pre
mkdir -p qemu mkdir -p qemu
cd qemu cd qemu
git clone https://github.com/spdk/qemu -b "$SPDK_QEMU_BRANCH" "$SPDK_QEMU_BRANCH" if [ ! -d "$SPDK_QEMU_BRANCH" ]; then
git clone https://github.com/spdk/qemu -b "$SPDK_QEMU_BRANCH" "$SPDK_QEMU_BRANCH"
else
echo "qemu already checked out. Skipping"
fi
cd "$SPDK_QEMU_BRANCH" cd "$SPDK_QEMU_BRANCH"
if hash tsocks &> /dev/null; then if hash tsocks &> /dev/null; then
git_param="--with-git='tsocks git'" git_param="--with-git='tsocks git'"
@ -183,7 +217,11 @@ cd ~
# We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need # 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. # to later. Cloning from git is just future proofing the machines.
git clone https://github.com/sahlberg/libiscsi if [ ! -d libiscsi ]; then
git clone https://github.com/sahlberg/libiscsi
else
echo "libiscsi already checked out. Skipping"
fi
cd libiscsi cd libiscsi
./autogen.sh ./autogen.sh
./configure --prefix=/usr/local/libiscsi ./configure --prefix=/usr/local/libiscsi