Merge "Adds LinuxBridge plugin setup support."
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/files/pips/general b/files/pips/general
new file mode 100644
index 0000000..f740306
--- /dev/null
+++ b/files/pips/general
@@ -0,0 +1 @@
+prettytable==0.5
diff --git a/stack.sh b/stack.sh
index 526e234..66c8e93 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
@@ -586,7 +587,16 @@
         if [[ -e ${package_dir}/${service} ]]; then
             file_to_parse="${file_to_parse} $service"
         fi
-        if [[ $service == n-* ]]; then
+        # NOTE(sdague) n-api needs glance for now because that's where
+        # glance client is
+        if [[ $service == n-api ]]; then
+            if [[ ! $file_to_parse =~ nova ]]; then
+                file_to_parse="${file_to_parse} nova"
+            fi
+            if [[ ! $file_to_parse =~ glance ]]; then
+                file_to_parse="${file_to_parse} glance"
+            fi
+        elif [[ $service == n-* ]]; then
             if [[ ! $file_to_parse =~ nova ]]; then
                 file_to_parse="${file_to_parse} nova"
             fi
@@ -644,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
@@ -691,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
@@ -986,6 +998,9 @@
     iniset $GLANCE_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
     iniset $GLANCE_API_PASTE_INI filter:authtoken admin_user glance
     iniset $GLANCE_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
+
+    GLANCE_POLICY_JSON=$GLANCE_CONF_DIR/policy.json
+    cp $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
 fi
 
 # Quantum
@@ -1571,7 +1586,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
@@ -1768,7 +1783,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}