scripts/vagrant: synchronize artifacts from vm to host

Sync "output" directory (containing all build results,
like doc, coverage, test completions, etc.)
from guest to host.

Change-Id: I9a57a72eb610aacde011fc39bb8d39c74486cef1
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1044
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Maciej Wawryk 2020-02-27 15:43:13 +01:00 committed by Tomasz Zawadzki
parent 2a75be1a56
commit a2eeec65f8
2 changed files with 15 additions and 1 deletions

View File

@ -97,6 +97,7 @@ Vagrant.configure(2) do |config|
emulated_nvme_types=(ENV['NVME_DISKS_TYPE'] || "nvme").split(',') emulated_nvme_types=(ENV['NVME_DISKS_TYPE'] || "nvme").split(',')
nvme_namespaces=(ENV['NVME_DISKS_NAMESPACES'] || "").split(',') nvme_namespaces=(ENV['NVME_DISKS_NAMESPACES'] || "").split(',')
nvme_file=(ENV['NVME_FILE'] || "").split(',') nvme_file=(ENV['NVME_FILE'] || "").split(',')
vagrantfile_dir=(ENV['VAGRANTFILE_DIR'] || "none")
config.ssh.forward_agent = true config.ssh.forward_agent = true
config.ssh.forward_x11 = 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 config.vm.synced_folder "#{spdk_dir}", "/home/vagrant/spdk_repo/spdk", owner: "vagrant", group: "vagrant", type: "rsync", rsync__auto: false
end 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 # 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" if ENV['DEPLOY_TEST_VM'] == "1" && spdk_dir != "none"
config.vm.provision "shell" do |setup| config.vm.provision "shell" do |setup|

View File

@ -35,6 +35,7 @@ display_help() {
echo " -c Create all above disk, default 0" echo " -c Create all above disk, default 0"
echo " -u Use password authentication to the VM instead of SSH keys." 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 " -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 " -d Deploy a test vm by provisioning all prerequisites for spdk autotest"
echo " --qemu-emulator=<path> Path to custom QEMU binary. Only works with libvirt provider" echo " --qemu-emulator=<path> Path to custom QEMU binary. Only works with libvirt provider"
echo " --vagrantfiles-dir=<path> Destination directory to put Vagrantfile into." echo " --vagrantfiles-dir=<path> Destination directory to put Vagrantfile into."
@ -62,6 +63,7 @@ SPDK_VAGRANT_HTTP_PROXY=""
VERBOSE=0 VERBOSE=0
HELP=0 HELP=0
COPY_SPDK_DIR=1 COPY_SPDK_DIR=1
COPY_SPDK_ARTIFACTS=0
DRY_RUN=0 DRY_RUN=0
DEPLOY_TEST_VM=0 DEPLOY_TEST_VM=0
SPDK_VAGRANT_DISTRO="distro" SPDK_VAGRANT_DISTRO="distro"
@ -78,7 +80,7 @@ VAGRANTFILE_DIR=""
VAGRANT_PASSWORD_AUTH=0 VAGRANT_PASSWORD_AUTH=0
VAGRANT_PACKAGE_BOX=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 "${opt}" in
-) -)
case "${OPTARG}" in case "${OPTARG}" in
@ -115,6 +117,9 @@ while getopts ":b:n:s:x:p:u:vcrldh-:" opt; do
display_help >&2 display_help >&2
exit 0 exit 0
;; ;;
a)
COPY_SPDK_ARTIFACTS=1
;;
l) l)
COPY_SPDK_DIR=0 COPY_SPDK_DIR=0
;; ;;
@ -228,6 +233,7 @@ export SPDK_VAGRANT_VMCPU
export SPDK_VAGRANT_VMRAM export SPDK_VAGRANT_VMRAM
export SPDK_DIR export SPDK_DIR
export COPY_SPDK_DIR export COPY_SPDK_DIR
export COPY_SPDK_ARTIFACTS
export DEPLOY_TEST_VM export DEPLOY_TEST_VM
export NVME_DISKS_TYPE export NVME_DISKS_TYPE
export NVME_DISKS_NAMESPACES export NVME_DISKS_NAMESPACES
@ -262,6 +268,7 @@ if [ ${DRY_RUN} = 1 ]; then
fi fi
if [ -z "$VAGRANTFILE_DIR" ]; then if [ -z "$VAGRANTFILE_DIR" ]; then
VAGRANTFILE_DIR="${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" VAGRANTFILE_DIR="${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}"
export VAGRANTFILE_DIR
fi fi
if [ -d "${VAGRANTFILE_DIR}" ]; then if [ -d "${VAGRANTFILE_DIR}" ]; then
@ -289,6 +296,7 @@ http_proxy: ${http_proxy}
EOF EOF
fi fi
fi fi
mkdir -p "${VAGRANTFILE_DIR}/output"
vagrant up $provider vagrant up $provider
if [ ${VAGRANT_PACKAGE_BOX} == 1 ]; then if [ ${VAGRANT_PACKAGE_BOX} == 1 ]; then
vagrant ssh -c 'sudo spdk_repo/spdk/scripts/vagrant/update.sh' vagrant ssh -c 'sudo spdk_repo/spdk/scripts/vagrant/update.sh'