Merge "Default values for live migration tempest tests"
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 1c6320c..ffa12c4 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -158,8 +158,6 @@
 start_time=`date +%s`
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then
     echo "Volume $VOL_NAME not created"
-    end_time=`date +%s`
-    echo "Failed volume-create after $((end_time - start_time)) seconds"
     exit 1
 fi
 end_time=`date +%s`
@@ -176,8 +174,6 @@
     die "Failure attaching volume $VOL_NAME to $NAME"
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then
     echo "Volume $VOL_NAME not attached to $NAME"
-    end_time=`date +%s`
-    echo "Failed volume-attach after $((end_time - start_time)) seconds"
     exit 1
 fi
 end_time=`date +%s`
@@ -195,8 +191,6 @@
 nova volume-detach $VM_UUID $VOL_ID || die "Failure detaching volume $VOL_NAME from $NAME"
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then
     echo "Volume $VOL_NAME not detached from $NAME"
-    end_time=`date +%s`
-    echo "Failed volume-detach after $((end_time - start_time)) seconds"
     exit 1
 fi
 end_time=`date +%s`
@@ -207,8 +201,6 @@
 nova volume-delete $VOL_ID || die "Failure deleting volume $VOL_NAME"
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME; do sleep 1; done"; then
     echo "Volume $VOL_NAME not deleted"
-    end_time=`date +%s`
-    echo "Failed volume-delete after $((end_time - start_time)) seconds"
     exit 1
 fi
 end_time=`date +%s`
diff --git a/files/apts/quantum b/files/apts/quantum
index 568438f..ed3887b 100644
--- a/files/apts/quantum
+++ b/files/apts/quantum
@@ -1,5 +1,5 @@
 iptables
-mysql #NOPRIME
+mysql-server #NOPRIME
 sudo
 python-paste
 python-routes
diff --git a/files/horizon_settings.py b/files/horizon_settings.py
index d18fd1a..ce92e2c 100644
--- a/files/horizon_settings.py
+++ b/files/horizon_settings.py
@@ -1,10 +1,28 @@
 import os
 
+from django.utils.translation import ugettext_lazy as _
+
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 PROD = False
 USE_SSL = False
 
+# Set SSL proxy settings:
+# For Django 1.4+ pass this header from the proxy after terminating the SSL,
+# and don't forget to strip it from the client's request.
+# For more information see:
+# https://docs.djangoproject.com/en/1.4/ref/settings/#secure-proxy-ssl-header
+# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
+
+# Specify a regular expression to validate user passwords.
+# HORIZON_CONFIG = {
+#     "password_validator": {
+#         "regex": '.*',
+#         "help_text": _("Your password does not meet the requirements.")
+#     },
+#    'help_url': "http://docs.openstack.org"
+# }
+
 LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
 
 # FIXME: We need to change this to mysql, instead of sqlite.
@@ -16,14 +34,24 @@
     },
 }
 
-# The default values for these two settings seem to cause issues with apache
-CACHE_BACKEND = 'dummy://'
-SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
-
-# Set a secure and unique SECRET_KEY (the Django default is '')
+# Set custom secret key:
+# You can either set it to a specific value or you can let horizion generate a
+# default secret key that is unique on this machine, e.i. regardless of the
+# amount of Python WSGI workers (if used behind Apache+mod_wsgi): However, there
+# may be situations where you would want to set this explicitly, e.g. when
+# multiple dashboard instances are distributed on different machines (usually
+# behind a load-balancer). Either you have to make sure that a session gets all
+# requests routed to the same dashboard instance or you set the same SECRET_KEY
+# for all of them.
 from horizon.utils import secret_key
 SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store'))
 
+# We recommend you use memcached for development; otherwise after every reload
+# of the django development server, you will have to login again. To use
+# memcached set CACHE_BACKED to something like 'memcached://127.0.0.1:11211/'
+CACHE_BACKEND = 'dummy://'
+SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
+
 # Send email to the console by default
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 # Or send them to /dev/null
@@ -38,31 +66,55 @@
 # EMAIL_HOST_USER = 'djangomail'
 # EMAIL_HOST_PASSWORD = 'top-secret!'
 
+# For multiple regions uncomment this configuration, and add (endpoint, title).
+# AVAILABLE_REGIONS = [
+#     ('http://cluster1.example.com:5000/v2.0', 'cluster1'),
+#     ('http://cluster2.example.com:5000/v2.0', 'cluster2'),
+# ]
+
+OPENSTACK_HOST = "127.0.0.1"
+OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST
+OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"
+
+# Disable SSL certificate checks (useful for self-signed certificates):
+# OPENSTACK_SSL_NO_VERIFY = True
+
 HORIZON_CONFIG = {
-    'dashboards': ('nova', 'syspanel', 'settings',),
-    'default_dashboard': 'nova',
+    'dashboards': ('project', 'admin', 'settings',),
+    'default_dashboard': 'project',
 }
 
+# The OPENSTACK_KEYSTONE_BACKEND settings can be used to identify the
+# capabilities of the auth backend for Keystone.
+# If Keystone has been configured to use LDAP as the auth backend then set
+# can_edit_user to False and name to 'ldap'.
+#
 # TODO(tres): Remove these once Keystone has an API to identify auth backend.
 OPENSTACK_KEYSTONE_BACKEND = {
     'name': 'native',
     'can_edit_user': True
 }
 
-OPENSTACK_HOST = "127.0.0.1"
-OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST
-# FIXME: this is only needed until keystone fixes its GET /tenants call
-# so that it doesn't return everything for admins
-OPENSTACK_KEYSTONE_ADMIN_URL = "http://%s:35357/v2.0" % OPENSTACK_HOST
-OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"
+OPENSTACK_HYPERVISOR_FEATURES = {
+    'can_set_mount_point': True
+}
+
+# OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints
+# in the Keystone service catalog. Use this setting when Horizon is running
+# external to the OpenStack environment. The default is 'internalURL'.
+#OPENSTACK_ENDPOINT_TYPE = "publicURL"
+
+# The number of objects (Swift containers/objects or images) to display
+# on a single page before providing a paging element (a "more" link)
+# to paginate results.
+API_RESULT_LIMIT = 1000
+API_RESULT_PAGE_SIZE = 20
 
 SWIFT_PAGINATE_LIMIT = 100
 
-# If you have external monitoring links, eg:
-# EXTERNAL_MONITORING = [
-#     ['Nagios','http://foo.com'],
-#     ['Ganglia','http://bar.com'],
-# ]
+# The timezone of the server. This should correspond with the timezone
+# of your entire OpenStack installation, and hopefully be in UTC.
+TIME_ZONE = "UTC"
 
 #LOGGING = {
 #        'version': 1,
@@ -93,6 +145,10 @@
 #                'handlers': ['console'],
 #                'propagate': False,
 #            },
+#            'openstack_dashboard': {
+#                'handlers': ['console'],
+#                'propagate': False,
+#            },
 #            'novaclient': {
 #                'handlers': ['console'],
 #                'propagate': False,
@@ -101,6 +157,10 @@
 #                'handlers': ['console'],
 #                'propagate': False,
 #            },
+#            'glanceclient': {
+#                'handlers': ['console'],
+#                'propagate': False,
+#            },
 #            'nose.plugins.manager': {
 #                'handlers': ['console'],
 #                'propagate': False,
diff --git a/lib/tempest b/lib/tempest
new file mode 100644
index 0000000..115c911
--- /dev/null
+++ b/lib/tempest
@@ -0,0 +1,56 @@
+# lib/tempest
+
+# Dependencies:
+# ``functions`` file
+# ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
+# <list other global vars that are assumed to be defined>
+
+# ``stack.sh`` calls the entry points in this order:
+#
+# install_XXXX
+# configure_XXXX
+# init_XXXX
+# start_XXXX
+# stop_XXXX
+# cleanup_XXXX
+
+# Save trace setting
+XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# <define global variables here that belong to this project>
+
+# Set up default directories
+TEMPEST_DIR=$DEST/tempest
+TEMPEST_CONF_DIR=$DEST/tempest/etc
+
+# Entry Points
+# ------------
+
+
+# configure_tempest() - Set config files, create data dirs, etc
+function configure_tempest() {
+    # sudo python setup.py deploy
+    # iniset $tempest_CONF ...
+    # This function intentionally left blank
+    #
+    # TODO(sdague) actually move the guts of configure tempest
+    # into this function
+    cd tools
+    ./configure_tempest.sh
+    cd ..
+}
+
+
+# install_tempest() - Collect source and prepare
+function install_tempest() {
+    git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
+}
+
+
+# Restore xtrace
+$XTRACE
diff --git a/stack.sh b/stack.sh
index 118c2ef..957bbd6 100755
--- a/stack.sh
+++ b/stack.sh
@@ -313,6 +313,7 @@
 source $TOP_DIR/lib/ceilometer
 source $TOP_DIR/lib/heat
 source $TOP_DIR/lib/quantum
+source $TOP_DIR/lib/tempest
 
 # Set the destination directories for OpenStack projects
 HORIZON_DIR=$DEST/horizon
@@ -871,6 +872,9 @@
 if is_service_enabled ceilometer; then
     install_ceilometer
 fi
+if is_service_enabled tempest; then
+    install_tempest
+fi
 
 
 # Initialization
@@ -917,6 +921,9 @@
 if is_service_enabled cinder; then
     configure_cinder
 fi
+if is_service_enabled tempest; then
+    configure_tempest
+fi
 
 if [[ $TRACK_DEPENDS = True ]] ; then
     $DEST/.venv/bin/pip freeze > $DEST/requires-post-pip