scripts/vagrant: Enable test machine deployment for fedora

Allow the option to run vm_setup.sh during provisioning on a fedora
system. This is one step closer to fully automating the setup of a build
pool test machine.

Change-Id: Ia3965b31e0a9217d176ffe3c165b8eb6b3ccad13
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/426946
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Seth Howell 2018-09-26 10:11:36 -07:00 committed by Ben Walker
parent 80bf04e6ad
commit 6695ac2797
2 changed files with 30 additions and 2 deletions

View File

@ -47,6 +47,14 @@ Vagrant.configure(2) do |config|
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
end
# Copy the tsocks configuration file for use when installing some spdk test pool dependencies
if File.file?("/etc/tsocks.conf")
config.vm.provision "file", source: "/etc/tsocks.conf", destination: "tsocks.conf"
config.vm.provision "shell", inline: "sudo mv tsocks.conf /etc/tsocks.conf"
config.vm.provision "shell", inline: "sudo chown root:wheel /etc/tsocks.conf"
config.vm.provision "shell", inline: "sudo chmod 644 /etc/tsocks.conf"
end
# vagrant-cachier caches apt/yum etc to speed subsequent
# vagrant up
# to enable, run
@ -124,6 +132,15 @@ Vagrant.configure(2) do |config|
config.vm.synced_folder "#{spdk_dir}", "/home/vagrant/spdk_repo/spdk", type: "rsync", rsync__auto: false
end
# provision the vm with all of the necessary spdk dependencies for running the autorun.sh tests
if ENV['DEPLOY_TEST_VM'] == "1" && spdk_dir != "none"
config.vm.provision "shell" do |setup|
setup.path = "#{spdk_dir}/test/common/config/vm_setup.sh"
setup.privileged = false
setup.args = ["-u", "-i"]
end
end
if vhost_host_dir != "none"
config.vm.synced_folder "#{vhost_host_dir}", "#{vhost_vm_dir}", type: "rsync", rsync__auto: false
config.vm.provision "shell", inline: "sudo mkdir -p /root/.ssh"

View File

@ -15,7 +15,7 @@ SPDK_DIR="$( cd "${DIR}/../../" && pwd )"
# The command line help
display_help() {
echo
echo " Usage: ${0##*/} [-n <num-cpus>] [-s <ram-size>] [-x <http-proxy>] [-hvrl] <distro>"
echo " Usage: ${0##*/} [-n <num-cpus>] [-s <ram-size>] [-x <http-proxy>] [-hvrld] <distro>"
echo
echo " distro = <centos7 | ubuntu16 | ubuntu18 | fedora26 | fedora27 | freebsd11> "
echo
@ -28,6 +28,7 @@ display_help() {
echo " --vhost-vm-dir=<path> directory where to put vhost dependencies in VM"
echo " -r dry-run"
echo " -l use a local copy of spdk, don't try to rsync from the host."
echo " -d deploy a test vm by provisioning all prerequisites for spdk autotest"
echo " -h help"
echo " -v verbose"
echo
@ -48,12 +49,13 @@ VERBOSE=0
HELP=0
COPY_SPDK_DIR=1
DRY_RUN=0
DEPLOY_TEST_VM=0
SPDK_VAGRANT_DISTRO="distro"
SPDK_VAGRANT_VMCPU=4
SPDK_VAGRANT_VMRAM=4096
OPTIND=1
while getopts ":n:s:x:p:vrlh-:" opt; do
while getopts ":n:s:x:p:vrldh-:" opt; do
case "${opt}" in
-)
case "${OPTARG}" in
@ -89,6 +91,9 @@ while getopts ":n:s:x:p:vrlh-:" opt; do
l)
COPY_SPDK_DIR=0
;;
d)
DEPLOY_TEST_VM=1
;;
*)
echo " Invalid argument: -$OPTARG" >&2
echo " Try: \"$0 -h\"" >&2
@ -127,6 +132,11 @@ case "$SPDK_VAGRANT_DISTRO" in
;;
esac
if ! echo "$SPDK_VAGRANT_DISTRO" | grep -q fedora && [ $DEPLOY_TEST_VM -eq 1 ]; then
echo "Warning: Test machine deployment is only available on fedora distros. Disabling it for this build"
DEPLOY_TEST_VM=0
fi
if [ ${VERBOSE} = 1 ]; then
echo
echo DIR=${DIR}
@ -148,6 +158,7 @@ export SPDK_VAGRANT_VMCPU
export SPDK_VAGRANT_VMRAM
export SPDK_DIR
export COPY_SPDK_DIR
export DEPLOY_TEST_VM
if [ -n "$PROVIDER" ]; then
provider="--provider=${PROVIDER}"