Merge "n-api also requires glance for now"
diff --git a/AUTHORS b/AUTHORS
index 820a677..bca25b4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -11,6 +11,7 @@
 Eoghan Glynn <eglynn@redhat.com>
 Gabriel Hurley <gabriel@strikeawe.com>
 Hengqing Hu <hudayou@hotmail.com>
+Hua ZHANG <zhuadl@cn.ibm.com>
 Jake Dahn <admin@jakedahn.com>
 James E. Blair <james.blair@rackspace.com>
 Jason Cannavale <jason.cannavale@rackspace.com>
diff --git a/exercises/quantum.sh b/exercises/quantum.sh
index 943a07d..a6df765 100755
--- a/exercises/quantum.sh
+++ b/exercises/quantum.sh
@@ -103,7 +103,7 @@
 # Various functions.
 #------------------------------------------------------------------------------
 function get_image_id {
-    local IMAGE_ID=`glance -f -A $TOKEN index | egrep $DEFAULT_IMAGE_NAME | head -1 | cut -d" " -f1`
+    local IMAGE_ID=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
     echo "$IMAGE_ID"
 }
 
diff --git a/stack.sh b/stack.sh
index 3dc5026..8a443d1 100755
--- a/stack.sh
+++ b/stack.sh
@@ -205,6 +205,7 @@
 KEYSTONE_DIR=$DEST/keystone
 NOVACLIENT_DIR=$DEST/python-novaclient
 KEYSTONECLIENT_DIR=$DEST/python-keystoneclient
+OPENSTACKCLIENT_DIR=$DEST/python-openstackclient
 NOVNC_DIR=$DEST/noVNC
 SWIFT_DIR=$DEST/swift
 QUANTUM_DIR=$DEST/quantum
@@ -653,6 +654,7 @@
 # python client library to nova that horizon (and others) use
 git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH
 git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
+git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH
 git_clone $GLANCECLIENT_REPO $GLANCECLIENT_DIR $GLANCECLIENT_BRANCH
 
 # glance, swift middleware and nova api needs keystone middleware
@@ -700,6 +702,7 @@
 # allowing ``import nova`` or ``import glance.client``
 cd $KEYSTONECLIENT_DIR; sudo python setup.py develop
 cd $NOVACLIENT_DIR; sudo python setup.py develop
+cd $OPENSTACKCLIENT_DIR; sudo python setup.py develop
 if is_service_enabled key g-api n-api swift; then
     cd $KEYSTONE_DIR; sudo python setup.py develop
 fi
@@ -1535,7 +1538,7 @@
 fi
 if is_service_enabled n-vol; then
     add_nova_opt "volume_group=$VOLUME_GROUP"
-    add_nova_opt "volume_name_template=${VOLUME_NAME_PREFIX}%08x"
+    add_nova_opt "volume_name_template=${VOLUME_NAME_PREFIX}%s"
     # oneiric no longer supports ietadm
     add_nova_opt "iscsi_helper=tgtadm"
 fi
@@ -1732,7 +1735,7 @@
     # launch keystone and wait for it to answer before continuing
     screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
     echo "Waiting for keystone to start..."
-    if ! timeout $SERVICE_TIMEOUT sh -c "while http_proxy= wget -O- $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_API_PORT/v2.0/ 2>&1 | grep -q 'refused'; do sleep 1; done"; then
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -O- $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_API_PORT/v2.0/ 2>&1 | grep -q '200 OK'; do sleep 1; done"; then
       echo "keystone did not start"
       exit 1
     fi
diff --git a/stackrc b/stackrc
index 3ad46cc..092ba9e 100644
--- a/stackrc
+++ b/stackrc
@@ -41,6 +41,10 @@
 NOVACLIENT_REPO=https://github.com/openstack/python-novaclient.git
 NOVACLIENT_BRANCH=master
 
+# Shared openstack python client library
+OPENSTACKCLIENT_REPO=https://github.com/openstack/python-openstackclient.git
+OPENSTACKCLIENT_BRANCH=master
+
 # python keystone client library to nova that horizon uses
 KEYSTONECLIENT_REPO=https://github.com/openstack/python-keystoneclient
 KEYSTONECLIENT_BRANCH=master
diff --git a/tools/configure_tempest.sh b/tools/configure_tempest.sh
index bed3d67..a84c42b 100755
--- a/tools/configure_tempest.sh
+++ b/tools/configure_tempest.sh
@@ -67,11 +67,12 @@
 # We ignore ramdisk and kernel images and set the IMAGE_UUID to
 # the first image returned and set IMAGE_UUID_ALT to the second,
 # if there is more than one returned...
+# ... Also ensure we only take active images, so we don't get snapshots in process
 IMAGE_LINES=`glance image-list`
 IFS="$(echo -e "\n\r")"
 IMAGES=""
 for line in $IMAGE_LINES; do
-    IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | cut -d' ' -f2`"
+    IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`"
 done
 # Create array of image UUIDs...
 IFS=" "
@@ -89,9 +90,8 @@
 fi
 
 # Create tempest.conf from tempest.conf.tpl
-if [[ ! -r $TEMPEST_CONF ]]; then
-    cp $TEMPEST_CONF.tpl $TEMPEST_CONF
-fi
+# copy every time, because the image UUIDS are going to change
+cp $TEMPEST_CONF.tpl $TEMPEST_CONF
 
 IDENTITY_USE_SSL=${IDENTITY_USE_SSL:-False}
 IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}