Merge "Allow install os-vif library used by Nova"
diff --git a/.gitignore b/.gitignore
index c72b0c4..a470ff5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
 doc/files
 doc/build
 files/*.gz
+files/*.vmdk
 files/*.rpm
 files/*.rpm.*
 files/*.qcow2
diff --git a/files/debs/general b/files/debs/general
index 307cd7b..a1f2a4b 100644
--- a/files/debs/general
+++ b/files/debs/general
@@ -1,5 +1,6 @@
 bc
 bridge-utils
+bsdmainutils
 curl
 g++
 gcc
diff --git a/files/rpms-suse/general b/files/rpms-suse/general
index e3dfec1..3b19071 100644
--- a/files/rpms-suse/general
+++ b/files/rpms-suse/general
@@ -25,5 +25,6 @@
 tar
 tcpdump
 unzip
+util-linux
 wget
 zlib-devel
diff --git a/files/rpms/general b/files/rpms/general
index 6d5fd15..2d4a97a 100644
--- a/files/rpms/general
+++ b/files/rpms/general
@@ -30,6 +30,7 @@
 tar
 tcpdump
 unzip
+util-linux
 wget
 which
 zlib-devel
diff --git a/functions b/functions
index 5730b6c..1bfb8a5 100644
--- a/functions
+++ b/functions
@@ -30,6 +30,19 @@
     declare -f -F $1 > /dev/null
 }
 
+# short_source prints out the current location of the caller in a way
+# that strips redundant directories. This is useful for PS4 usage.
+function short_source {
+    saveIFS=$IFS
+    IFS=" "
+    called=($(caller 0))
+    IFS=$saveIFS
+    file=${called[2]}
+    file=${file#$RC_DIR/}
+    printf "%-40s " "$file:${called[1]}:${called[0]}"
+}
+
+
 # Retrieve an image from a URL and upload into Glance.
 # Uses the following variables:
 #
diff --git a/stackrc b/stackrc
index 9bd132a..17d6047 100644
--- a/stackrc
+++ b/stackrc
@@ -14,9 +14,6 @@
 LC_ALL=C
 export LC_ALL
 
-# Make tracing more educational
-export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}:   '
-
 # Find the other rc files
 RC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
 
@@ -132,6 +129,16 @@
     source $RC_DIR/.localrc.auto
 fi
 
+# Use color for logging output (only available if syslog is not used)
+LOG_COLOR=$(trueorfalse True LOG_COLOR)
+
+# Make tracing more educational
+if [[ "$LOG_COLOR" == "True" ]]; then
+    export PS4='+\[$(tput setaf 242)\]$(short_source)\[$(tput sgr0)\] '
+else
+    export PS4='+ $(short_source):   '
+fi
+
 # Configure Identity API version: 2.0, 3
 IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
 
@@ -789,9 +796,6 @@
 SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
 SYSLOG_PORT=${SYSLOG_PORT:-516}
 
-# Use color for logging output (only available if syslog is not used)
-LOG_COLOR=$(trueorfalse True LOG_COLOR)
-
 # Set global ``GIT_DEPTH=<number>`` to limit the history depth of the git clone
 # Set to 0 to disable shallow cloning
 GIT_DEPTH=${GIT_DEPTH:-0}
diff --git a/tests/test_functions.sh b/tests/test_functions.sh
index be8dc5e..8aae23d 100755
--- a/tests/test_functions.sh
+++ b/tests/test_functions.sh
@@ -9,6 +9,22 @@
 
 source $TOP/tests/unittest.sh
 
+echo "Testing generate_hex_string()"
+
+VAL=$(generate_hex_string 16)
+if [[ ${#VAL} -eq 32 ]]; then
+    passed "OK"
+else
+    failed "generate_hex_string 16 failed ${#VAL}"
+fi
+
+VAL=$(generate_hex_string 32)
+if [[ ${#VAL} -eq 64 ]]; then
+    passed "OK"
+else
+    failed "generate_hex_string 32 failed ${#VAL}"
+fi
+
 echo "Testing die_if_not_set()"
 
 bash -c "source $TOP/functions; X=`echo Y && true`; die_if_not_set $LINENO X 'not OK'"
diff --git a/tools/create_userrc.sh b/tools/create_userrc.sh
index 3325c5e..a7278e4 100755
--- a/tools/create_userrc.sh
+++ b/tools/create_userrc.sh
@@ -7,6 +7,22 @@
 # Warning: This script just for development purposes
 
 set -o errexit
+
+# short_source prints out the current location of the caller in a way
+# that strips redundant directories. This is useful for PS4
+# usage. Needed before we start tracing due to how we set
+# PS4. Normally we'd pick this up from stackrc, but that's not sourced
+# here.
+function short_source {
+    saveIFS=$IFS
+    IFS=" "
+    called=($(caller 0))
+    IFS=$saveIFS
+    file=${called[2]}
+    file=${file#$RC_DIR/}
+    printf "%-40s " "$file:${called[1]}:${called[0]}"
+}
+
 set -o xtrace
 
 ACCOUNT_DIR=./accrc
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index 2a9d813..87660a6 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -11,7 +11,6 @@
 # - if USE_PYTHON3=True, PYTHON3_VERSION refers to a version already installed
 
 set -o errexit
-set -o xtrace
 
 # Keep track of the current directory
 TOOLS_DIR=$(cd $(dirname "$0") && pwd)
@@ -23,6 +22,9 @@
 # Import common functions
 source $TOP_DIR/stackrc
 
+# don't start tracing until after we've sourced the world
+set -o xtrace
+
 FILES=$TOP_DIR/files
 
 PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py