scripts/vagrant: Allow running multiple VMs in parallel

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I7047c3152558911a782be86e5ccf8214f2418c02
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472692
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Maciej Wawryk 2019-10-29 13:04:11 +01:00 committed by Tomasz Zawadzki
parent ff231506d3
commit 809a6f82de

View File

@ -32,6 +32,7 @@ display_help() {
echo " (test VM qcow image, fio binary, ssh keys)" echo " (test VM qcow image, fio binary, ssh keys)"
echo " --vhost-vm-dir=<path> directory where to put vhost dependencies in VM" echo " --vhost-vm-dir=<path> directory where to put vhost dependencies in VM"
echo " --qemu-emulator=<path> directory path with emulator, default: ${SPDK_QEMU_EMULATOR}" echo " --qemu-emulator=<path> directory path with emulator, default: ${SPDK_QEMU_EMULATOR}"
echo " --vagrantfiles-dir=<path> directory to put vagrantfile"
echo " -r dry-run" echo " -r dry-run"
echo " -l use a local copy of spdk, don't try to rsync from the host." 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 " -d deploy a test vm by provisioning all prerequisites for spdk autotest"
@ -68,6 +69,7 @@ OPTIND=1
NVME_DISKS_TYPE="" NVME_DISKS_TYPE=""
NVME_DISKS_NAMESPACES="" NVME_DISKS_NAMESPACES=""
NVME_FILE="" NVME_FILE=""
VAGRANTFILE_DIR=""
while getopts ":b:n:s:x:p:vrldh-:" opt; do while getopts ":b:n:s:x:p:vrldh-:" opt; do
case "${opt}" in case "${opt}" in
@ -76,6 +78,7 @@ while getopts ":b:n:s:x:p:vrldh-:" opt; do
vhost-host-dir=*) VHOST_HOST_DIR="${OPTARG#*=}" ;; vhost-host-dir=*) VHOST_HOST_DIR="${OPTARG#*=}" ;;
vhost-vm-dir=*) VHOST_VM_DIR="${OPTARG#*=}" ;; vhost-vm-dir=*) VHOST_VM_DIR="${OPTARG#*=}" ;;
qemu-emulator=*) SPDK_QEMU_EMULATOR="${OPTARG#*=}" ;; qemu-emulator=*) SPDK_QEMU_EMULATOR="${OPTARG#*=}" ;;
vagrantfiles-dir=*) VAGRANTFILE_DIR="${OPTARG#*=}" ;;
*) echo "Invalid argument '$OPTARG'" ;; *) echo "Invalid argument '$OPTARG'" ;;
esac esac
;; ;;
@ -246,16 +249,19 @@ if [ ${DRY_RUN} = 1 ]; then
printenv NVME_FILE printenv NVME_FILE
printenv SPDK_DIR printenv SPDK_DIR
fi fi
if [ -z "$VAGRANTFILE_DIR" ]; then
VAGRANTFILE_DIR="${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}"
fi
if [ -d "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" ]; then if [ -d "${VAGRANTFILE_DIR}" ]; then
echo "Error: ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} already exists!" echo "Error: ${VAGRANTFILE_DIR} already exists!"
exit 1 exit 1
fi fi
if [ ${DRY_RUN} != 1 ]; then if [ ${DRY_RUN} != 1 ]; then
mkdir -vp "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" mkdir -vp "${VAGRANTFILE_DIR}"
cp ${DIR}/Vagrantfile ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} cp ${DIR}/Vagrantfile ${VAGRANTFILE_DIR}
pushd "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" pushd "${VAGRANTFILE_DIR}"
if [ -n "${http_proxy}" ]; then if [ -n "${http_proxy}" ]; then
export http_proxy export http_proxy
export https_proxy export https_proxy
@ -276,8 +282,8 @@ EOF
echo "" echo ""
echo " SUCCESS!" echo " SUCCESS!"
echo "" echo ""
echo " cd to ${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} and type \"vagrant ssh\" to use." echo " cd to ${VAGRANTFILE_DIR} and type \"vagrant ssh\" to use."
echo " Use vagrant \"suspend\" and vagrant \"resume\" to stop and start." echo " Use vagrant \"suspend\" and vagrant \"resume\" to stop and start."
echo " Use vagrant \"destroy\" followed by \"rm -rf ${SPDK_VAGRANT_DISTRO}\" to destroy all trace of vm." echo " Use vagrant \"destroy\" followed by \"rm -rf ${VAGRANTFILE_DIR}\" to destroy all trace of vm."
echo "" echo ""
fi fi