From 3d2ee8d1cecbae003108d4c2c85bdca9e97df524 Mon Sep 17 00:00:00 2001 From: Maciej Wawryk Date: Fri, 6 Dec 2019 15:16:04 +0100 Subject: [PATCH] scripts/vagrant: allow password authentication Add password authentication to vagrant for future boxes building functionality Signed-off-by: Maciej Wawryk Change-Id: Iad9c3c4000ac43243900ee6b5396863b9ab820ff Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477062 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Darek Stojaczyk Reviewed-by: Karol Latecki Reviewed-by: Tomasz Zawadzki Reviewed-by: Shuhei Matsumoto --- scripts/vagrant/Vagrantfile | 4 ++++ scripts/vagrant/create_vbox.sh | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index b5552d467d..beb5eef543 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -112,6 +112,10 @@ Vagrant.configure(2) do |config| config.ssh.forward_agent = true config.ssh.forward_x11 = true + if ENV['VAGRANT_PASSWORD_AUTH'] == "1" + config.ssh.username = "vagrant" + config.ssh.password = "vagrant" + end config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--ioapic", "on"] diff --git a/scripts/vagrant/create_vbox.sh b/scripts/vagrant/create_vbox.sh index 8be5dfdaff..a1757450e8 100755 --- a/scripts/vagrant/create_vbox.sh +++ b/scripts/vagrant/create_vbox.sh @@ -37,6 +37,7 @@ display_help() { echo " --vhost-vm-dir= directory where to put vhost dependencies in VM" echo " --qemu-emulator= directory path with emulator, default: ${SPDK_QEMU_EMULATOR}" echo " --vagrantfiles-dir= directory to put vagrantfile" + echo " -u allow password authentication to vagrant box" 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" @@ -75,8 +76,9 @@ NVME_DISKS_NAMESPACES="" NVME_FILE="" NVME_AUTO_CREATE=0 VAGRANTFILE_DIR="" +VAGRANT_PASSWORD_AUTH=0 -while getopts ":b:n:s:x:p:vcrldh-:" opt; do +while getopts ":b:n:s:x:p:u:vcrldh-:" opt; do case "${opt}" in -) case "${OPTARG}" in @@ -123,6 +125,9 @@ while getopts ":b:n:s:x:p:vcrldh-:" opt; do b) NVME_FILE+="${OPTARG#*=} " ;; + u) + VAGRANT_PASSWORD_AUTH=1 + ;; *) echo " Invalid argument: -$OPTARG" >&2 echo " Try: \"$0 -h\"" >&2 @@ -232,6 +237,7 @@ export DEPLOY_TEST_VM export NVME_DISKS_TYPE export NVME_DISKS_NAMESPACES export NVME_FILE +export VAGRANT_PASSWORD_AUTH if [ -n "$SPDK_VAGRANT_PROVIDER" ]; then provider="--provider=${SPDK_VAGRANT_PROVIDER}"