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 <pawelx.piatek@intel.com>
Change-Id: I89c9802ebb80bd411ebe93dbc98e54fb32779e4b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3576
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Piatek 2020-07-29 10:38:21 +02:00 committed by Tomasz Zawadzki
parent 69d5d77bfb
commit 2188940e63
2 changed files with 34 additions and 1 deletions

View File

@ -264,6 +264,38 @@ function install_extra_pkgs() {
fi 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_VERSION=2.25.1
: ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git} : ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git}
export GIT_REPO_SPDK export GIT_REPO_SPDK
@ -315,6 +347,7 @@ else
) )
fi fi
sources+=(install_fio) sources+=(install_fio)
sources+=(install_vagrant)
sudo mkdir -p /usr/{,local}/src sudo mkdir -p /usr/{,local}/src
sudo mkdir -p "$GIT_REPOS" sudo mkdir -p "$GIT_REPOS"

View File

@ -29,7 +29,7 @@ VM_SETUP_PATH=$(readlink -f ${BASH_SOURCE%/*})
UPGRADE=false UPGRADE=false
INSTALL=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= package_manager=
function usage() { function usage() {