Merge "make mysql run in strict mode"
diff --git a/files/apts/ironic b/files/apts/ironic
index b77a6b1..fe9c07f 100644
--- a/files/apts/ironic
+++ b/files/apts/ironic
@@ -1,3 +1,4 @@
+ipmitool
 iptables
 libguestfs0
 libvirt-bin
diff --git a/files/rpms/ironic b/files/rpms/ironic
index 6534095..0c81081 100644
--- a/files/rpms/ironic
+++ b/files/rpms/ironic
@@ -1,3 +1,4 @@
+ipmitool
 iptables
 libguestfs
 libvirt
diff --git a/functions-common b/functions-common
index cc90c07..613a86c 100644
--- a/functions-common
+++ b/functions-common
@@ -881,29 +881,43 @@
 
 # Distro-agnostic package installer
 # install_package package [package ...]
-function install_package {
-    local xtrace=$(set +o | grep xtrace)
-    set +o xtrace
-    if is_ubuntu; then
-        # if there are transient errors pulling the updates, that's fine. It may
-        # be secondary repositories that we don't really care about.
-        [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update || /bin/true
-        NO_UPDATE_REPOS=True
+function update_package_repo {
+    if [[ "NO_UPDATE_REPOS" = "True" ]]; then
+        return 0
+    fi
 
+    if is_ubuntu; then
+        local xtrace=$(set +o | grep xtrace)
+        set +o xtrace
+        if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
+            # if there are transient errors pulling the updates, that's fine.
+            # It may be secondary repositories that we don't really care about.
+            apt_get update  || /bin/true
+            REPOS_UPDATED=True
+        fi
         $xtrace
+    fi
+}
+
+function real_install_package {
+    if is_ubuntu; then
         apt_get install "$@"
     elif is_fedora; then
-        $xtrace
         yum_install "$@"
     elif is_suse; then
-        $xtrace
         zypper_install "$@"
     else
-        $xtrace
         exit_distro_not_supported "installing packages"
     fi
 }
 
+# Distro-agnostic package installer
+# install_package package [package ...]
+function install_package {
+    update_package_repo
+    real_install_package $@ || RETRY_UPDATE=True update_package_repo && real_install_package $@
+}
+
 # Distro-agnostic function to tell if a package is installed
 # is_package_installed package [package ...]
 function is_package_installed {
@@ -1067,7 +1081,7 @@
             # sleep to allow bash to be ready to be send the command - we are
             # creating a new window in screen and then sends characters, so if
             # bash isn't running by the time we send the command, nothing happens
-            sleep 1.5
+            sleep 3
 
             NL=`echo -ne '\015'`
             # This fun command does the following:
diff --git a/lib/apache b/lib/apache
index 55083e7..baf0fbc 100644
--- a/lib/apache
+++ b/lib/apache
@@ -31,13 +31,13 @@
 # Set up apache name and configuration directory
 if is_ubuntu; then
     APACHE_NAME=apache2
-    APACHE_CONF_DIR=sites-available
+    APACHE_CONF_DIR=${APACHE_CONF_DIR:-/etc/$APACHE_NAME/sites-available}
 elif is_fedora; then
     APACHE_NAME=httpd
-    APACHE_CONF_DIR=conf.d
+    APACHE_CONF_DIR=${APACHE_CONF_DIR:-/etc/$APACHE_NAME/conf.d}
 elif is_suse; then
     APACHE_NAME=apache2
-    APACHE_CONF_DIR=vhosts.d
+    APACHE_CONF_DIR=${APACHE_CONF_DIR:-/etc/$APACHE_NAME/vhosts.d}
 fi
 
 # Functions
@@ -108,14 +108,14 @@
         local apache_version=$(sudo /usr/sbin/apache2ctl -v | awk '/Server version/ {print $3}' | cut -f2 -d/)
         if [[ "$apache_version" =~ ^2\.2\. ]]; then
             # Ubuntu 12.04 - Apache 2.2
-            echo /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}
+            echo $APACHE_CONF_DIR/${site}
         else
             # Ubuntu 14.04 - Apache 2.4
-            echo /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf
+            echo $APACHE_CONF_DIR/${site}.conf
         fi
     elif is_fedora; then
         # fedora conf.d is only imported if it ends with .conf so this is approx the same
-        local enabled_site_file="/etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf"
+        local enabled_site_file="$APACHE_CONF_DIR/${site}.conf"
         if [ -f $enabled_site_file ]; then
             echo ${enabled_site_file}
         else
@@ -130,8 +130,11 @@
     if is_ubuntu; then
         sudo a2ensite ${site}
     elif is_fedora; then
-        # fedora conf.d is only imported if it ends with .conf so this is approx the same
-        sudo mv /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf.disabled /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf
+        local enabled_site_file="$APACHE_CONF_DIR/${site}.conf"
+        # Do nothing if site already enabled or no site config exists
+        if [[ -f ${enabled_site_file}.disabled ]] && [[ ! -f ${enabled_site_file} ]]; then
+            sudo mv ${enabled_site_file}.disabled ${enabled_site_file}
+        fi
     fi
 }
 
@@ -141,7 +144,11 @@
     if is_ubuntu; then
         sudo a2dissite ${site}
     elif is_fedora; then
-        sudo mv /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf.disabled
+        local enabled_site_file="$APACHE_CONF_DIR/${site}.conf"
+        # Do nothing if no site config exists
+        if [[ -f ${enabled_site_file} ]]; then
+            sudo mv ${enabled_site_file} ${enabled_site_file}.disabled
+        fi
     fi
 }
 
diff --git a/lib/horizon b/lib/horizon
index 9e4f2f9..02715ce 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -75,6 +75,9 @@
             sudo rm /usr/bin/node
         fi
     fi
+
+    local horizon_conf=$(apache_site_config_for horizon)
+    sudo rm -f $horizon_conf
 }
 
 # configure_horizon() - Set config files, create data dirs, etc
@@ -123,21 +126,6 @@
     fi
 
     local horizon_conf=$(apache_site_config_for horizon)
-    if is_ubuntu; then
-        disable_apache_site 000-default
-        sudo touch $horizon_conf
-        enable_apache_site horizon
-    elif is_fedora; then
-        sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
-    elif is_suse; then
-        : # nothing to do
-    else
-        exit_distro_not_supported "horizon apache configuration"
-    fi
-
-    # Remove old log files that could mess with how devstack detects whether Horizon
-    # has been successfully started (see start_horizon() and functions::screen_it())
-    sudo rm -f /var/log/$APACHE_NAME/horizon_*
 
     # Configure apache to run horizon
     sudo sh -c "sed -e \"
@@ -148,6 +136,23 @@
         s,%DEST%,$DEST,g;
         s,%HORIZON_REQUIRE%,$HORIZON_REQUIRE,g;
     \" $FILES/apache-horizon.template >$horizon_conf"
+
+    if is_ubuntu; then
+        disable_apache_site 000-default
+        sudo touch $horizon_conf
+    elif is_fedora; then
+        sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
+    elif is_suse; then
+        : # nothing to do
+    else
+        exit_distro_not_supported "horizon apache configuration"
+    fi
+    enable_apache_site horizon
+
+    # Remove old log files that could mess with how devstack detects whether Horizon
+    # has been successfully started (see start_horizon() and functions::screen_it())
+    sudo rm -f /var/log/$APACHE_NAME/horizon_*
+
 }
 
 # install_horizon() - Collect source and prepare
diff --git a/lib/ironic b/lib/ironic
index 389040c..0656980 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -147,6 +147,11 @@
         configure_ironic_api
     fi
 
+    # Format logging
+    if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
+        setup_colorized_logging $IRONIC_CONF_FILE DEFAULT
+    fi
+
     if [[ "$IRONIC_BAREMETAL_BASIC_OPS" == "True" ]]; then
         configure_ironic_auxiliary
     fi
@@ -352,6 +357,8 @@
     while read MAC; do
 
         NODE_ID=$(ironic node-create --chassis_uuid $CHASSIS_ID --driver pxe_ssh \
+            -i pxe_deploy_kernel=$IRONIC_DEPLOY_KERNEL_ID \
+            -i pxe_deploy_ramdisk=$IRONIC_DEPLOY_RAMDISK_ID \
             -i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \
             -i ssh_address=$IRONIC_VM_SSH_ADDRESS \
             -i ssh_port=$IRONIC_VM_SSH_PORT \
@@ -372,6 +379,10 @@
     # create the nova flavor
     adjusted_disk=$(($IRONIC_VM_SPECS_DISK - $IRONIC_VM_EPHEMERAL_DISK))
     nova flavor-create --ephemeral $IRONIC_VM_EPHEMERAL_DISK baremetal auto $IRONIC_VM_SPECS_RAM $adjusted_disk $IRONIC_VM_SPECS_CPU
+    # TODO(lucasagomes): Remove the 'baremetal:deploy_kernel_id'
+    # and 'baremetal:deploy_ramdisk_id' parameters
+    # from the flavor after the completion of
+    # https://blueprints.launchpad.net/ironic/+spec/add-node-instance-info
     nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$IRONIC_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$IRONIC_DEPLOY_RAMDISK_ID"
 
     # intentional sleep to make sure the tag has been set to port
diff --git a/lib/keystone b/lib/keystone
index c4266b9..6b8863e 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -87,10 +87,6 @@
     KEYSTONE_SERVICE_PROTOCOL="https"
 fi
 
-# Apache configuration file for keystone
-KEYSTONE_APACHE_CONF_FILE=$(apache_site_config_for keystone)
-
-
 # Functions
 # ---------
 # cleanup_keystone() - Remove residual data files, anything left over from previous
@@ -106,18 +102,20 @@
 function _cleanup_keystone_apache_wsgi {
     sudo rm -f $KEYSTONE_WSGI_DIR/*.wsgi
     disable_apache_site keystone
-    sudo rm -f $KEYSTONE_APACHE_CONF_FILE
+    sudo rm -f $(apache_site_config_for keystone)
 }
 
 # _config_keystone_apache_wsgi() - Set WSGI config files of Keystone
 function _config_keystone_apache_wsgi {
     sudo mkdir -p $KEYSTONE_WSGI_DIR
 
+    local keystone_apache_conf=$(apache_site_config_for keystone)
+
     # copy proxy vhost and wsgi file
     sudo cp $KEYSTONE_DIR/httpd/keystone.py $KEYSTONE_WSGI_DIR/main
     sudo cp $KEYSTONE_DIR/httpd/keystone.py $KEYSTONE_WSGI_DIR/admin
 
-    sudo cp $FILES/apache-keystone.template $KEYSTONE_APACHE_CONF_FILE
+    sudo cp $FILES/apache-keystone.template $keystone_apache_conf
     sudo sed -e "
         s|%PUBLICPORT%|$KEYSTONE_SERVICE_PORT|g;
         s|%ADMINPORT%|$KEYSTONE_AUTH_PORT|g;
@@ -125,7 +123,7 @@
         s|%PUBLICWSGI%|$KEYSTONE_WSGI_DIR/main|g;
         s|%ADMINWSGI%|$KEYSTONE_WSGI_DIR/admin|g;
         s|%USER%|$STACK_USER|g
-    " -i $KEYSTONE_APACHE_CONF_FILE
+    " -i $keystone_apache_conf
     enable_apache_site keystone
 }
 
diff --git a/lib/neutron_plugins/vmware_nsx b/lib/neutron_plugins/vmware_nsx
index f2f8735..c7672db 100644
--- a/lib/neutron_plugins/vmware_nsx
+++ b/lib/neutron_plugins/vmware_nsx
@@ -58,7 +58,7 @@
 
 function neutron_plugin_configure_l3_agent {
     # VMware NSX plugin does not run L3 agent
-    die $LINENO "q-l3 should must not be executed with VMware NSX plugin!"
+    die $LINENO "q-l3 should not be executed with VMware NSX plugin!"
 }
 
 function neutron_plugin_configure_plugin_agent {
diff --git a/lib/nova b/lib/nova
index 722eabb..76929b1 100644
--- a/lib/nova
+++ b/lib/nova
@@ -81,7 +81,12 @@
 # the new p* interfaces, then basically picks the first
 # alphabetically. It's probably wrong, however it's less wrong than
 # always using 'eth0' which doesn't exist on new Linux distros at all.
-GUEST_INTERFACE_DEFAULT=$(route -n | awk '{print $8}' | grep ^[ep] | sort | head -1)
+GUEST_INTERFACE_DEFAULT=$(ip link \
+    | grep 'state UP' \
+    | awk '{print $2}' \
+    | sed 's/://' \
+    | grep ^[ep] \
+    | head -1)
 
 # Get hypervisor configuration
 # ----------------------------
@@ -241,16 +246,6 @@
 
         # Get the sample configuration file in place
         cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_CONF_DIR
-
-        # Comment out the keystone configs in Nova's api-paste.ini.
-        # We are using nova.conf to configure this instead.
-        inicomment $NOVA_API_PASTE_INI filter:authtoken auth_host
-        inicomment $NOVA_API_PASTE_INI filter:authtoken auth_protocol
-        inicomment $NOVA_API_PASTE_INI filter:authtoken admin_tenant_name
-        inicomment $NOVA_API_PASTE_INI filter:authtoken cafile
-        inicomment $NOVA_API_PASTE_INI filter:authtoken admin_user
-        inicomment $NOVA_API_PASTE_INI filter:authtoken admin_password
-        inicomment $NOVA_API_PASTE_INI filter:authtoken signing_dir
     fi
 
     if is_service_enabled n-cpu; then
@@ -438,10 +433,6 @@
     iniset $NOVA_CONF DEFAULT s3_host "$SERVICE_HOST"
     iniset $NOVA_CONF DEFAULT s3_port "$S3_SERVICE_PORT"
     iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
-    iniset $NOVA_CONF DEFAULT osapi_compute_workers "4"
-    iniset $NOVA_CONF DEFAULT ec2_workers "4"
-    iniset $NOVA_CONF DEFAULT metadata_workers "4"
-    iniset $NOVA_CONF conductor workers "4"
     iniset $NOVA_CONF DEFAULT sql_connection `database_connection_url nova`
     iniset $NOVA_CONF DEFAULT instance_name_template "${INSTANCE_NAME_PREFIX}%08x"
     iniset $NOVA_CONF osapi_v3 enabled "True"
diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt
index f435456..18bdf89 100644
--- a/lib/nova_plugins/functions-libvirt
+++ b/lib/nova_plugins/functions-libvirt
@@ -29,21 +29,16 @@
         install_package python-libguestfs
     fi
 
-    # workaround for
-    # https://bugzilla.redhat.com/show_bug.cgi?id=1098376; if we see
-    # the empty Xen proc file then remove the xen/libxl plugin
-    # shared-libraries (yum remove would uninstall libvirt due to
-    # dependencies, so let's avoid that...)
-    if is_fedora && [ -f /proc/xen/capabilities ] && \
-        [ $(stat -c '%s' /proc/xen/capabilities) -eq 0 ]; then
-        sudo rm -f /usr/lib64/libvirt/connection-driver/libvirt_driver_libxl.so
-        sudo rm -f /usr/lib64/libvirt/connection-driver/libvirt_driver_xen.so
+    # Restart firewalld after install of libvirt to avoid a problem
+    # with polkit, which libvirtd brings in.  See
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1099031
 
-        # another bug requires these to be restarted to avoid
-        # potential hang of libvirtd
-        # https://bugzilla.redhat.com/show_bug.cgi?id=1098866
-        sudo service dbus restart
-        sudo service firewalld restart
+    # Note there is a difference between F20 rackspace cloud images
+    # and HP images used in the gate; rackspace has firewalld but hp
+    # cloud doesn't.  RHEL6 doesn't have firewalld either.  So we
+    # don't care if it fails.
+    if is_fedora; then
+        sudo service firewalld restart || true
     fi
 }
 
diff --git a/lib/nova_plugins/hypervisor-xenserver b/lib/nova_plugins/hypervisor-xenserver
index c37969b..0dba471 100644
--- a/lib/nova_plugins/hypervisor-xenserver
+++ b/lib/nova_plugins/hypervisor-xenserver
@@ -49,9 +49,9 @@
     fi
     read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
     iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver"
-    iniset $NOVA_CONF DEFAULT xenapi_connection_url "$XENAPI_CONNECTION_URL"
-    iniset $NOVA_CONF DEFAULT xenapi_connection_username "$XENAPI_USER"
-    iniset $NOVA_CONF DEFAULT xenapi_connection_password "$XENAPI_PASSWORD"
+    iniset $NOVA_CONF xenserver connection_url "$XENAPI_CONNECTION_URL"
+    iniset $NOVA_CONF xenserver connection_username "$XENAPI_USER"
+    iniset $NOVA_CONF xenserver connection_password "$XENAPI_PASSWORD"
     iniset $NOVA_CONF DEFAULT flat_injected "False"
     # Need to avoid crash due to new firewall support
     XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"}
diff --git a/lib/tempest b/lib/tempest
index 79412f9..af32a9d 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -64,6 +64,7 @@
 
 # Neutron/Network variables
 IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
+IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True $IPV6_SUBNET_ATTRIBUTES_ENABLED)
 
 # Functions
 # ---------
@@ -241,9 +242,6 @@
     iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
     iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
     iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
-    iniset $TEMPEST_CONFIG compute build_interval $BUILD_INTERVAL
-    iniset $TEMPEST_CONFIG volume build_interval $BUILD_INTERVAL
-    iniset $TEMPEST_CONFIG boto build_interval $BUILD_INTERVAL
     iniset $TEMPEST_CONFIG boto http_socket_timeout 5
 
     # Identity
@@ -336,6 +334,11 @@
     # Large Ops Number
     iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
 
+    # Telemetry
+    # Ceilometer API optimization happened in juno that allows to run more tests in tempest.
+    # Once Tempest retires support for icehouse this flag can be removed.
+    iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
+
     # Volume
     if ! is_service_enabled c-bak; then
         iniset $TEMPEST_CONFIG volume-feature-enabled backup False
diff --git a/stack.sh b/stack.sh
index d2f18d4..e73b16a 100755
--- a/stack.sh
+++ b/stack.sh
@@ -548,25 +548,14 @@
     exec 3>&1
     if [[ "$VERBOSE" == "True" ]]; then
         # Set fd 1 and 2 to write the log file
-        exec 1> >( awk -v logfile=${LOGFILE} '
-                /((set \+o$)|xtrace)/ { next }
-                {
-                    cmd ="date +\"%Y-%m-%d %H:%M:%S.%3N | \""
-                    cmd | getline now
-                    close("date +\"%Y-%m-%d %H:%M:%S.%3N | \"")
-                    sub(/^/, now)
-                    print > logfile
-                    fflush(logfile)
-                    print
-                    fflush("")
-                }' ) 2>&1
+        exec 1> >( ./tools/outfilter.py -v -o "${LOGFILE}" ) 2>&1
         # Set fd 6 to summary log file
-        exec 6> >( tee "${SUMFILE}" )
+        exec 6> >( ./tools/outfilter.py -o "${SUMFILE}" )
     else
         # Set fd 1 and 2 to primary logfile
-        exec 1> "${LOGFILE}" 2>&1
+        exec 1> >( ./tools/outfilter.py -o "${LOGFILE}" ) 2>&1
         # Set fd 6 to summary logfile and stdout
-        exec 6> >( tee "${SUMFILE}" >&3 )
+        exec 6> >( ./tools/outfilter.py -v -o "${SUMFILE}" >&3 )
     fi
 
     echo_summary "stack.sh log $LOGFILE"
@@ -583,7 +572,7 @@
         exec 1>/dev/null 2>&1
     fi
     # Always send summary fd to original stdout
-    exec 6>&3
+    exec 6> >( ./tools/outfilter.py -v >&3 )
 fi
 
 # Set up logging of screen windows
diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh
index e6a6a79..a410543 100755
--- a/tools/fixup_stuff.sh
+++ b/tools/fixup_stuff.sh
@@ -87,16 +87,18 @@
 fi
 
 
-# RHEL6
-# -----
-
-if [[ $DISTRO =~ (rhel6) ]]; then
-
+if is_fedora; then
     # Disable selinux to avoid configuring to allow Apache access
     # to Horizon files (LP#1175444)
     if selinuxenabled; then
         sudo setenforce 0
     fi
+fi
+
+# RHEL6
+# -----
+
+if [[ $DISTRO =~ (rhel6) ]]; then
 
     # If the ``dbus`` package was installed by DevStack dependencies the
     # uuid may not be generated because the service was never started (PR#598200),
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index 1eb9e7a..150faaa 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -24,28 +24,8 @@
 
 FILES=$TOP_DIR/files
 
-# Handle arguments
-
-USE_GET_PIP=${USE_GET_PIP:-0}
-INSTALL_PIP_VERSION=${INSTALL_PIP_VERSION:-"1.4.1"}
-while [[ -n "$1" ]]; do
-    case $1 in
-        --force)
-            FORCE=1
-            ;;
-        --pip-version)
-            INSTALL_PIP_VERSION="$2"
-            shift
-            ;;
-        --use-get-pip)
-            USE_GET_PIP=1;
-            ;;
-    esac
-    shift
-done
-
-PIP_GET_PIP_URL=https://raw.github.com/pypa/pip/master/contrib/get-pip.py
-PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSION.tar.gz
+PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
+LOCAL_PIP="$FILES/$(basename $PIP_GET_PIP_URL)"
 
 GetDistro
 echo "Distro: $DISTRO"
@@ -62,23 +42,13 @@
 
 
 function install_get_pip {
-    if [[ ! -r $FILES/get-pip.py ]]; then
-        (cd $FILES; \
-            curl -O $PIP_GET_PIP_URL; \
-        )
+    if [[ ! -r $LOCAL_PIP ]]; then
+        curl -o $LOCAL_PIP $PIP_GET_PIP_URL || \
+            die $LINENO "Download of get-pip.py failed"
     fi
-    sudo -E python $FILES/get-pip.py
+    sudo -E python $LOCAL_PIP
 }
 
-function install_pip_tarball {
-    if [[ ! -r $FILES/pip-$INSTALL_PIP_VERSION.tar.gz ]]; then
-        (cd $FILES; \
-            curl -O $PIP_TAR_URL; \
-            tar xvfz pip-$INSTALL_PIP_VERSION.tar.gz 1>/dev/null)
-    fi
-    (cd $FILES/pip-$INSTALL_PIP_VERSION; \
-        sudo -E python setup.py install 1>/dev/null)
-}
 
 # Show starting versions
 get_versions
@@ -88,10 +58,8 @@
 # Eradicate any and all system packages
 uninstall_package python-pip
 
-if [[ "$USE_GET_PIP" == "1" ]]; then
-    install_get_pip
-else
-    install_pip_tarball
-fi
+install_get_pip
+
+pip_install -U setuptools
 
 get_versions
diff --git a/tools/outfilter.py b/tools/outfilter.py
new file mode 100755
index 0000000..9686a38
--- /dev/null
+++ b/tools/outfilter.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# This is an output filter to filter and timestamp the logs from grenade and
+# devstack. Largely our awk filters got beyond the complexity level which were
+# sustainable, so this provides us much more control in a single place.
+#
+# The overhead of running python should be less than execing `date` a million
+# times during a run.
+
+import argparse
+import datetime
+import re
+import sys
+
+IGNORE_LINES = re.compile('(set \+o|xtrace)')
+HAS_DATE = re.compile('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} \|')
+
+
+def get_options():
+    parser = argparse.ArgumentParser(
+        description='Filter output by devstack and friends')
+    parser.add_argument('-o', '--outfile',
+                        help='Output file for content',
+                        default=None)
+    parser.add_argument('-v', '--verbose', action='store_true',
+                        default=False)
+    return parser.parse_args()
+
+
+def skip_line(line):
+    """Should we skip this line."""
+    return IGNORE_LINES.search(line) is not None
+
+
+def main():
+    opts = get_options()
+    outfile = None
+    if opts.outfile:
+        outfile = open(opts.outfile, 'a', 0)
+
+    # otherwise fileinput reprocess args as files
+    sys.argv = []
+    while True:
+        line = sys.stdin.readline()
+        if not line:
+            return 0
+
+        # put skip lines here
+        if skip_line(line):
+            continue
+
+        # this prevents us from nesting date lines, because
+        # we'd like to pull this in directly in grenade and not double
+        # up on devstack lines
+        if HAS_DATE.search(line) is None:
+            now = datetime.datetime.utcnow()
+            line = ("%s | %s" % (
+                now.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3],
+                line))
+
+        if opts.verbose:
+            sys.stdout.write(line)
+            sys.stdout.flush()
+        if outfile:
+            outfile.write(line)
+            outfile.flush()
+
+
+if __name__ == '__main__':
+    try:
+        sys.exit(main())
+    except KeyboardInterrupt:
+        sys.exit(1)