numam-spdk/scripts/vagrant/create_nvme_img.sh
Karol Latecki 2aaaff5ee8 scripts/vagrant: allow adjustable nvme img size
Allow specifying size for created NVMe image file.
Default is 1024M but some tests suites (vhost_initator
for example) need more.

Change-Id: I4bf7a5241a0e9c2320cd473b1787c0be25d9a8e4
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/426068
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2018-09-28 18:43:42 +00:00

23 lines
466 B
Bash
Executable File

#!/usr/bin/env bash
SYSTEM=`uname -s`
size="1024M"
# NVMe img size example format: 2048M
if [ -n $1 ]; then
size=$1
fi
if [ ! "${SYSTEM}" = "FreeBSD" ]; then
WHICH_OS=`lsb_release -i | awk '{print $3}'`
nvme_disk='/var/lib/libvirt/images/nvme_disk.img'
qemu-img create -f raw $nvme_disk ${size}
#Change SE Policy on Fedora
if [ $WHICH_OS == "Fedora" ]; then
sudo chcon -t svirt_image_t $nvme_disk
fi
chmod 777 $nvme_disk
chown qemu:qemu $nvme_disk
fi