scripts/vagrant: Make rsyncing spdk directory optional

For some use cases (e.g. creating a test pool vm), we won't want to
rsync spdk from the host, and instead will want to clone a new one from
scratch.

Change-Id: I4c27f8ffc6c04aa0901dfe5b536b7e6ba94f7693
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/426945
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Seth Howell 2018-09-26 09:00:24 -07:00 committed by Ben Walker
parent f1b3df73b6
commit 80bf04e6ad
2 changed files with 9 additions and 3 deletions

View File

@ -120,7 +120,7 @@ Vagrant.configure(2) do |config|
end
# rsync the spdk directory if provision hasn't happened yet
if spdk_dir != "none"
if ENV['COPY_SPDK_DIR'] == "1" && spdk_dir != "none"
config.vm.synced_folder "#{spdk_dir}", "/home/vagrant/spdk_repo/spdk", type: "rsync", rsync__auto: false
end

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>] [-hvr] <distro>"
echo " Usage: ${0##*/} [-n <num-cpus>] [-s <ram-size>] [-x <http-proxy>] [-hvrl] <distro>"
echo
echo " distro = <centos7 | ubuntu16 | ubuntu18 | fedora26 | fedora27 | freebsd11> "
echo
@ -27,6 +27,7 @@ display_help() {
echo " (test VM qcow image, fio binary, ssh keys)"
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 " -h help"
echo " -v verbose"
echo
@ -45,13 +46,14 @@ SPDK_VAGRANT_HTTP_PROXY=""
VERBOSE=0
HELP=0
COPY_SPDK_DIR=1
DRY_RUN=0
SPDK_VAGRANT_DISTRO="distro"
SPDK_VAGRANT_VMCPU=4
SPDK_VAGRANT_VMRAM=4096
OPTIND=1
while getopts ":n:s:x:p:vrh-:" opt; do
while getopts ":n:s:x:p:vrlh-:" opt; do
case "${opt}" in
-)
case "${OPTARG}" in
@ -84,6 +86,9 @@ while getopts ":n:s:x:p:vrh-:" opt; do
display_help >&2
exit 0
;;
l)
COPY_SPDK_DIR=0
;;
*)
echo " Invalid argument: -$OPTARG" >&2
echo " Try: \"$0 -h\"" >&2
@ -142,6 +147,7 @@ export SPDK_VAGRANT_HTTP_PROXY
export SPDK_VAGRANT_VMCPU
export SPDK_VAGRANT_VMRAM
export SPDK_DIR
export COPY_SPDK_DIR
if [ -n "$PROVIDER" ]; then
provider="--provider=${PROVIDER}"