From 2188940e6376bac699343351f0dec04a402b18b2 Mon Sep 17 00:00:00 2001 From: Pawel Piatek Date: Wed, 29 Jul 2020 10:38:21 +0200 Subject: [PATCH] test/vm_setup: add vagrant-install option Add option to install vagrant and it's plugins required to run SPDK test VMs'. Signed-off-by: Pawel Piatek Change-Id: I89c9802ebb80bd411ebe93dbc98e54fb32779e4b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3576 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Karol Latecki Reviewed-by: Maciej Wawryk Reviewed-by: Michal Berger Reviewed-by: Jim Harris --- test/common/config/pkgdep/git | 33 +++++++++++++++++++++++++++++++++ test/common/config/vm_setup.sh | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/test/common/config/pkgdep/git b/test/common/config/pkgdep/git index 711bf39e3..a734b3e2b 100644 --- a/test/common/config/pkgdep/git +++ b/test/common/config/pkgdep/git @@ -264,6 +264,38 @@ function install_extra_pkgs() { fi } +function install_vagrant() { + local vagrant_version="2.2.7" + local vagrant_installer="vagrant_${vagrant_version}_x86_64.deb" + local vagrant_plugins=(vagrant-libvirt vagrant-sshfs vagrant-cachier vagrant-proxyconf) + + if [[ $OSID != ubuntu ]]; then + error "Currently only ubuntu is supported" + fi + + # Download and install vagrant + if hash vagrant &> /dev/null; then + echo "Vagrant is already installed" + else + wget "https://releases.hashicorp.com/vagrant/${vagrant_version}/${vagrant_installer}" + sudo dpkg -i "${vagrant_installer}" + fi + vagrant --version + + # Install vagrant plugins + local vagrant_plugin_list + vagrant_plugin_list=$(vagrant plugin list) + + local plugin + for plugin in "${vagrant_plugins[@]}"; do + if grep -Fq "$plugin" <<< "$vagrant_plugin_list"; then + echo "$plugin already installed" + else + vagrant plugin install "$plugin" + fi + done +} + GIT_VERSION=2.25.1 : ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git} export GIT_REPO_SPDK @@ -315,6 +347,7 @@ else ) fi sources+=(install_fio) +sources+=(install_vagrant) sudo mkdir -p /usr/{,local}/src sudo mkdir -p "$GIT_REPOS" diff --git a/test/common/config/vm_setup.sh b/test/common/config/vm_setup.sh index 89c0caaf9..9eb8eafe8 100755 --- a/test/common/config/vm_setup.sh +++ b/test/common/config/vm_setup.sh @@ -29,7 +29,7 @@ VM_SETUP_PATH=$(readlink -f ${BASH_SOURCE%/*}) UPGRADE=false INSTALL=false -CONF="rocksdb,fio,flamegraph,tsocks,qemu,libiscsi,nvmecli,qat,spdk,refspdk" +CONF="rocksdb,fio,flamegraph,tsocks,qemu,libiscsi,nvmecli,qat,spdk,refspdk,vagrant" package_manager= function usage() {