Fix issue #98 - wait till nbd is connected using method in nova's disk.py

This commit is contained in:
Anthony Young 2011-10-24 23:20:12 -07:00
parent 8ecd2948ad
commit 6856536144

View file

@ -235,15 +235,13 @@ rm -f $VM_DIR/disk
# Create our instance fs # Create our instance fs
qemu-img create -f qcow2 -b $VM_IMAGE disk qemu-img create -f qcow2 -b $VM_IMAGE disk
# FIXME: we are sleeping because these qemu commands appear to not complete # Connect our nbd and wait till it is mountable
# before they return... We should apply fix that is done in nova's disk.py
sleep 5
# FIXME: we are sleeping because these qemu commands appear to not complete
# before they return... We should apply fix that is done in nova's disk.py
qemu-nbd -c $NBD disk qemu-nbd -c $NBD disk
NBD_DEV=`basename $NBD`
sleep 5 if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then
echo "Couldn't connect $NBD"
exit 1
fi
# Mount the instance # Mount the instance
mount $NBD $ROOTFS -o offset=32256 -t ext4 mount $NBD $ROOTFS -o offset=32256 -t ext4