vagrant: preallocate nvme images by default
Added preallocation option for raw NVMe disk images.
It matches qemu-img option for raw images.
By default raw images are created with "off" option,
resulting in increased size of the disk image as it is used.
Using "falloc" option preallocates the full size of the disk,
but does not write zeroes to it, compared to "full" option.
This will make sure that in CI, a device used during test
is never exhaused due to lack of host space.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11243 (master)
(cherry picked from commit 7d97822f17
)
Change-Id: Ie1c30909dc87552a6d6c385d0ad80905ce68ff9d
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11336
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
e73b7f67ab
commit
14c0fe2488
@ -2,6 +2,7 @@
|
||||
SYSTEM=$(uname -s)
|
||||
size="1024M"
|
||||
nvme_disk="/var/lib/libvirt/images/nvme_disk.img"
|
||||
preallocation="falloc"
|
||||
|
||||
function usage() {
|
||||
echo "Usage: ${0##*/} [-s <disk_size>] [-n <backing file name>]"
|
||||
@ -9,9 +10,11 @@ function usage() {
|
||||
echo " for OCSSD default: 9G"
|
||||
echo "-n <backing file name> backing file path with name"
|
||||
echo " default: /var/lib/libvirt/images/nvme_disk.img"
|
||||
echo "-p <mode> allowed values:[off, falloc, full]"
|
||||
echo " default: falloc"
|
||||
}
|
||||
|
||||
while getopts "s:n:t:h-:" opt; do
|
||||
while getopts "s:n:p:t:h-:" opt; do
|
||||
case "${opt}" in
|
||||
-)
|
||||
echo " Invalid argument: $OPTARG"
|
||||
@ -24,6 +27,9 @@ while getopts "s:n:t:h-:" opt; do
|
||||
n)
|
||||
nvme_disk=$OPTARG
|
||||
;;
|
||||
p)
|
||||
preallocation=$OPTARG
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
@ -42,7 +48,7 @@ if [ "${SYSTEM}" != "Linux" ]; then
|
||||
fi
|
||||
|
||||
WHICH_OS=$(lsb_release -i | awk '{print $3}')
|
||||
qemu-img create -f raw "$nvme_disk" $size
|
||||
qemu-img create -f raw "$nvme_disk" -o preallocation="$preallocation" $size
|
||||
|
||||
case $WHICH_OS in
|
||||
"Fedora")
|
||||
|
Loading…
Reference in New Issue
Block a user