Merge "Add missing mongodb client package on Fedora"
diff --git a/.gitignore b/.gitignore
index 4365202..1840352 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,8 +7,10 @@
 localrc
 local.sh
 files/*.gz
+files/*.qcow2
 files/images
 files/pip-*
+files/get-pip.py
 stack-screenrc
 *.pem
 accrc
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index 07b6b60..d477c42 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -6,7 +6,6 @@
 # ------------------------------------------------------------------
 # service              glance     admin
 # service              heat       service        # if enabled
-# service              ceilometer admin          # if enabled
 # Tempest Only:
 # alt_demo             alt_demo  Member
 #
@@ -113,30 +112,11 @@
 fi
 
 # Ceilometer
-if [[ "$ENABLED_SERVICES" =~ "ceilometer" ]]; then
-    keystone user-create --name=ceilometer \
-        --pass="$SERVICE_PASSWORD" \
-        --tenant $SERVICE_TENANT_NAME \
-        --email=ceilometer@example.com
-    keystone user-role-add --tenant $SERVICE_TENANT_NAME \
-        --user ceilometer \
-        --role admin
+if [[ "$ENABLED_SERVICES" =~ "ceilometer" ]] && [[ "$ENABLED_SERVICES" =~ "s-proxy" || "$ENABLED_SERVICES" =~ "swift" ]]; then
     # Ceilometer needs ResellerAdmin role to access swift account stats.
     keystone user-role-add --tenant $SERVICE_TENANT_NAME \
         --user ceilometer \
         --role ResellerAdmin
-    if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
-        keystone service-create \
-            --name=ceilometer \
-            --type=metering \
-            --description="Ceilometer Service"
-        keystone endpoint-create \
-            --region RegionOne \
-            --service ceilometer \
-            --publicurl "http://$SERVICE_HOST:8777" \
-            --adminurl "http://$SERVICE_HOST:8777" \
-            --internalurl "http://$SERVICE_HOST:8777"
-    fi
 fi
 
 # EC2
diff --git a/functions b/functions
index 92b61ed..73d65ce 100644
--- a/functions
+++ b/functions
@@ -1150,6 +1150,9 @@
 
 
 # Stop a service in screen
+# If a PID is available use it, kill the whole process group via TERM
+# If screen is being used kill the screen window; this will catch processes
+# that did not leave a PID behind
 # screen_stop service
 function screen_stop() {
     SCREEN_NAME=${SCREEN_NAME:-stack}
@@ -1159,7 +1162,7 @@
     if is_service_enabled $1; then
         # Kill via pid if we have one available
         if [[ -r $SERVICE_DIR/$SCREEN_NAME/$1.pid ]]; then
-            pkill -TERM -P $(cat $SERVICE_DIR/$SCREEN_NAME/$1.pid)
+            pkill -TERM -P -$(cat $SERVICE_DIR/$SCREEN_NAME/$1.pid)
             rm $SERVICE_DIR/$SCREEN_NAME/$1.pid
         fi
         if [[ "$USE_SCREEN" = "True" ]]; then
@@ -1301,7 +1304,8 @@
     echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
 
     # Don't update repo if local changes exist
-    (cd $project_dir && git diff --quiet)
+    # Don't use buggy "git diff --quiet"
+    (cd $project_dir && git diff --exit-code >/dev/null)
     local update_requirements=$?
 
     if [ $update_requirements -eq 0 ]; then
@@ -1539,7 +1543,7 @@
         # NOTE: For backwards compatibility reasons, colons may be used in place
         # of semi-colons for property delimiters but they are not permitted
         # characters in NTFS filesystems.
-        property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).+[:;].+[:;].+$'`
+        property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).*[:;].*[:;].*$'`
         IFS=':;' read -a props <<< "$property_string"
         vmdk_disktype="${props[0]:-$vmdk_disktype}"
         vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"
diff --git a/lib/ceilometer b/lib/ceilometer
index d0f00c0..6f3896f 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -85,9 +85,9 @@
             keystone endpoint-create \
                 --region RegionOne \
                 --service_id $CEILOMETER_SERVICE \
-                --publicurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \
-                --adminurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \
-                --internalurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/"
+                --publicurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT" \
+                --adminurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT" \
+                --internalurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT"
         fi
     fi
 }
diff --git a/lib/glance b/lib/glance
index 21c1fa5..55d5fb3 100644
--- a/lib/glance
+++ b/lib/glance
@@ -125,7 +125,7 @@
         iniset $GLANCE_API_CONF DEFAULT swift_store_key $SERVICE_PASSWORD
         iniset $GLANCE_API_CONF DEFAULT swift_store_create_container_on_put True
 
-        iniset_multiline DEFAULT known_stores glance.store.filesystem.Store glance.store.http.Store glance.store.swift.Store
+        iniset $GLANCE_API_CONF DEFAULT known_stores "glance.store.filesystem.Store, glance.store.http.Store, glance.store.swift.Store"
     fi
 
     cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
diff --git a/lib/heat b/lib/heat
index e35305b..0307c64 100644
--- a/lib/heat
+++ b/lib/heat
@@ -110,15 +110,12 @@
     [[ "$HEAT_STANDALONE" = "True" ]] && iniset $HEAT_CONF paste_deploy flavor standalone
 
     # OpenStack API
-    iniset $HEAT_CONF heat_api bind_host $HEAT_API_HOST
     iniset $HEAT_CONF heat_api bind_port $HEAT_API_PORT
 
     # Cloudformation API
-    iniset $HEAT_CONF heat_api_cfn bind_host $HEAT_API_CFN_HOST
     iniset $HEAT_CONF heat_api_cfn bind_port $HEAT_API_CFN_PORT
 
     # Cloudwatch API
-    iniset $HEAT_CONF heat_api_cloudwatch bind_host $HEAT_API_CW_HOST
     iniset $HEAT_CONF heat_api_cloudwatch bind_port $HEAT_API_CW_PORT
 
     # heat environment
diff --git a/lib/ironic b/lib/ironic
index 1ff3c81..afbc3e0 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -33,7 +33,6 @@
 IRONIC_CONF_DIR=${IRONIC_CONF_DIR:-/etc/ironic}
 IRONIC_CONF_FILE=$IRONIC_CONF_DIR/ironic.conf
 IRONIC_ROOTWRAP_CONF=$IRONIC_CONF_DIR/rootwrap.conf
-IRONIC_ROOTWRAP_FILTERS=$IRONIC_CONF_DIR/rootwrap.d
 IRONIC_POLICY_JSON=$IRONIC_CONF_DIR/policy.json
 
 # Support entry points installation of console scripts
@@ -118,7 +117,7 @@
 # Sets conductor specific settings.
 function configure_ironic_conductor() {
     cp $IRONIC_DIR/etc/ironic/rootwrap.conf $IRONIC_ROOTWRAP_CONF
-    cp -r $IRONIC_DIR/etc/ironic/rootwrap.d $IRONIC_ROOTWRAP_FILTERS
+    cp -r $IRONIC_DIR/etc/ironic/rootwrap.d $IRONIC_CONF_DIR
 
     iniset $IRONIC_CONF DEFAULT rootwrap_config $IRONIC_ROOTWRAP_CONF
 }
diff --git a/lib/keystone b/lib/keystone
index ceefe6a..0850fb2 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -28,8 +28,6 @@
 XTRACE=$(set +o | grep xtrace)
 set +o xtrace
 
-source $TOP_DIR/lib/tls
-
 # Defaults
 # --------
 
@@ -247,14 +245,14 @@
     fi
 
     # Set up logging
-    LOGGING_ROOT="devel"
     if [ "$SYSLOG" != "False" ]; then
-        LOGGING_ROOT="$LOGGING_ROOT,production"
+        iniset $KEYSTONE_CONF DEFAULT use_syslog "True"
     fi
-    KEYSTONE_LOG_CONFIG="--log-config $KEYSTONE_CONF_DIR/logging.conf"
-    cp $KEYSTONE_DIR/etc/logging.conf.sample $KEYSTONE_CONF_DIR/logging.conf
-    iniset $KEYSTONE_CONF_DIR/logging.conf logger_root level "DEBUG"
-    iniset $KEYSTONE_CONF_DIR/logging.conf logger_root handlers "devel,production"
+
+    # Format logging
+    if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
+        setup_colorized_logging $KEYSTONE_CONF DEFAULT
+    fi
 
     if is_apache_enabled_service key; then
         _config_keystone_apache_wsgi
@@ -412,7 +410,7 @@
         screen_it key "cd $KEYSTONE_DIR && sudo tail -f /var/log/$APACHE_NAME/keystone"
     else
         # Start Keystone in a screen window
-        screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG --debug"
+        screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF --debug"
     fi
 
     echo "Waiting for keystone to start..."
diff --git a/lib/neutron b/lib/neutron
index 81faa10..960f11b 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -1,5 +1,5 @@
 # lib/neutron
-# functions - funstions specific to neutron
+# functions - functions specific to neutron
 
 # Dependencies:
 # ``functions`` file
@@ -505,8 +505,7 @@
         [ ! -z "$pid" ] && sudo kill -9 $pid
     fi
     if is_service_enabled q-meta; then
-        pid=$(ps aux | awk '/neutron-ns-metadata-proxy/ { print $2 }')
-        [ ! -z "$pid" ] && sudo kill -9 $pid
+        sudo pkill -9 neutron-ns-metadata-proxy || :
     fi
 
     if is_service_enabled q-lbaas; then
@@ -611,9 +610,6 @@
     iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT verbose False
     iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False
     iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
-    iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND"
-    # Intermediate fix until Neutron patch lands and then line above will
-    # be cleaned.
     iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND"
 
     _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE
diff --git a/lib/neutron_plugins/brocade b/lib/neutron_plugins/brocade
index f9275ca..8e18d04 100644
--- a/lib/neutron_plugins/brocade
+++ b/lib/neutron_plugins/brocade
@@ -38,7 +38,7 @@
 }
 
 function neutron_plugin_configure_plugin_agent() {
-    AGENT_BINARY="$NEUTON_BIN_DIR/neutron-linuxbridge-agent"
+    AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
 }
 
 function neutron_plugin_setup_interface_driver() {
diff --git a/lib/neutron_thirdparty/vmware_nsx b/lib/neutron_thirdparty/vmware_nsx
index 7c62027..4eb177a 100644
--- a/lib/neutron_thirdparty/vmware_nsx
+++ b/lib/neutron_thirdparty/vmware_nsx
@@ -79,7 +79,7 @@
 }
 
 function check_vmware_nsx() {
-    :
+    neutron-check-nsx-config $NEUTRON_CONF_DIR/plugins/vmware/nsx.ini
 }
 
 # Restore xtrace
diff --git a/lib/nova b/lib/nova
index a508789..a4edb53 100644
--- a/lib/nova
+++ b/lib/nova
@@ -650,12 +650,11 @@
 
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
         # Enable client side traces for libvirt
-        export LIBVIRT_LOG_FILTERS="1:libvirt"
-        export LIBVIRT_LOG_OUTPUTS="1:file:/var/log/libvirt/libvirtd-nova.log"
-
+        local log_filters="1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 1:util"
+        local log_outputs="1:file:/var/log/libvirt/libvirtd.log"
         # Enable server side traces for libvirtd
-        echo "log_filters=\"1:libvirt 1:qemu\"" | sudo tee -a /etc/libvirt/libvirtd.conf
-        echo "log_outputs=\"1:file:/var/log/libvirt/libvirtd.log\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+        echo "log_filters=\"$log_filters\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+        echo "log_outputs=\"$log_outputs\"" | sudo tee -a /etc/libvirt/libvirtd.conf
 
         # The group **$LIBVIRT_GROUP** is added to the current user in this script.
         # Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
diff --git a/lib/savanna b/lib/savanna
index bb4dfe6..c7d59f7 100644
--- a/lib/savanna
+++ b/lib/savanna
@@ -95,9 +95,7 @@
     iniset $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE DEFAULT os_admin_tenant_name $SERVICE_TENANT_NAME
     iniset $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE DEFAULT debug $SAVANNA_DEBUG
 
-    recreate_database savanna utf8
-    iniset $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE database sql_connection `database_connection_url savanna`
-    inicomment $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE database connection
+    iniset $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE database connection `database_connection_url savanna`
 
     if is_service_enabled neutron; then
         iniset $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE DEFAULT use_neutron true
@@ -105,6 +103,9 @@
     fi
 
     iniset $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE DEFAULT use_syslog $SYSLOG
+
+    recreate_database savanna utf8
+    $SAVANNA_BIN_DIR/savanna-db-manage --config-file $SAVANNA_CONF_DIR/$SAVANNA_CONF_FILE upgrade head
 }
 
 # install_savanna() - Collect source and prepare
diff --git a/stack.sh b/stack.sh
index 621a058..97a15a9 100755
--- a/stack.sh
+++ b/stack.sh
@@ -23,6 +23,13 @@
 # Make sure custom grep options don't get in the way
 unset GREP_OPTIONS
 
+# Sanitize language settings to avoid commands bailing out
+# with "unsupported locale setting" errors.
+unset LANG
+unset LANGUAGE
+LC_ALL=C
+export LC_ALL
+
 # Keep track of the devstack directory
 TOP_DIR=$(cd $(dirname "$0") && pwd)
 
@@ -291,6 +298,9 @@
 SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"}
 SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"}
 
+PIDSTAT_FILE=${PIDSTAT_FILE:-"pidstat.txt"}
+PIDSTAT_INTERVAL=${PIDSTAT_INTERVAL:-"5"}
+
 # Use color for logging output (only available if syslog is not used)
 LOG_COLOR=`trueorfalse True $LOG_COLOR`
 
@@ -305,9 +315,13 @@
 # Configure Projects
 # ==================
 
-# Source project function libraries
+# Import apache functions
 source $TOP_DIR/lib/apache
+
+# Import TLS functions
 source $TOP_DIR/lib/tls
+
+# Source project function libraries
 source $TOP_DIR/lib/infra
 source $TOP_DIR/lib/oslo
 source $TOP_DIR/lib/stackforge
@@ -860,11 +874,27 @@
 # -------
 
 # If enabled, systat has to start early to track OpenStack service startup.
-if is_service_enabled sysstat;then
+if is_service_enabled sysstat; then
+    # what we want to measure
+    # -u : cpu statitics
+    # -q : load
+    # -b : io load rates
+    # -w : process creation and context switch rates
+    SYSSTAT_OPTS="-u -q -b -w"
     if [[ -n ${SCREEN_LOGDIR} ]]; then
-        screen_it sysstat "cd ; sar -o $SCREEN_LOGDIR/$SYSSTAT_FILE $SYSSTAT_INTERVAL"
+        screen_it sysstat "cd $TOP_DIR; ./tools/sar_filter.py $SYSSTAT_OPTS -o $SCREEN_LOGDIR/$SYSSTAT_FILE $SYSSTAT_INTERVAL"
     else
-        screen_it sysstat "sar $SYSSTAT_INTERVAL"
+        screen_it sysstat "./tools/sar_filter.py $SYSSTAT_OPTS $SYSSTAT_INTERVAL"
+    fi
+fi
+
+if is_service_enabled pidstat; then
+    # Per-process stats
+    PIDSTAT_OPTS="-l -p ALL -T ALL"
+    if [[ -n ${SCREEN_LOGDIR} ]]; then
+        screen_it pidstat "cd $TOP_DIR; pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL > $SCREEN_LOGDIR/$PIDSTAT_FILE"
+    else
+        screen_it pidstat "pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL"
     fi
 fi
 
diff --git a/stackrc b/stackrc
index 49fb26b..8a0280e 100644
--- a/stackrc
+++ b/stackrc
@@ -284,6 +284,9 @@
     vsphere)
         DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-debian-2.6.32-i686}
         IMAGE_URLS=${IMAGE_URLS:-"http://partnerweb.vmware.com/programs/vmdkimage/debian-2.6.32-i686.vmdk"};;
+    xenserver)
+        DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.0-x86_64-disk}
+        IMAGE_URLS=${IMAGE_URLS:-"https://github.com/downloads/citrix-openstack/warehouse/cirros-0.3.0-x86_64-disk.vhd.tgz"};;
     *) # Default to Cirros with kernel, ramdisk and disk image
         DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.1-x86_64-uec}
         IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"};;
diff --git a/tools/sar_filter.py b/tools/sar_filter.py
new file mode 100755
index 0000000..ed8c196
--- /dev/null
+++ b/tools/sar_filter.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Samsung Electronics Corp. All Rights Reserved.
+#
+# 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.
+
+import re
+import subprocess
+import sys
+
+
+def is_data_line(line):
+    timestamp, data = parse_line(line)
+    return re.search('\d\.d', data)
+
+
+def parse_line(line):
+    m = re.search('(\d\d:\d\d:\d\d \w\w)(\s+((\S+)\s*)+)', line)
+    if m:
+        date = m.group(1)
+        data = m.group(2).rstrip()
+        return date, data
+    else:
+        return None, None
+
+
+process = subprocess.Popen(
+    "sar %s" % " ".join(sys.argv[1:]),
+    shell=True,
+    stdout=subprocess.PIPE,
+    stderr=subprocess.STDOUT)
+
+# Poll process for new output until finished
+
+start_time = ""
+header = ""
+data_line = ""
+printed_header = False
+current_ts = None
+while True:
+    nextline = process.stdout.readline()
+    if nextline == '' and process.poll() is not None:
+        break
+
+    date, data = parse_line(nextline)
+    # stop until we get to the first set of real lines
+    if not date:
+        continue
+
+    # now we eat the header lines, and only print out the header
+    # if we've never seen them before
+    if not start_time:
+        start_time = date
+        header += "%s   %s" % (date, data)
+    elif date == start_time:
+        header += "   %s" % data
+    elif not printed_header:
+        printed_header = True
+        print header
+
+    # now we know this is a data line, printing out if the timestamp
+    # has changed, and stacking up otherwise.
+    nextline = process.stdout.readline()
+    date, data = parse_line(nextline)
+    if date != current_ts:
+        current_ts = date
+        print data_line
+        data_line = "%s   %s" % (date, data)
+    else:
+        data_line += "   %s" % data
+
+    sys.stdout.flush()
diff --git a/tools/xen/README.md b/tools/xen/README.md
index 06192ed..ee1abcc 100644
--- a/tools/xen/README.md
+++ b/tools/xen/README.md
@@ -70,6 +70,9 @@
 Of course, use real passwords if this machine is exposed.
 
     cat > ./localrc <<EOF
+    # At the moment, we depend on github's snapshot function.
+    GIT_BASE="http://github.com"
+
     # Passwords
     # NOTE: these need to be specified, otherwise devstack will try
     # to prompt for these passwords, blocking the install process.
diff --git a/tools/xen/functions b/tools/xen/functions
index 563303d..97c56bc 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -1,5 +1,14 @@
 #!/bin/bash
 
+function die_with_error {
+    local err_msg
+
+    err_msg="$1"
+
+    echo "$err_msg" >&2
+    exit 1
+}
+
 function xapi_plugin_location {
     for PLUGIN_DIR in "/etc/xapi.d/plugins/" "/usr/lib/xcp/plugins/" "/usr/lib/xapi/plugins"; do
         if [ -d $PLUGIN_DIR ]; then
@@ -11,7 +20,7 @@
 }
 
 function zip_snapshot_location {
-    echo $1 | sed "s:\.git$::;s:$:/zipball/$2:g"
+    echo $1 | sed "s,^git://,http://,g;s:\.git$::;s:$:/zipball/$2:g"
 }
 
 function create_directory_for_kernels {
@@ -41,7 +50,9 @@
     local EXTRACTED_FILES=$(mktemp -d)
 
     {
-        wget -nv $ZIPBALL_URL -O $LOCAL_ZIPBALL --no-check-certificate
+        if ! wget -nv $ZIPBALL_URL -O $LOCAL_ZIPBALL --no-check-certificate; then
+            die_with_error "Failed to download [$ZIPBALL_URL]"
+        fi
         unzip -q -o $LOCAL_ZIPBALL -d $EXTRACTED_FILES
         rm -f $LOCAL_ZIPBALL
     } >&2
diff --git a/tools/xen/mocks b/tools/xen/mocks
index 94b0ca4..3b9b05c 100644
--- a/tools/xen/mocks
+++ b/tools/xen/mocks
@@ -35,7 +35,7 @@
 
 function wget {
     if [[ $@ =~ "failurl" ]]; then
-        exit 1
+        return 1
     fi
     echo "wget $@" >> $LIST_OF_ACTIONS
 }
@@ -73,10 +73,14 @@
         done
         return 1
     fi
-    echo "Mock test does not implement the requested function"
+    echo "Mock test does not implement the requested function: ${1:-}"
     exit 1
 }
 
+function die_with_error {
+    echo "$1" >> $DEAD_MESSAGES
+}
+
 function xe {
     cat $XE_RESPONSE
     {
diff --git a/tools/xen/test_functions.sh b/tools/xen/test_functions.sh
index 0ae2cb7..373d996 100755
--- a/tools/xen/test_functions.sh
+++ b/tools/xen/test_functions.sh
@@ -29,6 +29,9 @@
 
     XE_CALLS=$(mktemp)
     truncate -s 0 $XE_CALLS
+
+    DEAD_MESSAGES=$(mktemp)
+    truncate -s 0 $DEAD_MESSAGES
 }
 
 # Teardown
@@ -64,6 +67,10 @@
     grep -qe "^$1\$" $XE_CALLS
 }
 
+function assert_died_with {
+    diff -u <(echo "$1") $DEAD_MESSAGES
+}
+
 function mock_out {
     local FNNAME="$1"
     local OUTPUT="$2"
@@ -109,16 +116,22 @@
     grep "[ -d /usr/lib/xcp/plugins/ ]" $LIST_OF_ACTIONS
 }
 
-function test_zip_snapshot_location {
+function test_zip_snapshot_location_http {
     diff \
-    <(zip_snapshot_location "git://git.openstack.org/openstack/nova.git" "master") \
-    <(echo "git://git.openstack.org/openstack/nova/zipball/master")
+    <(zip_snapshot_location "http://github.com/openstack/nova.git" "master") \
+    <(echo "http://github.com/openstack/nova/zipball/master")
+}
+
+function test_zip_snapsot_location_git {
+    diff \
+    <(zip_snapshot_location "git://github.com/openstack/nova.git" "master") \
+    <(echo "http://github.com/openstack/nova/zipball/master")
 }
 
 function test_create_directory_for_kernels {
     (
         . mocks
-        mock_out get_local_sr uuid1
+        mock_out get_local_sr_path /var/run/sr-mount/uuid1
         create_directory_for_kernels
     )
 
@@ -141,7 +154,7 @@
 function test_create_directory_for_images {
     (
         . mocks
-        mock_out get_local_sr uuid1
+        mock_out get_local_sr_path /var/run/sr-mount/uuid1
         create_directory_for_images
     )
 
@@ -179,7 +192,7 @@
     local IGNORE
     IGNORE=$(. mocks && extract_remote_zipball "failurl")
 
-    assert_previous_command_failed
+    assert_died_with "Failed to download [failurl]"
 }
 
 function test_find_nova_plugins {
@@ -199,8 +212,7 @@
 
     [ "$RESULT" == "uuid123" ]
 
-    assert_xe_min
-    assert_xe_param "sr-list" "name-label=Local storage"
+    assert_xe_param "pool-list" params=default-SR minimal=true
 }
 
 function test_get_local_sr_path {
diff --git a/unstack.sh b/unstack.sh
index 4445f1f..31f6f01 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -30,20 +30,31 @@
     exit 1
 fi
 
+
+# Configure Projects
+# ==================
+
 # Import apache functions
 source $TOP_DIR/lib/apache
 
-# Get project function libraries
-source $TOP_DIR/lib/baremetal
-source $TOP_DIR/lib/ceilometer
-source $TOP_DIR/lib/cinder
+# Import TLS functions
+source $TOP_DIR/lib/tls
+
+# Source project function libraries
+source $TOP_DIR/lib/infra
+source $TOP_DIR/lib/oslo
+source $TOP_DIR/lib/stackforge
+source $TOP_DIR/lib/horizon
 source $TOP_DIR/lib/keystone
 source $TOP_DIR/lib/glance
 source $TOP_DIR/lib/nova
-source $TOP_DIR/lib/heat
-source $TOP_DIR/lib/horizon
+source $TOP_DIR/lib/cinder
 source $TOP_DIR/lib/swift
+source $TOP_DIR/lib/ceilometer
+source $TOP_DIR/lib/heat
 source $TOP_DIR/lib/neutron
+source $TOP_DIR/lib/baremetal
+source $TOP_DIR/lib/ldap
 source $TOP_DIR/lib/ironic
 source $TOP_DIR/lib/trove