numam-spdk/scripts/vagrant/create_openstack_vm.sh
Karol Latecki 1ccc878e7f scripts: use -n instead of ! -z
Changing according to styling check done by ShellCheck.
Removing from check_format.sh exclusion list:
SC2236 - Use -n instead of ! -z
SC2070 - -n doesn't work with unquoted arguments. Quote or use [[ ]]

Change-Id: Ia9d645b9d0ce31b67c4de682395cf36f4ddc8d1f
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463180
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-08-08 21:27:40 +00:00

34 lines
886 B
Bash
Executable File

#!/usr/bin/env bash
set -e
testdir=$(readlink -f $(dirname $0))
SPDK_DIR=$(readlink -f $testdir/../..)
VAGRANT_TARGET="$PWD"
VAGRANT_DISTRO="ubuntu18"
export SPDK_DIR
export SPDK_VAGRANT_VMRAM=8192
export SPDK_VAGRANT_VMCPU=10
mkdir -vp "${VAGRANT_TARGET}/${VAGRANT_DISTRO}"
cp "${testdir}/Vagrantfile_openstack_vm" "${VAGRANT_TARGET}/${VAGRANT_DISTRO}/Vagrantfile"
pushd "${VAGRANT_TARGET}/${VAGRANT_DISTRO}"
if [ -n "${http_proxy}" ]; then
export http_proxy
fi
VBoxManage setproperty machinefolder "${VAGRANT_TARGET}/${VAGRANT_DISTRO}"
vagrant up
vagrant halt
VBoxManage setproperty machinefolder default
# Convert Vbox .vmdk image to qcow2
vmdk_img=$(find ${VAGRANT_TARGET}/${VAGRANT_DISTRO} -name "ubuntu-18.04-amd64-disk001.vmdk")
qemu-img convert -f vmdk -O qcow2 ${vmdk_img} ${VAGRANT_TARGET}/${VAGRANT_DISTRO}/openstack_vm_image.qcow2
echo ""
echo " SUCCESS!"
echo ""