diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index 3d23ee800..f02942f9f 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -97,6 +97,7 @@ Vagrant.configure(2) do |config| emulated_nvme_types=(ENV['NVME_DISKS_TYPE'] || "nvme").split(',') nvme_namespaces=(ENV['NVME_DISKS_NAMESPACES'] || "").split(',') nvme_file=(ENV['NVME_FILE'] || "").split(',') + vagrantfile_dir=(ENV['VAGRANTFILE_DIR'] || "none") config.ssh.forward_agent = true config.ssh.forward_x11 = true @@ -194,6 +195,11 @@ Vagrant.configure(2) do |config| config.vm.synced_folder "#{spdk_dir}", "/home/vagrant/spdk_repo/spdk", owner: "vagrant", group: "vagrant", type: "rsync", rsync__auto: false end + # rsync artifacts from build + if ENV['COPY_SPDK_ARTIFACTS'] == "1" + config.vm.synced_folder "#{vagrantfile_dir}", "/home/vagrant/spdk_repo/output", type: "sshfs" + 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| diff --git a/scripts/vagrant/create_vbox.sh b/scripts/vagrant/create_vbox.sh index e11043769..7252cf15f 100755 --- a/scripts/vagrant/create_vbox.sh +++ b/scripts/vagrant/create_vbox.sh @@ -35,6 +35,7 @@ display_help() { echo " -c Create all above disk, default 0" echo " -u Use password authentication to the VM instead of SSH keys." echo " -l Use a local copy of spdk, don't try to rsync from the host." + echo " -a Copy spdk/autorun.sh artifacts from VM to host system." echo " -d Deploy a test vm by provisioning all prerequisites for spdk autotest" echo " --qemu-emulator= Path to custom QEMU binary. Only works with libvirt provider" echo " --vagrantfiles-dir= Destination directory to put Vagrantfile into." @@ -62,6 +63,7 @@ SPDK_VAGRANT_HTTP_PROXY="" VERBOSE=0 HELP=0 COPY_SPDK_DIR=1 +COPY_SPDK_ARTIFACTS=0 DRY_RUN=0 DEPLOY_TEST_VM=0 SPDK_VAGRANT_DISTRO="distro" @@ -78,7 +80,7 @@ VAGRANTFILE_DIR="" VAGRANT_PASSWORD_AUTH=0 VAGRANT_PACKAGE_BOX=0 -while getopts ":b:n:s:x:p:u:vcrldh-:" opt; do +while getopts ":b:n:s:x:p:u:vcraldh-:" opt; do case "${opt}" in -) case "${OPTARG}" in @@ -115,6 +117,9 @@ while getopts ":b:n:s:x:p:u:vcrldh-:" opt; do display_help >&2 exit 0 ;; + a) + COPY_SPDK_ARTIFACTS=1 + ;; l) COPY_SPDK_DIR=0 ;; @@ -228,6 +233,7 @@ export SPDK_VAGRANT_VMCPU export SPDK_VAGRANT_VMRAM export SPDK_DIR export COPY_SPDK_DIR +export COPY_SPDK_ARTIFACTS export DEPLOY_TEST_VM export NVME_DISKS_TYPE export NVME_DISKS_NAMESPACES @@ -262,6 +268,7 @@ if [ ${DRY_RUN} = 1 ]; then fi if [ -z "$VAGRANTFILE_DIR" ]; then VAGRANTFILE_DIR="${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" + export VAGRANTFILE_DIR fi if [ -d "${VAGRANTFILE_DIR}" ]; then @@ -289,6 +296,7 @@ http_proxy: ${http_proxy} EOF fi fi + mkdir -p "${VAGRANTFILE_DIR}/output" vagrant up $provider if [ ${VAGRANT_PACKAGE_BOX} == 1 ]; then vagrant ssh -c 'sudo spdk_repo/spdk/scripts/vagrant/update.sh'