Merge "Adds support for multi-region"
diff --git a/files/apts/general b/files/apts/general
index d81ec7a..90529e5 100644
--- a/files/apts/general
+++ b/files/apts/general
@@ -22,3 +22,4 @@
 python-dev
 python2.7
 bc
+libyaml-dev
diff --git a/files/rpms/general b/files/rpms/general
index c940de6..a0074dd 100644
--- a/files/rpms/general
+++ b/files/rpms/general
@@ -23,6 +23,7 @@
 wget
 which
 bc
+libyaml-devel
 
 # [1] : some of installed tools have unversioned dependencies on this,
 # but others have versioned (<=0.7).  So if a later version (0.7.1)
diff --git a/lib/ceilometer b/lib/ceilometer
index c90b8cb..1540e3e 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -53,6 +53,9 @@
 CEILOMETER_SERVICE_HOST=$SERVICE_HOST
 CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777}
 
+# To enable OSprofiler change value of this variable to "notifications,profiler"
+CEILOMETER_NOTIFICATION_TOPICS=${CEILOMETER_NOTIFICATION_TOPICS:-notifications}
+
 # Tell Tempest this project is present
 TEMPEST_SERVICES+=,ceilometer
 
@@ -128,7 +131,7 @@
 
     iniset_rpc_backend ceilometer $CEILOMETER_CONF DEFAULT
 
-    iniset $CEILOMETER_CONF DEFAULT notification_topics 'notifications'
+    iniset $CEILOMETER_CONF DEFAULT notification_topics "$CEILOMETER_NOTIFICATION_TOPICS"
     iniset $CEILOMETER_CONF DEFAULT verbose True
     iniset $CEILOMETER_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
 
@@ -150,7 +153,6 @@
     iniset $CEILOMETER_CONF service_credentials os_username ceilometer
     iniset $CEILOMETER_CONF service_credentials os_password $SERVICE_PASSWORD
     iniset $CEILOMETER_CONF service_credentials os_tenant_name $SERVICE_TENANT_NAME
-    iniset $CEILOMETER_CONF service_credentials os_auth_url $OS_AUTH_URL
 
     iniset $CEILOMETER_CONF keystone_authtoken identity_uri $KEYSTONE_AUTH_URI
     iniset $CEILOMETER_CONF keystone_authtoken admin_user ceilometer
diff --git a/lib/keystone b/lib/keystone
index e6f69fa..06cd7eb 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -39,6 +39,7 @@
 KEYSTONE_AUTH_CACHE_DIR=${KEYSTONE_AUTH_CACHE_DIR:-/var/cache/keystone}
 KEYSTONE_WSGI_DIR=${KEYSTONE_WSGI_DIR:-/var/www/keystone}
 
+KEYSTONEMIDDLEWARE_DIR=$DEST/keystonemiddleware
 KEYSTONECLIENT_DIR=$DEST/python-keystoneclient
 
 # Set up additional extensions, such as oauth1, federation
@@ -416,6 +417,12 @@
     sudo install -D -m 0644 -o $STACK_USER {$KEYSTONECLIENT_DIR/tools/,/etc/bash_completion.d/}keystone.bash_completion
 }
 
+# install_keystonemiddleware() - Collect source and prepare
+function install_keystonemiddleware {
+    git_clone $KEYSTONEMIDDLEWARE_REPO $KEYSTONEMIDDLEWARE_DIR $KEYSTONEMIDDLEWARE_BRANCH
+    setup_install $KEYSTONEMIDDLEWARE_DIR
+}
+
 # install_keystone() - Collect source and prepare
 function install_keystone {
     # only install ldap if the service has been enabled
diff --git a/lib/oslo b/lib/oslo
index a0a1f8f..421fbce 100644
--- a/lib/oslo
+++ b/lib/oslo
@@ -23,6 +23,7 @@
 CLIFF_DIR=$DEST/cliff
 OSLOCFG_DIR=$DEST/oslo.config
 OSLODB_DIR=$DEST/oslo.db
+OSLOI18N_DIR=$DEST/oslo.i18n
 OSLOMSG_DIR=$DEST/oslo.messaging
 OSLORWRAP_DIR=$DEST/oslo.rootwrap
 OSLOVMWARE_DIR=$DEST/oslo.vmware
@@ -45,6 +46,9 @@
     git_clone $CLIFF_REPO $CLIFF_DIR $CLIFF_BRANCH
     setup_install $CLIFF_DIR
 
+    git_clone $OSLOI18N_REPO $OSLOI18N_DIR $OSLOI18N_BRANCH
+    setup_install $OSLOI18N_DIR
+
     git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH
     setup_install $OSLOCFG_DIR
 
diff --git a/lib/swift b/lib/swift
index 5e0f1a7..cf1c052 100644
--- a/lib/swift
+++ b/lib/swift
@@ -354,7 +354,12 @@
     if is_service_enabled swift3;then
         swift_pipeline+=" swift3 s3token "
     fi
-    swift_pipeline+=" authtoken keystoneauth tempauth "
+
+    if is_service_enabled key;then
+        swift_pipeline+=" authtoken keystoneauth"
+    fi
+    swift_pipeline+=" tempauth "
+
     sed -i "/^pipeline/ { s/tempauth/${swift_pipeline} ${SWIFT_EXTRAS_MIDDLEWARE}/ ;}" ${SWIFT_CONFIG_PROXY_SERVER}
     sed -i "/^pipeline/ { s/proxy-server/${SWIFT_EXTRAS_MIDDLEWARE_LAST} proxy-server/ ; }" ${SWIFT_CONFIG_PROXY_SERVER}
 
diff --git a/lib/trove b/lib/trove
index 7824f27..2552745 100644
--- a/lib/trove
+++ b/lib/trove
@@ -36,7 +36,6 @@
 TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
 TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.5"}
 TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.5"}
-TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
 
 # Support entry points installation of console scripts
 if [[ -d $TROVE_DIR/bin ]]; then
diff --git a/stack.sh b/stack.sh
index 2011b77..f3d8d44 100755
--- a/stack.sh
+++ b/stack.sh
@@ -722,6 +722,9 @@
     install_heatclient
 fi
 
+# Install middleware
+install_keystonemiddleware
+
 git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH
 setup_develop $OPENSTACKCLIENT_DIR
 
diff --git a/stackrc b/stackrc
index 1433265..0daac38 100644
--- a/stackrc
+++ b/stackrc
@@ -38,17 +38,19 @@
 #  # Optional, to enable tempest configuration as part of devstack
 #  enable_service tempest
 
-# core compute (glance / keystone / nova (+ nova-network))
-ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-novnc,n-xvnc,n-cauth
-# cinder
-ENABLED_SERVICES+=,c-sch,c-api,c-vol
-# heat
-ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
-# dashboard
-ENABLED_SERVICES+=,horizon
-# additional services
-ENABLED_SERVICES+=,rabbit,tempest,mysql
-
+# this allows us to pass ENABLED_SERVICES
+if [[ -z "$ENABLED_SERVICES" ]]; then
+    # core compute (glance / keystone / nova (+ nova-network))
+    ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-novnc,n-xvnc,n-cauth
+    # cinder
+    ENABLED_SERVICES+=,c-sch,c-api,c-vol
+    # heat
+    ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
+    # dashboard
+    ENABLED_SERVICES+=,horizon
+    # additional services
+    ENABLED_SERVICES+=,rabbit,tempest,mysql
+fi
 
 # Tell Tempest which services are available.  The default is set here as
 # Tempest falls late in the configuration sequence.  This differs from
@@ -156,6 +158,10 @@
 KEYSTONECLIENT_REPO=${KEYSTONECLIENT_REPO:-${GIT_BASE}/openstack/python-keystoneclient.git}
 KEYSTONECLIENT_BRANCH=${KEYSTONECLIENT_BRANCH:-master}
 
+# keystone middleware
+KEYSTONEMIDDLEWARE_REPO=${KEYSTONEMIDDLEWARE_REPO:-${GIT_BASE}/openstack/keystonemiddleware.git}
+KEYSTONEMIDDLEWARE_BRANCH=${KEYSTONEMIDDLEWARE_BRANCH:-master}
+
 # compute service
 NOVA_REPO=${NOVA_REPO:-${GIT_BASE}/openstack/nova.git}
 NOVA_BRANCH=${NOVA_BRANCH:-master}
@@ -180,6 +186,10 @@
 OSLODB_REPO=${OSLODB_REPO:-${GIT_BASE}/openstack/oslo.db.git}
 OSLODB_BRANCH=${OSLODB_BRANCH:-master}
 
+# oslo.i18n
+OSLOI18N_REPO=${OSLOI18N_REPO:-${GIT_BASE}/openstack/oslo.i18n.git}
+OSLOI18N_BRANCH=${OSLOI18N_BRANCH:-master}
+
 # oslo.messaging
 OSLOMSG_REPO=${OSLOMSG_REPO:-${GIT_BASE}/openstack/oslo.messaging.git}
 OSLOMSG_BRANCH=${OSLOMSG_BRANCH:-master}
@@ -357,19 +367,35 @@
 if [[ "$ENABLED_SERVICES" =~ 'h-api' ]]; then
     case "$VIRT_DRIVER" in
         libvirt|baremetal|ironic)
-            HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2"}
+            HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"}
             IMAGE_URLS+=",$HEAT_CFN_IMAGE_URL"
             ;;
         *)
             ;;
     esac
 fi
+
+# Trove needs a custom image for it's work
+if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
+    case "$VIRT_DRIVER" in
+        libvirt|baremetal|ironic)
+            TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
+            IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
+            ;;
+        *)
+            ;;
+    esac
+fi
+
 # Staging Area for New Images, have them here for at least 24hrs for nodepool
 # to cache them otherwise the failure rates in the gate are too high
 PRECACHE_IMAGES=$(trueorfalse False $PRECACHE_IMAGES)
 if [[ "$PRECACHE_IMAGES" == "True" ]]; then
     # staging in update for nodepool
-    IMAGE_URLS+=",http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
+    IMAGE_URL="http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
+    if ! [[ "$IMAGE_URLS"  =~ "$IMAGE_URL" ]]; then
+        IMAGE_URLS+=",$IMAGE_URL"
+    fi
 fi
 
 # 10Gb default volume backing file size
diff --git a/tools/image_list.sh b/tools/image_list.sh
index f9a4e2f..0bb49ab 100755
--- a/tools/image_list.sh
+++ b/tools/image_list.sh
@@ -10,7 +10,7 @@
 DRIVERS="openvz ironic libvirt vsphere xenserver dummy"
 
 # Extra variables to trigger getting additional images.
-ENABLED_SERVICES=h-api
+export ENABLED_SERVICES="h-api,tr-api"
 HEAT_FETCHED_TEST_IMAGE="Fedora-i386-20-20131211.1-sda"
 PRECACHE_IMAGES=True