From 1cbd14ca1bb42f5489f1646b74acf90b621ee810 Mon Sep 17 00:00:00 2001 From: Lavar Askew Date: Sat, 24 Nov 2018 05:42:34 -0800 Subject: [PATCH] Boxes to support libvirt as provider. Virtualbox set as default. For ubuntu18 and 16 logic added to only download sjohnsen boxes if provider is libvirt. Also changed PROVIDER to SPDK_VAGRANT_PROVIDER and initialized to virtualbox. Now the directory of the default provider should read unbuntu16-virtualbox as opposed to ubuntu16-. Change-Id: I6cac03432b02cfd259759d504ec133d29d1f740e Signed-off-by: Lavar Askew Reviewed-on: https://review.gerrithub.io/434599 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Paul Luse Reviewed-by: Jim Harris Reviewed-by: Darek Stojaczyk Reviewed-by: Karol Latecki --- scripts/vagrant/Vagrantfile | 23 +++++++++++++++++------ scripts/vagrant/create_vbox.sh | 25 ++++++++++++++++--------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index 8b5b0ace5f..cab75b34ad 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -5,6 +5,7 @@ Vagrant.configure(2) do |config| # Pick the right distro and bootstrap, default is fedora26 distro = ( ENV['SPDK_VAGRANT_DISTRO'] || "fedora26") + provider = (ENV['SPDK_VAGRANT_PROVIDER'] || "virtualbox") case distro when "centos7" config.vm.box = "puppetlabs/centos-7.2-64-nocm" @@ -14,13 +15,23 @@ Vagrant.configure(2) do |config| config.vm.box = "centos/7" end if Vagrant.has_plugin?('vagrant-libvirt') when "ubuntu16" - # See: https://app.vagrantup.com/puppetlabs/boxes/ubuntu-16.04-64-nocm - config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" - config.vm.box_version = "1.0.0" + if provider.eql?("libvirt") + # https://app.vagrantup.com/sjohnsen/boxes/ubuntu1604 + config.vm.box = "sjohnsen/ubuntu1604" + else + # See: https://app.vagrantup.com/puppetlabs/boxes/ubuntu-16.04-64-nocm + config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" + config.vm.box_version = "1.0.0" + end when "ubuntu18" - # See: https://app.vagrantup.com/bento/boxes/ubuntu-18.04 - config.vm.box = "bento/ubuntu-18.04" - config.vm.box_version = "201803.24.0" + if provider.eql?("libvirt") + # https://app.vagrantup.com/sjohnsen/boxes/ubuntu1804 + config.vm.box = "sjohnsen/ubuntu1804" + else + # See: https://app.vagrantup.com/bento/boxes/ubuntu-18.04 + config.vm.box = "bento/ubuntu-18.04" + config.vm.box_version = "201803.24.0" + end when "fedora26" #See: https://app.vagrantup.com/generic/boxes/fedora2 config.vm.box = "generic/fedora26" diff --git a/scripts/vagrant/create_vbox.sh b/scripts/vagrant/create_vbox.sh index d5d57827d1..60b9bf8c6d 100755 --- a/scripts/vagrant/create_vbox.sh +++ b/scripts/vagrant/create_vbox.sh @@ -54,6 +54,7 @@ DEPLOY_TEST_VM=0 SPDK_VAGRANT_DISTRO="distro" SPDK_VAGRANT_VMCPU=4 SPDK_VAGRANT_VMRAM=4096 +SPDK_VAGRANT_PROVIDER="virtualbox" OPTIND=1 NVME_FILE="nvme_disk.img" @@ -78,7 +79,7 @@ while getopts ":b:n:s:x:p:vrldh-:" opt; do SPDK_VAGRANT_VMRAM=$OPTARG ;; p) - PROVIDER=$OPTARG + SPDK_VAGRANT_PROVIDER=$OPTARG ;; v) VERBOSE=1 @@ -156,6 +157,7 @@ if [ ${VERBOSE} = 1 ]; then echo SPDK_VAGRANT_DISTRO=$SPDK_VAGRANT_DISTRO echo SPDK_VAGRANT_VMCPU=$SPDK_VAGRANT_VMCPU echo SPDK_VAGRANT_VMRAM=$SPDK_VAGRANT_VMRAM + echo SPDK_VAGRANT_PROVIDER=$SPDK_VAGRANT_PROVIDER echo SPDK_VAGRANT_HTTP_PROXY=$SPDK_VAGRANT_HTTP_PROXY echo VHOST_HOST_DIR=$VHOST_HOST_DIR echo VHOST_VM_DIR=$VHOST_VM_DIR @@ -170,8 +172,8 @@ export COPY_SPDK_DIR export DEPLOY_TEST_VM export NVME_FILE -if [ -n "$PROVIDER" ]; then - provider="--provider=${PROVIDER}" +if [ -n "$SPDK_VAGRANT_PROVIDER" ]; then + provider="--provider=${SPDK_VAGRANT_PROVIDER}" fi if [ -n "$VHOST_HOST_DIR" ]; then @@ -182,24 +184,29 @@ if [ -n "$VHOST_VM_DIR" ]; then export VHOST_VM_DIR fi +if [ -n "$SPDK_VAGRANT_PROVIDER" ]; then + export SPDK_VAGRANT_PROVIDER +fi + if [ ${DRY_RUN} = 1 ]; then echo "Environemnt Variables" printenv SPDK_VAGRANT_DISTRO printenv SPDK_VAGRANT_VMRAM printenv SPDK_VAGRANT_VMCPU + printenv SPDK_VAGRANT_PROVIDER printenv SPDK_VAGRANT_HTTP_PROXY printenv SPDK_DIR fi -if [ -d "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${PROVIDER}" ]; then - echo "Error: ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${PROVIDER} already exists!" +if [ -d "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" ]; then + echo "Error: ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} already exists!" exit 1 fi if [ ${DRY_RUN} != 1 ]; then - mkdir -vp "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${PROVIDER}" - cp ${DIR}/Vagrantfile ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${PROVIDER} - pushd "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${PROVIDER}" + mkdir -vp "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" + cp ${DIR}/Vagrantfile ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} + pushd "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" if [ ! -z "${http_proxy}" ]; then export http_proxy export https_proxy @@ -220,7 +227,7 @@ EOF echo "" echo " SUCCESS!" echo "" - echo " cd to ${SPDK_VAGRANT_DISTRO}-${PROVIDER} and type \"vagrant ssh\" to use." + echo " cd to ${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} and type \"vagrant ssh\" to use." 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 ""