Merge "Add python-dev to general requirements"
diff --git a/clean.sh b/clean.sh
index f3b2a99..3707d84 100755
--- a/clean.sh
+++ b/clean.sh
@@ -40,6 +40,7 @@
 
 source $TOP_DIR/lib/tls
 
+source $TOP_DIR/lib/oslo
 source $TOP_DIR/lib/horizon
 source $TOP_DIR/lib/keystone
 source $TOP_DIR/lib/glance
@@ -83,6 +84,7 @@
 fi
 
 # Clean projects
+cleanup_oslo
 cleanup_cinder
 cleanup_glance
 cleanup_keystone
diff --git a/driver_certs/cinder_driver_cert.sh b/driver_certs/cinder_driver_cert.sh
index d2c636f..7726e7e 100755
--- a/driver_certs/cinder_driver_cert.sh
+++ b/driver_certs/cinder_driver_cert.sh
@@ -19,6 +19,8 @@
 #
 #     SCREEN_LOGDIR=/opt/stack/screen-logs
 
+set -o pipefail
+
 CERT_DIR=$(cd $(dirname "$0") && pwd)
 TOP_DIR=$(cd $CERT_DIR/..; pwd)
 
diff --git a/lib/nova_plugins/hypervisor-xenserver b/lib/nova_plugins/hypervisor-xenserver
index 10bda2c..c37969b 100644
--- a/lib/nova_plugins/hypervisor-xenserver
+++ b/lib/nova_plugins/hypervisor-xenserver
@@ -63,9 +63,13 @@
     local ssh_dom0
     ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip"
 
+    # Find where the plugins should go in dom0
+    xen_functions=`cat $TOP_DIR/tools/xen/functions`
+    PLUGIN_DIR=`$ssh_dom0 "$xen_functions; set -eux; xapi_plugin_location"`
+
     # install nova plugins to dom0
     tar -czf - -C $NOVA_DIR/plugins/xenserver/xenapi/etc/xapi.d/plugins/ ./ |
-        $ssh_dom0 'tar -xzf - -C /etc/xapi.d/plugins/ && chmod a+x /etc/xapi.d/plugins/*'
+        $ssh_dom0 "tar -xzf - -C $PLUGIN_DIR && chmod a+x $PLUGIN_DIR/*"
 
     # install console logrotate script
     tar -czf - -C $NOVA_DIR/tools/xenserver/ rotate_xen_guest_logs.sh |
diff --git a/lib/oslo b/lib/oslo
index 2e1f6bf..3cf7218 100644
--- a/lib/oslo
+++ b/lib/oslo
@@ -34,6 +34,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 $CLIFF_REPO $CLIFF_DIR $CLIFF_BRANCH
     setup_install $CLIFF_DIR
 
@@ -59,6 +63,17 @@
     setup_install $TASKFLOW_DIR
 }
 
+# cleanup_oslo() - purge possibly old versions of oslo
+function cleanup_oslo {
+    # this means we've got an old oslo installed, lets get rid of it
+    if ! python -c 'import oslo.config' 2>/dev/null; then
+        echo "Found old oslo.config... removing to ensure consistency"
+        local PIP_CMD=$(get_pip_command)
+        pip_install oslo.config
+        sudo $PIP_CMD uninstall -y oslo.config
+    fi
+}
+
 # Restore xtrace
 $XTRACE