scripts/vagrant: add the ability to specify the nvme file.
This is necessary to enable multiple VMs to run in the same physical system since they each need a unique backing nvme drive. Change-Id: Ie2d3aa9604533b4d39932e1f68cb977bafdb7ab4 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/432202 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
faad3cd7bf
commit
b15ecfad85
9
scripts/vagrant/Vagrantfile
vendored
9
scripts/vagrant/Vagrantfile
vendored
@ -90,7 +90,7 @@ Vagrant.configure(2) do |config|
|
||||
vb.memory = "#{vmram}"
|
||||
vb.cpus = "#{vmcpu}"
|
||||
|
||||
nvme_disk = 'nvme.vdi'
|
||||
nvme_disk=(ENV['NVME_FILE'] || "nvme_disk.img")
|
||||
unless File.exist? (nvme_disk)
|
||||
vb.customize ["createhd", "--filename", nvme_disk, "--variant", "Fixed", "--size", "1024"]
|
||||
vb.customize ["storagectl", :id, "--name", "nvme", "--add", "pcie", "--controller", "NVMe", "--portcount", "1", "--bootable", "off"]
|
||||
@ -111,7 +111,12 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
# we put nvme_disk inside default pool to eliminate libvirt/SELinux Permissions Problems
|
||||
# and to be able to run vagrant from user $HOME directory
|
||||
nvme_disk = '/var/lib/libvirt/images/nvme_disk.img'
|
||||
if ENV['NVME_FILE']
|
||||
nvme_disk="/var/lib/libvirt/images/" + ENV['NVME_FILE']
|
||||
else
|
||||
nvme_disk="/var/lib/libvirt/images/nvme_disk.img"
|
||||
end
|
||||
|
||||
unless File.exist? (nvme_disk)
|
||||
puts "If run with libvirt provider please execute create_nvme_img.sh"
|
||||
end
|
||||
|
@ -1,15 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
SYSTEM=`uname -s`
|
||||
size="1024M"
|
||||
name="nvme_disk.img"
|
||||
|
||||
# NVMe img size example format: 2048M
|
||||
if [ -n $1 ]; then
|
||||
size=$1
|
||||
fi
|
||||
function usage() {
|
||||
echo "Usage: ${0##*/} [-s <disk_size>] [-n <backing file name>]"
|
||||
echo "-s <disk_size> with postfix e.g. 2G default: 1024M"
|
||||
echo "-n <backing file name> default: nvme_disk.img"
|
||||
}
|
||||
|
||||
while getopts "s:n:h-:" opt; do
|
||||
case "${opt}" in
|
||||
-)
|
||||
echo " Invalid argument: $OPTARG"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
s)
|
||||
size=$OPTARG
|
||||
;;
|
||||
n)
|
||||
name=$OPTARG
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo " Invalid argument: $OPTARG"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! "${SYSTEM}" = "FreeBSD" ]; then
|
||||
WHICH_OS=`lsb_release -i | awk '{print $3}'`
|
||||
nvme_disk='/var/lib/libvirt/images/nvme_disk.img'
|
||||
nvme_disk="/var/lib/libvirt/images/$name"
|
||||
|
||||
qemu-img create -f raw $nvme_disk ${size}
|
||||
#Change SE Policy on Fedora
|
||||
|
@ -15,10 +15,11 @@ SPDK_DIR="$( cd "${DIR}/../../" && pwd )"
|
||||
# The command line help
|
||||
display_help() {
|
||||
echo
|
||||
echo " Usage: ${0##*/} [-n <num-cpus>] [-s <ram-size>] [-x <http-proxy>] [-hvrld] <distro>"
|
||||
echo " Usage: ${0##*/} [-b nvme-backing-file] [-n <num-cpus>] [-s <ram-size>] [-x <http-proxy>] [-hvrld] <distro>"
|
||||
echo
|
||||
echo " distro = <centos7 | ubuntu16 | ubuntu18 | fedora26 | fedora27 | freebsd11> "
|
||||
echo
|
||||
echo " -b <nvme-backing-file> default: ${NVME_FILE}"
|
||||
echo " -s <ram-size> in kb default: ${SPDK_VAGRANT_VMRAM}"
|
||||
echo " -n <num-cpus> 1 to 4 default: ${SPDK_VAGRANT_VMCPU}"
|
||||
echo " -x <http-proxy> default: \"${SPDK_VAGRANT_HTTP_PROXY}\""
|
||||
@ -54,8 +55,9 @@ SPDK_VAGRANT_DISTRO="distro"
|
||||
SPDK_VAGRANT_VMCPU=4
|
||||
SPDK_VAGRANT_VMRAM=4096
|
||||
OPTIND=1
|
||||
NVME_FILE="nvme_disk.img"
|
||||
|
||||
while getopts ":n:s:x:p:vrldh-:" opt; do
|
||||
while getopts ":b:n:s:x:p:vrldh-:" opt; do
|
||||
case "${opt}" in
|
||||
-)
|
||||
case "${OPTARG}" in
|
||||
@ -94,6 +96,9 @@ while getopts ":n:s:x:p:vrldh-:" opt; do
|
||||
d)
|
||||
DEPLOY_TEST_VM=1
|
||||
;;
|
||||
b)
|
||||
NVME_FILE=$OPTARG
|
||||
;;
|
||||
*)
|
||||
echo " Invalid argument: -$OPTARG" >&2
|
||||
echo " Try: \"$0 -h\"" >&2
|
||||
@ -147,6 +152,7 @@ if [ ${VERBOSE} = 1 ]; then
|
||||
echo VAGRANT_TARGET=${VAGRANT_TARGET}
|
||||
echo HELP=$HELP
|
||||
echo DRY_RUN=$DRY_RUN
|
||||
echo NVME_FILE=$NVME_FILE
|
||||
echo SPDK_VAGRANT_DISTRO=$SPDK_VAGRANT_DISTRO
|
||||
echo SPDK_VAGRANT_VMCPU=$SPDK_VAGRANT_VMCPU
|
||||
echo SPDK_VAGRANT_VMRAM=$SPDK_VAGRANT_VMRAM
|
||||
@ -162,6 +168,7 @@ export SPDK_VAGRANT_VMRAM
|
||||
export SPDK_DIR
|
||||
export COPY_SPDK_DIR
|
||||
export DEPLOY_TEST_VM
|
||||
export NVME_FILE
|
||||
|
||||
if [ -n "$PROVIDER" ]; then
|
||||
provider="--provider=${PROVIDER}"
|
||||
|
Loading…
Reference in New Issue
Block a user