summaryrefslogtreecommitdiffstats
path: root/src/spdk/scripts/vagrant/create_nvme_img.sh
blob: 0fec5770fa72592e12671c4aa10aad925d00591e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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