Merge "Add oslo.log"
diff --git a/extras.d/70-sahara.sh b/extras.d/70-sahara.sh
index 1a67c29..2a34999 100644
--- a/extras.d/70-sahara.sh
+++ b/extras.d/70-sahara.sh
@@ -4,7 +4,6 @@
     if [[ "$1" == "source" ]]; then
         # Initial source
         source $TOP_DIR/lib/sahara
-        source $TOP_DIR/lib/sahara-dashboard
     elif [[ "$1" == "stack" && "$2" == "install" ]]; then
         echo_summary "Installing sahara"
         install_sahara
diff --git a/functions-common b/functions-common
index 4e74f5a..87b9ece 100644
--- a/functions-common
+++ b/functions-common
@@ -1400,6 +1400,19 @@
         $cmd_pip install --build=${pip_build_tmp} \
         $pip_mirror_opt $@ \
         && $sudo_pip rm -rf ${pip_build_tmp}
+
+    if [[ "$INSTALL_TESTONLY_PACKAGES" == "True" ]]; then
+        local test_req="$@/test-requirements.txt"
+        if [[ -e "$test_req" ]]; then
+            $sudo_pip PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
+                http_proxy=$http_proxy \
+                https_proxy=$https_proxy \
+                no_proxy=$no_proxy \
+                $cmd_pip install --build=${pip_build_tmp} \
+                $pip_mirror_opt -r $test_req \
+                && $sudo_pip rm -rf ${pip_build_tmp}
+        fi
+    fi
 }
 
 # this should be used if you want to install globally, all libraries should
diff --git a/lib/dstat b/lib/dstat
new file mode 100644
index 0000000..a2c522c
--- /dev/null
+++ b/lib/dstat
@@ -0,0 +1,41 @@
+# lib/apache
+# Functions to start and stop dstat
+
+# Dependencies:
+#
+# - ``functions`` file
+
+# ``stack.sh`` calls the entry points in this order:
+#
+# - start_dstat
+# - stop_dstat
+
+# Save trace setting
+XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+# for DSTAT logging
+DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
+
+
+# start_dstat() - Start running processes, including screen
+function start_dstat {
+    # A better kind of sysstat, with the top process per time slice
+    DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
+    if [[ -n ${SCREEN_LOGDIR} ]]; then
+        screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
+    else
+        screen_it dstat "dstat $DSTAT_OPTS"
+    fi
+}
+
+# stop_dstat() stop dstat process
+function stop_dstat {
+    screen_stop dstat
+}
+
+# Restore xtrace
+$XTRACE
diff --git a/lib/glance b/lib/glance
index 1dea6cf..7a28b68 100644
--- a/lib/glance
+++ b/lib/glance
@@ -106,7 +106,6 @@
     inicomment $GLANCE_API_CONF DEFAULT log_file
     iniset $GLANCE_API_CONF DEFAULT sql_connection $dburl
     iniset $GLANCE_API_CONF DEFAULT use_syslog $SYSLOG
-    iniset $GLANCE_API_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
     iniset $GLANCE_API_CONF DEFAULT image_cache_dir $GLANCE_CACHE_DIR/
     iniset $GLANCE_API_CONF paste_deploy flavor keystone+cachemanagement
     iniset $GLANCE_API_CONF keystone_authtoken identity_uri $KEYSTONE_AUTH_URI
@@ -125,6 +124,13 @@
         iniset $GLANCE_API_CONF DEFAULT disk_formats "ami,ari,aki,vhd,raw,iso"
     fi
 
+    # Store specific configs
+    iniset $GLANCE_API_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
+
+    # NOTE(flaper87): Until Glance is fully migrated, set these configs in both
+    # sections.
+    iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
+
     # Store the images in swift if enabled.
     if is_service_enabled s-proxy; then
         iniset $GLANCE_API_CONF DEFAULT default_store swift
@@ -134,6 +140,15 @@
         iniset $GLANCE_API_CONF DEFAULT swift_store_create_container_on_put True
 
         iniset $GLANCE_API_CONF DEFAULT known_stores "glance.store.filesystem.Store, glance.store.http.Store, glance.store.swift.Store"
+
+        # NOTE(flaper87): Until Glance is fully migrated, set these configs in both
+        # sections.
+        iniset $GLANCE_API_CONF glance_store default_store swift
+        iniset $GLANCE_API_CONF glance_store swift_store_auth_address $KEYSTONE_SERVICE_URI/v2.0/
+        iniset $GLANCE_API_CONF glance_store swift_store_user $SERVICE_TENANT_NAME:glance-swift
+        iniset $GLANCE_API_CONF glance_store swift_store_key $SERVICE_PASSWORD
+        iniset $GLANCE_API_CONF glance_store swift_store_create_container_on_put True
+        iniset $GLANCE_API_CONF glance_store stores "file, http, swift"
     fi
 
     cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
@@ -144,7 +159,6 @@
     iniset $GLANCE_CACHE_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
     inicomment $GLANCE_CACHE_CONF DEFAULT log_file
     iniset $GLANCE_CACHE_CONF DEFAULT use_syslog $SYSLOG
-    iniset $GLANCE_CACHE_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
     iniset $GLANCE_CACHE_CONF DEFAULT image_cache_dir $GLANCE_CACHE_DIR/
     iniuncomment $GLANCE_CACHE_CONF DEFAULT auth_url
     iniset $GLANCE_CACHE_CONF DEFAULT auth_url $KEYSTONE_AUTH_URI/v2.0
@@ -155,6 +169,12 @@
     iniuncomment $GLANCE_CACHE_CONF DEFAULT auth_password
     iniset $GLANCE_CACHE_CONF DEFAULT admin_password $SERVICE_PASSWORD
 
+    # Store specific confs
+    # NOTE(flaper87): Until Glance is fully migrated, set these configs in both
+    # sections.
+    iniset $GLANCE_CACHE_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
+    iniset $GLANCE_CACHE_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
+
     cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
     cp -p $GLANCE_DIR/etc/schema-image.json $GLANCE_SCHEMA_JSON
 }
diff --git a/lib/keystone b/lib/keystone
index 42acd50..c1b0b87 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -237,11 +237,11 @@
     iniset $KEYSTONE_CONF ec2 driver "keystone.contrib.ec2.backends.sql.Ec2"
 
     if [[ "$KEYSTONE_TOKEN_BACKEND" = "sql" ]]; then
-        iniset $KEYSTONE_CONF token driver keystone.token.backends.sql.Token
+        iniset $KEYSTONE_CONF token driver keystone.token.persistence.backends.sql.Token
     elif [[ "$KEYSTONE_TOKEN_BACKEND" = "memcache" ]]; then
-        iniset $KEYSTONE_CONF token driver keystone.token.backends.memcache.Token
+        iniset $KEYSTONE_CONF token driver keystone.token.persistence.backends.memcache.Token
     else
-        iniset $KEYSTONE_CONF token driver keystone.token.backends.kvs.Token
+        iniset $KEYSTONE_CONF token driver keystone.token.persistence.backends.kvs.Token
     fi
 
     if [[ "$KEYSTONE_CATALOG_BACKEND" = "sql" ]]; then
diff --git a/lib/oslo b/lib/oslo
index 29942ea..e5fa37e 100644
--- a/lib/oslo
+++ b/lib/oslo
@@ -29,6 +29,8 @@
 OSLOMID_DIR=$DEST/oslo.middleware
 OSLOMSG_DIR=$DEST/oslo.messaging
 OSLORWRAP_DIR=$DEST/oslo.rootwrap
+OSLOSERIALIZATION_DIR=$DEST/oslo.serialization
+OSLOUTILS_DIR=$DEST/oslo.utils
 OSLOVMWARE_DIR=$DEST/oslo.vmware
 PYCADF_DIR=$DEST/pycadf
 STEVEDORE_DIR=$DEST/stevedore
@@ -48,6 +50,12 @@
     git_clone $OSLOI18N_REPO $OSLOI18N_DIR $OSLOI18N_BRANCH
     setup_install $OSLOI18N_DIR
 
+    git_clone $OSLOUTILS_REPO $OSLOUTILS_DIR $OSLOUTILS_BRANCH
+    setup_install $OSLOUTILS_DIR
+
+    git_clone $OSLOSERIALIZATION_REPO $OSLOSERIALIZATION_DIR $OSLOSERIALIZATION_BRANCH
+    setup_install $OSLOSERIALIZATION_DIR
+
     git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH
     setup_install $OSLOCFG_DIR
 
diff --git a/stack.sh b/stack.sh
index 9a25bc0..0a31369 100755
--- a/stack.sh
+++ b/stack.sh
@@ -236,7 +236,7 @@
 if [[ is_fedora && ( $DISTRO == "rhel6" || $DISTRO == "rhel7" ) ]]; then
     # RHEL requires EPEL for many Open Stack dependencies
     if [[ $DISTRO == "rhel7" ]]; then
-        EPEL_RPM=${RHEL7_EPEL_RPM:-"http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm"}
+        EPEL_RPM=${RHEL7_EPEL_RPM:-"http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm"}
     elif [[ $DISTRO == "rhel6" ]]; then
         EPEL_RPM=${RHEL6_EPEL_RPM:-"http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm"}
     fi
@@ -323,9 +323,6 @@
 SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
 SYSLOG_PORT=${SYSLOG_PORT:-516}
 
-# for DSTAT logging
-DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
-
 # Use color for logging output (only available if syslog is not used)
 LOG_COLOR=`trueorfalse True $LOG_COLOR`
 
@@ -369,6 +366,7 @@
 source $TOP_DIR/lib/neutron
 source $TOP_DIR/lib/baremetal
 source $TOP_DIR/lib/ldap
+source $TOP_DIR/lib/dstat
 
 # Extras Source
 # --------------
@@ -948,12 +946,7 @@
 # -------
 
 # A better kind of sysstat, with the top process per time slice
-DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
-if [[ -n ${SCREEN_LOGDIR} ]]; then
-    screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
-else
-    screen_it dstat "dstat $DSTAT_OPTS"
-fi
+start_dstat
 
 # Start Services
 # ==============
diff --git a/stackrc b/stackrc
index 5ea9705..ca28d32 100644
--- a/stackrc
+++ b/stackrc
@@ -252,6 +252,14 @@
 OSLORWRAP_REPO=${OSLORWRAP_REPO:-${GIT_BASE}/openstack/oslo.rootwrap.git}
 OSLORWRAP_BRANCH=${OSLORWRAP_BRANCH:-master}
 
+# oslo.serialization
+OSLOSERIALIZATION_REPO=${OSLOSERIALIZATION_REPO:-${GIT_BASE}/openstack/oslo.serialization.git}
+OSLOSERIALIZATION_BRANCH=${OSLOSERIALIZATION_BRANCH:-master}
+
+# oslo.utils
+OSLOUTILS_REPO=${OSLOUTILS_REPO:-${GIT_BASE}/openstack/oslo.utils.git}
+OSLOUTILS_BRANCH=${OSLOUTILS_BRANCH:-master}
+
 # oslo.vmware
 OSLOVMWARE_REPO=${OSLOVMWARE_REPO:-${GIT_BASE}/openstack/oslo.vmware.git}
 OSLOVMWARE_BRANCH=${OSLOVMWARE_BRANCH:-master}
diff --git a/tools/xen/functions b/tools/xen/functions
index ab0be84..4317796 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -93,7 +93,7 @@
     echo $pbd_path
 }
 
-function find_ip_by_name() {
+function find_ip_by_name {
     local guest_name="$1"
     local interface="$2"
 
@@ -121,7 +121,7 @@
     done
 }
 
-function _vm_uuid() {
+function _vm_uuid {
     local vm_name_label
 
     vm_name_label="$1"
@@ -129,14 +129,14 @@
     xe vm-list name-label="$vm_name_label" --minimal
 }
 
-function _create_new_network() {
+function _create_new_network {
     local name_label
     name_label=$1
 
     xe network-create name-label="$name_label"
 }
 
-function _multiple_networks_with_name() {
+function _multiple_networks_with_name {
     local name_label
     name_label=$1
 
@@ -144,21 +144,21 @@
     xe network-list name-label="$name_label" --minimal | grep -q ","
 }
 
-function _network_exists() {
+function _network_exists {
     local name_label
     name_label=$1
 
     ! [ -z "$(xe network-list name-label="$name_label" --minimal)" ]
 }
 
-function _bridge_exists() {
+function _bridge_exists {
     local bridge
     bridge=$1
 
     ! [ -z "$(xe network-list bridge="$bridge" --minimal)" ]
 }
 
-function _network_uuid() {
+function _network_uuid {
     local bridge_or_net_name
     bridge_or_net_name=$1
 
@@ -169,7 +169,7 @@
     fi
 }
 
-function add_interface() {
+function add_interface {
     local vm_name_label
     local bridge_or_network_name
 
@@ -185,7 +185,7 @@
     xe vif-create network-uuid=$net vm-uuid=$vm device=$device_number
 }
 
-function setup_network() {
+function setup_network {
     local bridge_or_net_name
     bridge_or_net_name=$1
 
@@ -204,7 +204,7 @@
     fi
 }
 
-function bridge_for() {
+function bridge_for {
     local bridge_or_net_name
     bridge_or_net_name=$1
 
@@ -215,29 +215,28 @@
     fi
 }
 
-function xenapi_ip_on() {
+function xenapi_ip_on {
     local bridge_or_net_name
     bridge_or_net_name=$1
 
     ifconfig $(bridge_for "$bridge_or_net_name") | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"
 }
 
-function xenapi_is_listening_on() {
+function xenapi_is_listening_on {
     local bridge_or_net_name
     bridge_or_net_name=$1
 
     ! [ -z $(xenapi_ip_on "$bridge_or_net_name") ]
 }
 
-function parameter_is_specified() {
+function parameter_is_specified {
     local parameter_name
     parameter_name=$1
 
     compgen -v | grep "$parameter_name"
 }
 
-function append_kernel_cmdline()
-{
+function append_kernel_cmdline {
     local vm_name_label
     local kernel_args
 
@@ -252,8 +251,7 @@
     xe vm-param-set PV-args="$pv_args $kernel_args" uuid=$vm
 }
 
-function destroy_all_vifs_of()
-{
+function destroy_all_vifs_of {
     local vm_name_label
 
     vm_name_label="$1"
@@ -268,11 +266,11 @@
     unset IFS
 }
 
-function have_multiple_hosts() {
+function have_multiple_hosts {
     xe host-list --minimal | grep -q ","
 }
 
-function attach_network() {
+function attach_network {
     local bridge_or_net_name
 
     bridge_or_net_name="$1"
@@ -286,7 +284,7 @@
     xe network-attach uuid=$net host-uuid=$host
 }
 
-function set_vm_memory() {
+function set_vm_memory {
     local vm_name_label
     local memory
 
@@ -305,7 +303,7 @@
         uuid=$vm
 }
 
-function max_vcpus() {
+function max_vcpus {
     local vm_name_label
 
     vm_name_label="$1"
@@ -337,7 +335,7 @@
     xe vm-param-set uuid=$vm VCPUs-at-startup=$cpu_count
 }
 
-function get_domid() {
+function get_domid {
     local vm_name_label
 
     vm_name_label="$1"
diff --git a/unstack.sh b/unstack.sh
index fe5fc77..0457ef2 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -162,6 +162,8 @@
     cleanup_trove
 fi
 
+stop_dstat
+
 # Clean up the remainder of the screen processes
 SCREEN=$(which screen)
 if [[ -n "$SCREEN" ]]; then