From b20e133714cf00f41d29d7125c5137eed24745f7 Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Fri, 12 Apr 2013 17:49:23 +0100 Subject: [PATCH] Grab the next available /dev/nbdX. Change-Id: I6a2c8e58cdab889d747e870d0009f51bba0ff148 --- bin/disk-image-create | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/disk-image-create b/bin/disk-image-create index f45903e1..86ecdf1f 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -98,15 +98,10 @@ eval_run_d block-device-size "DIB_IMAGE_SIZE=" qemu-img create -f qcow2 -o preallocation=metadata $TMP_IMAGE_PATH ${DIB_IMAGE_SIZE}G -# Should have a grab-next-dev helper ? -NBD_DEV=/dev/nbd0 -if [[ $(qemu-nbd --help | grep cache) == *writeback* ]] ; then - CACHE="--cache=writeback" -else - echo "Warning: qemu-nbd without --cache=writeback is /slow/." - CACHE="" -fi -sudo qemu-nbd -c $NBD_DEV $CACHE $TMP_IMAGE_PATH +# grab the next available /dev/nbdX and connect to it +map_nbd $TMP_IMAGE_PATH +echo "NBD Device: $NBD_DEV" + export EXTRA_UNMOUNT="sudo qemu-nbd -d $NBD_DEV" export IMAGE_BLOCK_DEVICE=$NBD_DEV eval_run_d block-device "IMAGE_BLOCK_DEVICE="