Merge pull request #94 from cloudbuilders/redo_clone
Redo clone
diff --git a/exercise.sh b/exercise.sh
index 36a6d6f..b73d6aa 100755
--- a/exercise.sh
+++ b/exercise.sh
@@ -91,14 +91,18 @@
# get the IP of the server
IP=`nova show $NAME | grep "private network" | cut -d"|" -f3`
-# ping it once (timeout of a second)
-ping -c1 -w1 $IP || true
+# for single node deployments, we can ping private ips
+MULTI_HOST=${MULTI_HOST:-0}
+if [ "$MULTI_HOST" = "0"]; then
+ # ping it once (timeout of a second)
+ ping -c1 -w1 $IP || true
-# sometimes the first ping fails (10 seconds isn't enough time for the VM's
-# network to respond?), so let's wait 5 seconds and really test ping
-sleep 5
+ # sometimes the first ping fails (10 seconds isn't enough time for the VM's
+ # network to respond?), so let's wait 5 seconds and really test ping
+ sleep 5
-ping -c1 -w1 $IP
+ ping -c1 -w1 $IP
+fi
# Security Groups & Floating IPs
# ------------------------------
@@ -119,7 +123,7 @@
nova add-floating-ip $NAME $FLOATING_IP
# sleep for a smidge
-sleep 1
+sleep 5
# ping our floating ip
ping -c1 -w1 $FLOATING_IP
@@ -128,7 +132,7 @@
nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0
# sleep for a smidge
-sleep 1
+sleep 5
# ping our floating ip
if ( ping -c1 -w1 $FLOATING_IP ); then
diff --git a/files/apts/nova b/files/apts/nova
index eb85e26..594f2da 100644
--- a/files/apts/nova
+++ b/files/apts/nova
@@ -33,3 +33,7 @@
python-lockfile
python-m2crypto
python-boto
+
+# Stuff for diablo volumes
+iscsitarget
+lvm2
diff --git a/stack.sh b/stack.sh
index 6c7dcdf..14bcfb2 100755
--- a/stack.sh
+++ b/stack.sh
@@ -481,11 +481,15 @@
# Nova
# ----
-# We are going to use the sample http middleware configuration from the keystone
-# project to launch nova. This paste config adds the configuration required
-# for nova to validate keystone tokens - except we need to switch the config
-# to use our service token instead (instead of the invalid token 999888777666).
-sudo sed -e "s,999888777666,$SERVICE_TOKEN,g" -i $KEYSTONE_DIR/examples/paste/nova-api-paste.ini
+if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
+ # We are going to use the sample http middleware configuration from the
+ # keystone project to launch nova. This paste config adds the configuration
+ # required for nova to validate keystone tokens - except we need to switch
+ # the config to use our service token instead (instead of the invalid token
+ # 999888777666).
+ cp $KEYSTONE_DIR/examples/paste/nova-api-paste.ini $NOVA_DIR/bin
+ sed -e "s,999888777666,$SERVICE_TOKEN,g" -i $NOVA_DIR/bin/nova-api-paste.ini
+fi
if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
@@ -602,7 +606,7 @@
add_nova_flag "--osapi_extensions_path=$OPENSTACKX_DIR/extensions"
add_nova_flag "--vncproxy_url=http://$HOST_IP:6080"
add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/"
-add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini"
+add_nova_flag "--api_paste_config=$NOVA_DIR/bin/nova-api-paste.ini"
add_nova_flag "--image_service=nova.image.glance.GlanceImageService"
add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST"
add_nova_flag "--rabbit_host=$RABBIT_HOST"
@@ -614,6 +618,7 @@
fi
if [ -n "$MULTI_HOST" ]; then
add_nova_flag "--multi_host=$MULTI_HOST"
+ add_nova_flag "--send_arp_for_ha=1"
fi
# Nova Database
@@ -751,8 +756,8 @@
for image_url in ${IMAGE_URLS//,/ }; do
# Downloads the image (uec ami+aki style), then extracts it.
- IMAGE_FNAME=`echo "$image_url" | python -c "import sys; print sys.stdin.read().split('/')[-1]"`
- IMAGE_NAME=`echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]"`
+ IMAGE_FNAME=`basename "$image_url"`
+ IMAGE_NAME=`basename "$IMAGE_FNAME" .tar.gz`
if [ ! -f $FILES/$IMAGE_FNAME ]; then
wget -c $image_url -O $FILES/$IMAGE_FNAME
fi
diff --git a/stackrc b/stackrc
index c063864..9ba1043 100644
--- a/stackrc
+++ b/stackrc
@@ -1,30 +1,30 @@
# compute service
-NOVA_REPO=git://github.com/cloudbuilders/nova.git
+NOVA_REPO=https://github.com/cloudbuilders/nova.git
NOVA_BRANCH=diablo
# image catalog service
-GLANCE_REPO=git://github.com/cloudbuilders/glance.git
+GLANCE_REPO=https://github.com/cloudbuilders/glance.git
GLANCE_BRANCH=diablo
# unified auth system (manages accounts/tokens)
-KEYSTONE_REPO=git://github.com/cloudbuilders/keystone.git
+KEYSTONE_REPO=https://github.com/cloudbuilders/keystone.git
KEYSTONE_BRANCH=diablo
# a websockets/html5 or flash powered VNC console for vm instances
-NOVNC_REPO=git://github.com/cloudbuilders/noVNC.git
+NOVNC_REPO=https://github.com/cloudbuilders/noVNC.git
NOVNC_BRANCH=diablo
# django powered web control panel for openstack
-DASH_REPO=git://github.com/cloudbuilders/openstack-dashboard.git
+DASH_REPO=https://github.com/cloudbuilders/openstack-dashboard.git
DASH_BRANCH=diablo
# python client library to nova that dashboard (and others) use
-NOVACLIENT_REPO=git://github.com/rackspace/python-novaclient.git
+NOVACLIENT_REPO=https://github.com/rackspace/python-novaclient.git
NOVACLIENT_BRANCH=master
# openstackx is a collection of extensions to openstack.compute & nova
# that is *deprecated*. The code is being moved into python-novaclient & nova.
-OPENSTACKX_REPO=git://github.com/cloudbuilders/openstackx.git
+OPENSTACKX_REPO=https://github.com/cloudbuilders/openstackx.git
OPENSTACKX_BRANCH=diablo
# Specify a comma-separated list of uec images to download and install into glance.
diff --git a/tools/build_kvm.sh b/tools/build_kvm.sh
index dbfb5ce..32c7bf6 100755
--- a/tools/build_kvm.sh
+++ b/tools/build_kvm.sh
@@ -235,15 +235,13 @@
# Create our instance fs
qemu-img create -f qcow2 -b $VM_IMAGE disk
-# 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
-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
+# Connect our nbd and wait till it is mountable
qemu-nbd -c $NBD disk
-
-sleep 5
+NBD_DEV=`basename $NBD`
+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 $NBD $ROOTFS -o offset=32256 -t ext4
@@ -378,6 +376,10 @@
done
kill $TAIL_PID
+
+ if grep -q "stack.sh failed" $VM_DIR/console.log; then
+ exit 1
+ fi
echo ""
echo "Finished - Zip-a-dee Doo-dah!"
fi
diff --git a/tools/get_uec_image.sh b/tools/get_uec_image.sh
new file mode 100755
index 0000000..e9d708d
--- /dev/null
+++ b/tools/get_uec_image.sh
@@ -0,0 +1,159 @@
+#!/bin/bash
+# get_uec_image.sh - Prepare Ubuntu images in various formats
+#
+# Supported formats: qcow (kvm), vmdk (vmserver), vdi (vbox), vhd (vpc), raw
+#
+# Required to run as root
+
+CACHEDIR=${CACHEDIR:-/var/cache/devstack}
+FORMAT=${FORMAT:-qcow2}
+ROOTSIZE=${ROOTSIZE:-2000}
+MIN_PKGS=${MIN_PKGS:-"apt-utils gpgv openssh-server"}
+
+usage() {
+ echo "Usage: $0 - Prepare Ubuntu images"
+ echo ""
+ echo "$0 [-f format] [-r rootsize] release imagefile"
+ echo ""
+ echo "-f format - image format: qcow2 (default), vmdk, vdi, vhd, xen, raw, fs"
+ echo "-r size - root fs size in MB (min 2000MB)"
+ echo "release - Ubuntu release: jaunty - oneric"
+ echo "imagefile - output image file"
+ exit 1
+}
+
+while getopts f:hmr: c; do
+ case $c in
+ f) FORMAT=$OPTARG
+ ;;
+ h) usage
+ ;;
+ m) MINIMAL=1
+ ;;
+ r) ROOTSIZE=$OPTARG
+ if $(( ROOTSIZE < 2000 )); then
+ echo "root size must be greater than 2000MB"
+ exit 1
+ fi
+ ;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+if [ ! "$#" -eq "2" ]; then
+ usage
+fi
+
+# Default args
+DIST_NAME=$1
+IMG_FILE=$2
+
+case $FORMAT in
+ kvm|qcow2) FORMAT=qcow2
+ QFORMAT=qcow2
+ ;;
+ vmserver|vmdk)
+ FORMAT=vmdk
+ QFORMAT=vmdk
+ ;;
+ vbox|vdi) FORMAT=vdi
+ QFORMAT=vdi
+ ;;
+ vhd|vpc) FORMAT=vhd
+ QFORMAT=vpc
+ ;;
+ xen) FORMAT=raw
+ QFORMAT=raw
+ ;;
+ raw) FORMAT=raw
+ QFORMAT=raw
+ ;;
+ *) echo "Unknown format: $FORMAT"
+ usage
+esac
+
+case $DIST_NAME in
+ oneiric) ;;
+ natty) ;;
+ maverick) ;;
+ lucid) ;;
+ karmic) ;;
+ jaunty) ;;
+ *) echo "Unknown release: $DIST_NAME"
+ usage
+ ;;
+esac
+
+# Set up nbd
+modprobe nbd max_part=63
+NBD=${NBD:-/dev/nbd9}
+NBD_DEV=`basename $NBD`
+
+# Prepare the base image
+
+# Get the UEC image
+UEC_NAME=$DIST_NAME-server-cloudimg-amd64
+if [ ! -e $CACHEDIR/$UEC_NAME-disk1.img ]; then
+ (cd $CACHEDIR; wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME-disk1.img)
+
+
+ # Connect to nbd and wait till it is ready
+ qemu-nbd -d $NBD
+ qemu-nbd -c $NBD $CACHEDIR/$UEC_NAME-disk1.img
+ 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
+ MNTDIR=`mktemp -d mntXXXXXXXX`
+ mount -t ext4 ${NBD}p1 $MNTDIR
+
+ # Install our required packages
+ cp -p files/sources.list $MNTDIR/etc/apt/sources.list
+ cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf
+ chroot $MNTDIR apt-get update
+ chroot $MNTDIR apt-get install -y $MIN_PKGS
+ rm -f $MNTDIR/etc/resolv.conf
+
+ umount $MNTDIR
+ rmdir $MNTDIR
+ qemu-nbd -d $NBD
+fi
+
+if [ "$FORMAT" = "qcow2" ]; then
+ # Just copy image
+ cp -p $CACHEDIR/$UEC_NAME-disk1.img $IMG_FILE
+else
+ # Convert image
+ qemu-img convert -O $QFORMAT $CACHEDIR/$UEC_NAME-disk1.img $IMG_FILE
+fi
+
+# Resize the image if necessary
+if [ $ROOTSIZE -gt 2000 ]; then
+ # Resize the container
+ qemu-img resize $IMG_FILE +$((ROOTSIZE - 2000))M
+
+ # Connect to nbd and wait till it is ready
+ qemu-nbd -c $NBD $IMG_FILE
+ 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
+
+ # Resize partition 1 to full size of the disk image
+ echo "d
+n
+p
+1
+2
+
+t
+83
+a
+1
+w
+" | fdisk $NBD
+ fsck -t ext4 -f ${NBD}p1
+ resize2fs ${NBD}p1
+
+ qemu-nbd -d $NBD
+fi
diff --git a/tools/make_image.sh b/tools/make_image.sh
index d81cef5..e957c75 100755
--- a/tools/make_image.sh
+++ b/tools/make_image.sh
@@ -65,6 +65,13 @@
RELEASE="pass"
fi
+# Make sure that we have the proper version of ubuntu
+UBUNTU_VERSION=`cat /etc/lsb-release | grep CODENAME | sed 's/.*=//g'`
+if [ "$UBUNTU_VERSION" = "natty" -a "$RELEASE" = "oneiric" ]; then
+ echo "natty installs can't build oneiric images"
+ exit 1
+fi
+
case $FORMAT in
kvm|qcow2) FORMAT=qcow2
QFORMAT=qcow2