parameterize nbd dev

This commit is contained in:
Anthony Young 2011-10-19 20:22:32 -07:00
parent d51812d444
commit 9c0fdd7ded

View file

@ -52,7 +52,6 @@ BASE_IMAGE_COPY=$IMAGES_DIR/$DIST_NAME.raw.copy
VM_NAME=${VM_NAME:-kvmstack} VM_NAME=${VM_NAME:-kvmstack}
# Mop up after previous runs # Mop up after previous runs
virsh shutdown $VM_NAME
virsh destroy $VM_NAME virsh destroy $VM_NAME
# Where this vm is stored # Where this vm is stored
@ -222,13 +221,16 @@ mkdir -p $ROOTFS
# Make sure we have nbd-ness # Make sure we have nbd-ness
modprobe nbd max_part=63 modprobe nbd max_part=63
# Which NBD device to use?
NBD=${NBD:-/dev/nbd5}
# Clean up from previous runs # Clean up from previous runs
umount $ROOTFS || echo 'ok' umount $ROOTFS || echo 'ok'
qemu-nbd -d /dev/nbd5 || echo 'ok' qemu-nbd -d $NBD || echo 'ok'
# Mount the instance # Mount the instance
qemu-nbd -c /dev/nbd5 disk qemu-nbd -c $NBD disk
mount /dev/nbd5 $ROOTFS -o offset=32256 -t ext4 mount $NBD $ROOTFS -o offset=32256 -t ext4
# Configure instance network # Configure instance network
INTERFACES=$ROOTFS/etc/network/interfaces INTERFACES=$ROOTFS/etc/network/interfaces
@ -304,7 +306,6 @@ su -c "$DEST/run.sh" stack
EOF EOF
chmod +x $RC_LOCAL chmod +x $RC_LOCAL
chroot $ROOTFS sudo update-rc.d local defaults 80 chroot $ROOTFS sudo update-rc.d local defaults 80
#chroot $ROOTFS update-rc.d local start 80 2 . stop 80 0 1 6
# Make our ip address hostnames look nice at the command prompt # Make our ip address hostnames look nice at the command prompt
echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/$DEST/.bashrc echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/$DEST/.bashrc
@ -320,7 +321,7 @@ sudo sed -e "s/^hiddenmenu//g" -i $ROOTFS/boot/grub/menu.lst
# Unmount # Unmount
umount $ROOTFS || echo 'ok' umount $ROOTFS || echo 'ok'
qemu-nbd -d /dev/nbd5 qemu-nbd -d $NBD
# Create the instance # Create the instance
cd $VM_DIR && virsh create libvirt.xml cd $VM_DIR && virsh create libvirt.xml