Merge "Enable debug logging on tempest"
diff --git a/README.md b/README.md
index 8ae4231..6426e9a 100644
--- a/README.md
+++ b/README.md
@@ -181,6 +181,23 @@
     Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS   VLAN TypeDriver options. Defaults to none.
     Q_AGENT_EXTRA_AGENT_OPTS         Extra configuration options to pass to the OVS or LinuxBridge Agent.
 
+# Heat
+
+Heat is disabled by default. To enable it you'll need the following settings
+in your `localrc` :
+
+    enable_service heat h-api h-api-cfn h-api-cw h-eng
+
+Heat can also run in standalone mode, and be configured to orchestrate
+on an external OpenStack cloud. To launch only Heat in standalone mode
+you'll need the following settings in your `localrc` :
+
+    disable_all_services
+    enable_service rabbit mysql heat h-api h-api-cfn h-api-cw h-eng
+    HEAT_STANDALONE=True
+    KEYSTONE_SERVICE_HOST=...
+    KEYSTONE_AUTH_HOST=...
+
 # Tempest
 
 If tempest has been successfully configured, a basic set of smoke tests can be run as follows:
diff --git a/clean.sh b/clean.sh
index 493c449..f7d15df 100755
--- a/clean.sh
+++ b/clean.sh
@@ -56,6 +56,7 @@
 fi
 
 # Clean projects
+cleanup_oslo
 cleanup_cinder
 cleanup_glance
 cleanup_keystone
diff --git a/lib/cinder b/lib/cinder
index 3472dcd..14950c7 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -234,6 +234,10 @@
     iniset $CINDER_CONF DEFAULT state_path $CINDER_STATE_PATH
     iniset $CINDER_CONF DEFAULT periodic_interval $CINDER_PERIODIC_INTERVAL
 
+    if is_service_enabled ceilometer; then
+        iniset $CINDER_CONF DEFAULT notification_driver "cinder.openstack.common.notifier.rpc_notifier"
+    fi
+
     if is_service_enabled tls-proxy; then
         # Set the service port for a proxy to take the original
         iniset $CINDER_CONF DEFAULT osapi_volume_listen_port $CINDER_SERVICE_PORT_INT
diff --git a/lib/heat b/lib/heat
index 8517773..1b715f2 100644
--- a/lib/heat
+++ b/lib/heat
@@ -30,7 +30,7 @@
 HEAT_DIR=$DEST/heat
 HEATCLIENT_DIR=$DEST/python-heatclient
 HEAT_AUTH_CACHE_DIR=${HEAT_AUTH_CACHE_DIR:-/var/cache/heat}
-
+HEAT_STANDALONE=`trueorfalse False $HEAT_STANDALONE`
 
 # Functions
 # ---------
@@ -83,6 +83,7 @@
     iniset $HEAT_API_CFN_CONF keystone_authtoken signing_dir $HEAT_AUTH_CACHE_DIR/api-cfn
     iniset $HEAT_API_CFN_CONF ec2authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0
     iniset $HEAT_API_CFN_CONF ec2authtoken keystone_ec2_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/ec2tokens
+    [[ "$HEAT_STANDALONE" = "True" ]] && iniset $HEAT_API_CFN_CONF paste_deploy flavor standalone
 
     iniset_rpc_backend heat $HEAT_API_CFN_CONF DEFAULT
 
@@ -104,7 +105,7 @@
     iniset $HEAT_API_CONF keystone_authtoken signing_dir $HEAT_AUTH_CACHE_DIR/api
     iniset $HEAT_API_CONF ec2authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0
     iniset $HEAT_API_CONF ec2authtoken keystone_ec2_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/ec2tokens
-
+    [[ "$HEAT_STANDALONE" = "True" ]] && iniset $HEAT_API_CONF paste_deploy flavor standalone
     iniset_rpc_backend heat $HEAT_API_CONF DEFAULT
 
 
@@ -142,6 +143,7 @@
     iniset $HEAT_API_CW_CONF keystone_authtoken signing_dir $HEAT_AUTH_CACHE_DIR/api-cloudwatch
     iniset $HEAT_API_CW_CONF ec2authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0
     iniset $HEAT_API_CW_CONF ec2authtoken keystone_ec2_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/ec2tokens
+    [[ "$HEAT_STANDALONE" = "True" ]] && iniset $HEAT_API_CW_CONF paste_deploy flavor standalone
 
     iniset_rpc_backend heat $HEAT_API_CW_CONF DEFAULT
 
diff --git a/lib/neutron b/lib/neutron
index c546f37..306140a 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -525,7 +525,6 @@
     # be cleaned.
     iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND"
 
-    _neutron_setup_keystone $NEUTRON_TEST_CONFIG_FILE DEFAULT set_auth_url
     _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE
 
     neutron_plugin_configure_debug_command
@@ -542,7 +541,6 @@
     iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
     iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
 
-    _neutron_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url
     _neutron_setup_interface_driver $Q_DHCP_CONF_FILE
 
     neutron_plugin_configure_dhcp_agent
@@ -563,7 +561,6 @@
     iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
     iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
 
-    _neutron_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url
     _neutron_setup_interface_driver $Q_L3_CONF_FILE
 
     neutron_plugin_configure_l3_agent
@@ -580,7 +577,6 @@
     iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
     iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
 
-    _neutron_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url
 }
 
 function _configure_neutron_lbaas() {
diff --git a/lib/oslo b/lib/oslo
index 1eb13db..de5ec4e 100644
--- a/lib/oslo
+++ b/lib/oslo
@@ -27,6 +27,10 @@
 
 # install_oslo() - Collect source and prepare
 function install_oslo() {
+    # TODO(sdague): remove this once we get to Icehouse, this just makes
+    # for a smoother transition of existing users.
+    cleanup_oslo
+
     git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH
     setup_develop $OSLOCFG_DIR
 
@@ -34,6 +38,17 @@
     setup_develop $OSLOMSG_DIR
 }
 
+# cleanup_oslo() - purge possibly old versions of oslo
+function cleanup_oslo() {
+    # this means we've got an old olso installed, lets get rid of it
+    if find /usr | grep oslo.config | grep -v oslo.config.egg-link > /dev/null; then
+        echo "Found old oslo.config... removing to ensure consistency"
+        local PIP_CMD=$(get_pip_command)
+        pip_install olso.config
+        sudo $PIP_CMD uninstall -y olso.config
+    fi
+}
+
 # Restore xtrace
 $XTRACE
 
diff --git a/stackrc b/stackrc
index 1e08d16..c81906a 100644
--- a/stackrc
+++ b/stackrc
@@ -180,8 +180,11 @@
 
 # Nova hypervisor configuration.  We default to libvirt with **kvm** but will
 # drop back to **qemu** if we are unable to load the kvm module.  ``stack.sh`` can
-# also install an **LXC**, **OpenVZ** or **XenAPI** based system.
-VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
+# also install an **LXC**, **OpenVZ** or **XenAPI** based system.  If xenserver-core
+# is installed, the default will be XenAPI
+DEFAULT_VIRT_DRIVER=libvirt
+is_package_installed xenserver-core && DEFAULT_VIRT_DRIVER=xenserver
+VIRT_DRIVER=${VIRT_DRIVER:-$DEFAULT_VIRT_DRIVER}
 case "$VIRT_DRIVER" in
     libvirt)
         LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}