summaryrefslogtreecommitdiffstats
path: root/src/spdk/scripts/vagrant/create_nvme_img.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/spdk/scripts/vagrant/create_nvme_img.sh')
-rwxr-xr-xsrc/spdk/scripts/vagrant/create_nvme_img.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/spdk/scripts/vagrant/create_nvme_img.sh b/src/spdk/scripts/vagrant/create_nvme_img.sh
new file mode 100755
index 00000000..0fec5770
--- /dev/null
+++ b/src/spdk/scripts/vagrant/create_nvme_img.sh
@@ -0,0 +1,22 @@
+#!/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