Cleanups for NBD and GRUB2
diff --git a/tools/build_libvirt.sh b/tools/build_libvirt.sh
index a7ed411..3eb2ff8 100755
--- a/tools/build_libvirt.sh
+++ b/tools/build_libvirt.sh
@@ -243,8 +243,7 @@
 modprobe nbd max_part=63
 
 # Set up nbd
-modprobe nbd max_part=63
-for i in `seq 1 15`; do
+for i in `seq 0 15`; do
     if [ ! -e /sys/block/nbd$i/pid ]; then
         NBD=/dev/nbd$i
         # Connect to nbd and wait till it is ready
@@ -353,9 +352,6 @@
 # Give stack ownership over $DEST so it may do the work needed
 chroot $ROOTFS chown -R stack $DEST
 
-# GRUB 2 wants to see /dev
-mount -o bind /dev $ROOTFS/dev
-
 # Set the hostname
 echo $GUEST_NAME > $ROOTFS/etc/hostname
 
@@ -364,6 +360,9 @@
     echo "$GUEST_IP $GUEST_NAME" >> $ROOTFS/etc/hosts
 fi
 
+# GRUB 2 wants to see /dev
+mount -o bind /dev $ROOTFS/dev
+
 # Change boot params so that we get a console log
 G_DEV_UUID=`blkid -t LABEL=cloudimg-rootfs -s UUID -o value | head -1`
 sed -e "s/GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=3/" -i $ROOTFS/etc/default/grub