From febcb600f122dc644f8a05c4a7697a39e9157834 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <mrostecki@mirantis.com>
Date: Wed, 18 Nov 2015 07:22:17 +0100
Subject: [PATCH] Source installation in virtualenv

Use virtualenv for installation of OpenStack projects and
dependencies to avoid conflicts with Python libraries installed
by non-OpenStack binary packages.

Change-Id: I21ecd673b2e93335b1d3dd4e279e940c9d694c3c
Implements: blueprint virtualenv
---
 .../roles/cinder/templates/cinder-api.json.j2 |  2 +-
 .../cinder/templates/cinder-backup.json.j2    |  2 +-
 .../cinder/templates/cinder-scheduler.json.j2 |  2 +-
 .../cinder/templates/cinder-volume.json.j2    |  2 +-
 .../roles/glance/templates/glance-api.json.j2 |  2 +-
 .../glance/templates/glance-registry.json.j2  |  2 +-
 .../roles/heat/templates/heat-api-cfn.json.j2 |  2 +-
 ansible/roles/heat/templates/heat-api.json.j2 |  2 +-
 .../roles/heat/templates/heat-engine.json.j2  |  2 +-
 .../roles/horizon/templates/horizon.conf.j2   |  7 +++---
 .../roles/ironic/templates/ironic-api.json.j2 |  2 +-
 .../ironic/templates/ironic-conductor.json.j2 |  2 +-
 .../ironic/templates/ironic-discoverd.json.j2 |  2 +-
 .../keystone/templates/wsgi-keystone.conf.j2  |  5 ++--
 .../roles/magnum/templates/magnum-api.json.j2 |  2 +-
 .../magnum/templates/magnum-conductor.json.j2 |  2 +-
 .../roles/murano/templates/murano-api.json.j2 |  2 +-
 .../murano/templates/murano-engine.json.j2    |  2 +-
 .../neutron-linuxbridge-agent.json.j2         |  2 +-
 .../neutron-openvswitch-agent.json.j2         |  2 +-
 .../neutron/templates/neutron-server.json.j2  |  2 +-
 ansible/roles/nova/templates/nova-api.json.j2 |  2 +-
 .../roles/nova/templates/nova-compute.json.j2 |  2 +-
 .../nova/templates/nova-conductor.json.j2     |  2 +-
 .../nova/templates/nova-consoleauth.json.j2   |  2 +-
 .../roles/nova/templates/nova-network.json.j2 |  2 +-
 .../nova/templates/nova-novncproxy.json.j2    |  2 +-
 .../nova/templates/nova-scheduler.json.j2     |  2 +-
 .../templates/nova-spicehtml5proxy.json.j2    |  2 +-
 .../templates/swift-account-auditor.json.j2   |  2 +-
 .../templates/swift-account-reaper.json.j2    |  2 +-
 .../swift-account-replicator.json.j2          |  2 +-
 .../templates/swift-account-server.json.j2    |  2 +-
 .../templates/swift-container-auditor.json.j2 |  2 +-
 .../swift-container-replicator.json.j2        |  2 +-
 .../templates/swift-container-server.json.j2  |  2 +-
 .../templates/swift-container-updater.json.j2 |  2 +-
 .../templates/swift-object-auditor.json.j2    |  2 +-
 .../templates/swift-object-expirer.json.j2    |  2 +-
 .../templates/swift-object-replicator.json.j2 |  2 +-
 .../templates/swift-object-server.json.j2     |  2 +-
 .../templates/swift-object-updater.json.j2    |  2 +-
 .../templates/swift-proxy-server.json.j2      |  2 +-
 .../ceilometer/ceilometer-base/Dockerfile.j2  |  2 +-
 docker/cinder/cinder-base/Dockerfile.j2       |  2 +-
 docker/designate/designate-base/Dockerfile.j2 |  2 +-
 docker/glance/glance-base/Dockerfile.j2       |  2 +-
 docker/gnocchi/gnocchi-base/Dockerfile.j2     |  2 +-
 docker/heat/heat-base/Dockerfile.j2           |  2 +-
 docker/horizon/Dockerfile.j2                  | 12 ++++-----
 docker/ironic/ironic-base/Dockerfile.j2       |  2 +-
 docker/ironic/ironic-discoverd/Dockerfile.j2  |  2 +-
 docker/keystone/Dockerfile.j2                 |  2 +-
 docker/kolla-ansible/Dockerfile.j2            | 25 ++++++++++++++++---
 docker/magnum/magnum-base/Dockerfile.j2       |  2 +-
 docker/murano/murano-base/Dockerfile.j2       |  2 +-
 .../neutron-dhcp-agent/start.sh               |  2 +-
 .../neutron-agents/neutron-l3-agent/start.sh  |  2 +-
 .../neutron-metadata-agent/start.sh           |  2 +-
 docker/neutron/neutron-base/Dockerfile.j2     |  2 +-
 docker/nova/nova-base/Dockerfile.j2           |  2 +-
 docker/nova/nova-compute/Dockerfile.j2        |  9 ++++---
 docker/openstack-base/Dockerfile.j2           |  6 ++++-
 docker/swift/swift-base/Dockerfile.j2         |  2 +-
 docker/swift/swift-base/build-swift-ring.py   |  6 ++---
 docker/tempest/Dockerfile.j2                  |  2 +-
 docker/zaqar/Dockerfile.j2                    |  2 +-
 67 files changed, 109 insertions(+), 81 deletions(-)

diff --git a/ansible/roles/cinder/templates/cinder-api.json.j2 b/ansible/roles/cinder/templates/cinder-api.json.j2
index 07142fae38..7ffaf6fcaf 100644
--- a/ansible/roles/cinder/templates/cinder-api.json.j2
+++ b/ansible/roles/cinder/templates/cinder-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/cinder-api --config-file /etc/cinder/cinder.conf",
+    "command": "cinder-api --config-file /etc/cinder/cinder.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/cinder.conf",
diff --git a/ansible/roles/cinder/templates/cinder-backup.json.j2 b/ansible/roles/cinder/templates/cinder-backup.json.j2
index 76d9097023..578e4ad801 100644
--- a/ansible/roles/cinder/templates/cinder-backup.json.j2
+++ b/ansible/roles/cinder/templates/cinder-backup.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/cinder-backup --config-file /etc/cinder/cinder.conf",
+    "command": "cinder-backup --config-file /etc/cinder/cinder.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/cinder.conf",
diff --git a/ansible/roles/cinder/templates/cinder-scheduler.json.j2 b/ansible/roles/cinder/templates/cinder-scheduler.json.j2
index ada942eb07..89f521d5a3 100644
--- a/ansible/roles/cinder/templates/cinder-scheduler.json.j2
+++ b/ansible/roles/cinder/templates/cinder-scheduler.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf",
+    "command": "cinder-scheduler --config-file /etc/cinder/cinder.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/cinder.conf",
diff --git a/ansible/roles/cinder/templates/cinder-volume.json.j2 b/ansible/roles/cinder/templates/cinder-volume.json.j2
index f062902468..700ba3f39b 100644
--- a/ansible/roles/cinder/templates/cinder-volume.json.j2
+++ b/ansible/roles/cinder/templates/cinder-volume.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf",
+    "command": "cinder-volume --config-file /etc/cinder/cinder.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/cinder.conf",
diff --git a/ansible/roles/glance/templates/glance-api.json.j2 b/ansible/roles/glance/templates/glance-api.json.j2
index afcedecb8e..755f649c3e 100644
--- a/ansible/roles/glance/templates/glance-api.json.j2
+++ b/ansible/roles/glance/templates/glance-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/glance-api",
+    "command": "glance-api",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/glance-api.conf",
diff --git a/ansible/roles/glance/templates/glance-registry.json.j2 b/ansible/roles/glance/templates/glance-registry.json.j2
index ea752ab008..43d9055b69 100644
--- a/ansible/roles/glance/templates/glance-registry.json.j2
+++ b/ansible/roles/glance/templates/glance-registry.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/glance-registry",
+    "command": "glance-registry",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/glance-registry.conf",
diff --git a/ansible/roles/heat/templates/heat-api-cfn.json.j2 b/ansible/roles/heat/templates/heat-api-cfn.json.j2
index d722e5e5f9..6d10c115fe 100644
--- a/ansible/roles/heat/templates/heat-api-cfn.json.j2
+++ b/ansible/roles/heat/templates/heat-api-cfn.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/heat-api-cfn",
+    "command": "heat-api-cfn",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/heat.conf",
diff --git a/ansible/roles/heat/templates/heat-api.json.j2 b/ansible/roles/heat/templates/heat-api.json.j2
index 04748480e5..495ba4ec29 100644
--- a/ansible/roles/heat/templates/heat-api.json.j2
+++ b/ansible/roles/heat/templates/heat-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/heat-api",
+    "command": "heat-api",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/heat.conf",
diff --git a/ansible/roles/heat/templates/heat-engine.json.j2 b/ansible/roles/heat/templates/heat-engine.json.j2
index 277205a59c..2cdaef3659 100644
--- a/ansible/roles/heat/templates/heat-engine.json.j2
+++ b/ansible/roles/heat/templates/heat-engine.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/heat-engine",
+    "command": "heat-engine",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/heat.conf",
diff --git a/ansible/roles/horizon/templates/horizon.conf.j2 b/ansible/roles/horizon/templates/horizon.conf.j2
index f524694368..53716c6037 100644
--- a/ansible/roles/horizon/templates/horizon.conf.j2
+++ b/ansible/roles/horizon/templates/horizon.conf.j2
@@ -1,4 +1,5 @@
 {% set apache_dir = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
+{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %}
 Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:80
 
 <VirtualHost *:80>
@@ -7,16 +8,16 @@ Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['addr
     CustomLog /var/log/{{ apache_dir }}/horizon-access.log combined
 
     WSGIScriptReloading On
-    WSGIDaemonProcess horizon-http processes=5 threads=1 user=horizon group=horizon display-name=%{GROUP}
+    WSGIDaemonProcess horizon-http processes=5 threads=1 user=horizon group=horizon display-name=%{GROUP} python-path={{ python_path }}
     WSGIProcessGroup horizon-http
-    WSGIScriptAlias / /usr/lib/python2.7/site-packages/openstack_dashboard/wsgi/django.wsgi
+    WSGIScriptAlias / {{ python_path }}/openstack_dashboard/wsgi/django.wsgi
     WSGIPassAuthorization On
 
     <Location "/">
         Require all granted
     </Location>
 
-    Alias /static /usr/lib/python2.7/site-packages/static
+    Alias /static {{ python_path }}/static
     <Location "/static">
         SetHandler None
     </Location>
diff --git a/ansible/roles/ironic/templates/ironic-api.json.j2 b/ansible/roles/ironic/templates/ironic-api.json.j2
index 530f8554b4..621f0e29d4 100644
--- a/ansible/roles/ironic/templates/ironic-api.json.j2
+++ b/ansible/roles/ironic/templates/ironic-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/ironic-api",
+    "command": "ironic-api",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/ironic.conf",
diff --git a/ansible/roles/ironic/templates/ironic-conductor.json.j2 b/ansible/roles/ironic/templates/ironic-conductor.json.j2
index 3b6ef5ff0a..68e5596f68 100644
--- a/ansible/roles/ironic/templates/ironic-conductor.json.j2
+++ b/ansible/roles/ironic/templates/ironic-conductor.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/ironic-conductor",
+    "command": "ironic-conductor",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/ironic.conf",
diff --git a/ansible/roles/ironic/templates/ironic-discoverd.json.j2 b/ansible/roles/ironic/templates/ironic-discoverd.json.j2
index 1af9e54157..8ecc61171d 100644
--- a/ansible/roles/ironic/templates/ironic-discoverd.json.j2
+++ b/ansible/roles/ironic/templates/ironic-discoverd.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/ironic-discoverd --config-file /etc/ironic-discoverd/discoverd.conf",
+    "command": "ironic-discoverd --config-file /etc/ironic-discoverd/discoverd.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/discoverd.conf",
diff --git a/ansible/roles/keystone/templates/wsgi-keystone.conf.j2 b/ansible/roles/keystone/templates/wsgi-keystone.conf.j2
index 875b977efc..464c318236 100644
--- a/ansible/roles/keystone/templates/wsgi-keystone.conf.j2
+++ b/ansible/roles/keystone/templates/wsgi-keystone.conf.j2
@@ -1,9 +1,10 @@
 {% set apache_dir = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
+{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %}
 Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ keystone_public_port }}
 Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ keystone_admin_port }}
 
 <VirtualHost *:{{ keystone_public_port }}>
-    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
+    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP} python-path={{ python_path }}
     WSGIProcessGroup keystone-public
     WSGIScriptAlias / /var/www/cgi-bin/keystone/main
     WSGIApplicationGroup %{GLOBAL}
@@ -16,7 +17,7 @@ Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['addr
 </VirtualHost>
 
 <VirtualHost *:{{ keystone_admin_port }}>
-    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
+    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP} python-path={{ python_path }}
     WSGIProcessGroup keystone-admin
     WSGIScriptAlias / /var/www/cgi-bin/keystone/admin
     WSGIApplicationGroup %{GLOBAL}
diff --git a/ansible/roles/magnum/templates/magnum-api.json.j2 b/ansible/roles/magnum/templates/magnum-api.json.j2
index ac61e2d158..c4af2d218f 100644
--- a/ansible/roles/magnum/templates/magnum-api.json.j2
+++ b/ansible/roles/magnum/templates/magnum-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/magnum-api --config-file /etc/magnum/magnum.conf",
+    "command": "magnum-api --config-file /etc/magnum/magnum.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/magnum.conf",
diff --git a/ansible/roles/magnum/templates/magnum-conductor.json.j2 b/ansible/roles/magnum/templates/magnum-conductor.json.j2
index b1816a178e..179182991f 100644
--- a/ansible/roles/magnum/templates/magnum-conductor.json.j2
+++ b/ansible/roles/magnum/templates/magnum-conductor.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/magnum-conductor --config-file /etc/magnum/magnum.conf",
+    "command": "magnum-conductor --config-file /etc/magnum/magnum.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/magnum.conf",
diff --git a/ansible/roles/murano/templates/murano-api.json.j2 b/ansible/roles/murano/templates/murano-api.json.j2
index 74155d85e4..c67b1ef1f3 100644
--- a/ansible/roles/murano/templates/murano-api.json.j2
+++ b/ansible/roles/murano/templates/murano-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/murano-api --config-file /etc/murano/murano.conf",
+    "command": "murano-api --config-file /etc/murano/murano.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/murano.conf",
diff --git a/ansible/roles/murano/templates/murano-engine.json.j2 b/ansible/roles/murano/templates/murano-engine.json.j2
index 25f2c474ff..a56bc16d42 100644
--- a/ansible/roles/murano/templates/murano-engine.json.j2
+++ b/ansible/roles/murano/templates/murano-engine.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/murano-engine --config-file /etc/murano/murano.conf",
+    "command": "murano-engine --config-file /etc/murano/murano.conf",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/murano.conf",
diff --git a/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2 b/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2
index 1c55a781d9..0da4f5a16a 100644
--- a/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2
+++ b/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/neutron-linuxbridge-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini",
+    "command": "neutron-linuxbridge-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/neutron.conf",
diff --git a/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2 b/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2
index aae90ccd31..36a9a03f76 100644
--- a/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2
+++ b/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini",
+    "command": "neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/neutron.conf",
diff --git a/ansible/roles/neutron/templates/neutron-server.json.j2 b/ansible/roles/neutron/templates/neutron-server.json.j2
index ea476745ed..a57ba3156c 100644
--- a/ansible/roles/neutron/templates/neutron-server.json.j2
+++ b/ansible/roles/neutron/templates/neutron-server.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini",
+    "command": "neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/neutron.conf",
diff --git a/ansible/roles/nova/templates/nova-api.json.j2 b/ansible/roles/nova/templates/nova-api.json.j2
index 1e92b10af1..f9cb27e9af 100644
--- a/ansible/roles/nova/templates/nova-api.json.j2
+++ b/ansible/roles/nova/templates/nova-api.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-api",
+    "command": "nova-api",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-compute.json.j2 b/ansible/roles/nova/templates/nova-compute.json.j2
index 107c160b9e..f3a45f7544 100644
--- a/ansible/roles/nova/templates/nova-compute.json.j2
+++ b/ansible/roles/nova/templates/nova-compute.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-compute",
+    "command": "nova-compute",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-conductor.json.j2 b/ansible/roles/nova/templates/nova-conductor.json.j2
index d612348801..1e214ad8b0 100644
--- a/ansible/roles/nova/templates/nova-conductor.json.j2
+++ b/ansible/roles/nova/templates/nova-conductor.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-conductor",
+    "command": "nova-conductor",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-consoleauth.json.j2 b/ansible/roles/nova/templates/nova-consoleauth.json.j2
index 2956259c41..17837a86de 100644
--- a/ansible/roles/nova/templates/nova-consoleauth.json.j2
+++ b/ansible/roles/nova/templates/nova-consoleauth.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-consoleauth",
+    "command": "nova-consoleauth",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-network.json.j2 b/ansible/roles/nova/templates/nova-network.json.j2
index 2f45ce6edb..53e93e692d 100644
--- a/ansible/roles/nova/templates/nova-network.json.j2
+++ b/ansible/roles/nova/templates/nova-network.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-network",
+    "command": "nova-network",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-novncproxy.json.j2 b/ansible/roles/nova/templates/nova-novncproxy.json.j2
index b801c7472d..e2f98ec05b 100644
--- a/ansible/roles/nova/templates/nova-novncproxy.json.j2
+++ b/ansible/roles/nova/templates/nova-novncproxy.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-novncproxy",
+    "command": "nova-novncproxy",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-scheduler.json.j2 b/ansible/roles/nova/templates/nova-scheduler.json.j2
index 65c6ff2d3c..1a533aaf21 100644
--- a/ansible/roles/nova/templates/nova-scheduler.json.j2
+++ b/ansible/roles/nova/templates/nova-scheduler.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-scheduler",
+    "command": "nova-scheduler",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/nova/templates/nova-spicehtml5proxy.json.j2 b/ansible/roles/nova/templates/nova-spicehtml5proxy.json.j2
index aab421806b..223bb78b08 100644
--- a/ansible/roles/nova/templates/nova-spicehtml5proxy.json.j2
+++ b/ansible/roles/nova/templates/nova-spicehtml5proxy.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/nova-spicehtml5proxy",
+    "command": "nova-spicehtml5proxy",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/nova.conf",
diff --git a/ansible/roles/swift/templates/swift-account-auditor.json.j2 b/ansible/roles/swift/templates/swift-account-auditor.json.j2
index c5bd96776c..490120d717 100644
--- a/ansible/roles/swift/templates/swift-account-auditor.json.j2
+++ b/ansible/roles/swift/templates/swift-account-auditor.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-account-auditor /etc/swift/account-auditor.conf --verbose",
+    "command": "swift-account-auditor /etc/swift/account-auditor.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-account-reaper.json.j2 b/ansible/roles/swift/templates/swift-account-reaper.json.j2
index 2e74084963..4933cee3f8 100644
--- a/ansible/roles/swift/templates/swift-account-reaper.json.j2
+++ b/ansible/roles/swift/templates/swift-account-reaper.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-account-reaper /etc/swift/account-reaper.conf --verbose",
+    "command": "swift-account-reaper /etc/swift/account-reaper.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-account-replicator.json.j2 b/ansible/roles/swift/templates/swift-account-replicator.json.j2
index ca1abbf120..d48121ef6d 100644
--- a/ansible/roles/swift/templates/swift-account-replicator.json.j2
+++ b/ansible/roles/swift/templates/swift-account-replicator.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-account-replicator /etc/swift/account-replicator.conf --verbose",
+    "command": "swift-account-replicator /etc/swift/account-replicator.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-account-server.json.j2 b/ansible/roles/swift/templates/swift-account-server.json.j2
index 140cded881..8f7935df98 100644
--- a/ansible/roles/swift/templates/swift-account-server.json.j2
+++ b/ansible/roles/swift/templates/swift-account-server.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-account-server /etc/swift/account-server.conf --verbose",
+    "command": "swift-account-server /etc/swift/account-server.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-container-auditor.json.j2 b/ansible/roles/swift/templates/swift-container-auditor.json.j2
index d3e4fbe075..a1ed9e3478 100644
--- a/ansible/roles/swift/templates/swift-container-auditor.json.j2
+++ b/ansible/roles/swift/templates/swift-container-auditor.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-container-auditor /etc/swift/container-auditor.conf --verbose",
+    "command": "swift-container-auditor /etc/swift/container-auditor.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-container-replicator.json.j2 b/ansible/roles/swift/templates/swift-container-replicator.json.j2
index 9a61642a0c..98be79be3b 100644
--- a/ansible/roles/swift/templates/swift-container-replicator.json.j2
+++ b/ansible/roles/swift/templates/swift-container-replicator.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-container-replicator /etc/swift/container-replicator.conf --verbose",
+    "command": "swift-container-replicator /etc/swift/container-replicator.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-container-server.json.j2 b/ansible/roles/swift/templates/swift-container-server.json.j2
index 87e6cbc22e..b508ee4fe9 100644
--- a/ansible/roles/swift/templates/swift-container-server.json.j2
+++ b/ansible/roles/swift/templates/swift-container-server.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-container-server /etc/swift/container-server.conf --verbose",
+    "command": "swift-container-server /etc/swift/container-server.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-container-updater.json.j2 b/ansible/roles/swift/templates/swift-container-updater.json.j2
index 9feb3ac1fc..7df0847928 100644
--- a/ansible/roles/swift/templates/swift-container-updater.json.j2
+++ b/ansible/roles/swift/templates/swift-container-updater.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-container-updater /etc/swift/container-updater.conf --verbose",
+    "command": "swift-container-updater /etc/swift/container-updater.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-object-auditor.json.j2 b/ansible/roles/swift/templates/swift-object-auditor.json.j2
index a5058282e3..79df2d51ad 100644
--- a/ansible/roles/swift/templates/swift-object-auditor.json.j2
+++ b/ansible/roles/swift/templates/swift-object-auditor.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-object-auditor /etc/swift/object-auditor.conf --verbose",
+    "command": "swift-object-auditor /etc/swift/object-auditor.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-object-expirer.json.j2 b/ansible/roles/swift/templates/swift-object-expirer.json.j2
index 301fdcf7cb..85c4c77c2c 100644
--- a/ansible/roles/swift/templates/swift-object-expirer.json.j2
+++ b/ansible/roles/swift/templates/swift-object-expirer.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-object-expirer /etc/swift/object-expirer.conf --verbose",
+    "command": "swift-object-expirer /etc/swift/object-expirer.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-object-replicator.json.j2 b/ansible/roles/swift/templates/swift-object-replicator.json.j2
index 2b9f045822..1b11cac50d 100644
--- a/ansible/roles/swift/templates/swift-object-replicator.json.j2
+++ b/ansible/roles/swift/templates/swift-object-replicator.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-object-replicator /etc/swift/object-replicator.conf --verbose",
+    "command": "swift-object-replicator /etc/swift/object-replicator.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-object-server.json.j2 b/ansible/roles/swift/templates/swift-object-server.json.j2
index 4d1df326ff..d49c622098 100644
--- a/ansible/roles/swift/templates/swift-object-server.json.j2
+++ b/ansible/roles/swift/templates/swift-object-server.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-object-server /etc/swift/object-server.conf --verbose",
+    "command": "swift-object-server /etc/swift/object-server.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-object-updater.json.j2 b/ansible/roles/swift/templates/swift-object-updater.json.j2
index 1410f4c4b4..9cabfdbf71 100644
--- a/ansible/roles/swift/templates/swift-object-updater.json.j2
+++ b/ansible/roles/swift/templates/swift-object-updater.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-object-updater /etc/swift/object-updater.conf --verbose",
+    "command": "swift-object-updater /etc/swift/object-updater.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/ansible/roles/swift/templates/swift-proxy-server.json.j2 b/ansible/roles/swift/templates/swift-proxy-server.json.j2
index 52328b724b..1e80afa107 100644
--- a/ansible/roles/swift/templates/swift-proxy-server.json.j2
+++ b/ansible/roles/swift/templates/swift-proxy-server.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/swift-proxy-server /etc/swift/proxy-server.conf --verbose",
+    "command": "swift-proxy-server /etc/swift/proxy-server.conf --verbose",
     "config_files": [
         {
             "source": "/var/lib/kolla/swift/swift.conf",
diff --git a/docker/ceilometer/ceilometer-base/Dockerfile.j2 b/docker/ceilometer/ceilometer-base/Dockerfile.j2
index 964abad973..26386069f5 100644
--- a/docker/ceilometer/ceilometer-base/Dockerfile.j2
+++ b/docker/ceilometer/ceilometer-base/Dockerfile.j2
@@ -15,7 +15,7 @@ RUN yum -y install \
 ADD ceilometer-base-archive /ceilometer-base-source
 RUN ln -s ceilometer-base-source/* ceilometer \
     && useradd --user-group ceilometer \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /ceilometer \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /ceilometer \
     && mkdir -p /etc/ceilometer /var/log/ceilometer /home/ceilometer \
     && cp -r /ceilometer/etc/* /etc/ceilometer/ \
     && chown -R ceilometer: /etc/ceilometer /var/log/ceilometer /home/ceilometer
diff --git a/docker/cinder/cinder-base/Dockerfile.j2 b/docker/cinder/cinder-base/Dockerfile.j2
index 105e46d542..9adae372a0 100644
--- a/docker/cinder/cinder-base/Dockerfile.j2
+++ b/docker/cinder/cinder-base/Dockerfile.j2
@@ -31,7 +31,7 @@ RUN apt-get install -y --no-install-recommends \
 ADD cinder-base-archive /cinder-base-source
 RUN ln -s cinder-base-source/* cinder \
     && useradd --user-group cinder \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /cinder \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /cinder \
     && mkdir -p /etc/cinder /var/log/cinder /home/cinder \
     && cp -r /cinder/etc/cinder/* /etc/cinder/ \
     && chown -R cinder: /etc/cinder /var/log/cinder /home/cinder
diff --git a/docker/designate/designate-base/Dockerfile.j2 b/docker/designate/designate-base/Dockerfile.j2
index 2ddcb22b6c..02a9832275 100644
--- a/docker/designate/designate-base/Dockerfile.j2
+++ b/docker/designate/designate-base/Dockerfile.j2
@@ -23,7 +23,7 @@ RUN yum install -y \
 ADD designate-base-archive /designate-base-source
 RUN ln -s designate-base-source/* designate \
     && useradd --user-group designate \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /designate \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /designate \
     && mkdir -p /etc/designate /var/log/designate /home/designate \
     && cp -r /designate/etc/designate/* /etc/designate/ \
     && chown -R designate: /etc/designate /var/log/designate /home/designate
diff --git a/docker/glance/glance-base/Dockerfile.j2 b/docker/glance/glance-base/Dockerfile.j2
index fa1f628956..91fd39083a 100644
--- a/docker/glance/glance-base/Dockerfile.j2
+++ b/docker/glance/glance-base/Dockerfile.j2
@@ -37,7 +37,7 @@ RUN apt-get install -y --no-install-recommends \
 ADD glance-base-archive /glance-base-source
 RUN ln -s glance-base-source/* glance \
     && useradd --user-group glance \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /glance \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /glance \
     && mkdir -p /etc/glance /var/log/glance /var/lib/glance /home/glance \
     && cp -r /glance/etc/* /etc/glance/ \
     && chown -R glance: /etc/glance /var/log/glance /var/lib/glance /home/glance
diff --git a/docker/gnocchi/gnocchi-base/Dockerfile.j2 b/docker/gnocchi/gnocchi-base/Dockerfile.j2
index 603a568274..93035edee6 100644
--- a/docker/gnocchi/gnocchi-base/Dockerfile.j2
+++ b/docker/gnocchi/gnocchi-base/Dockerfile.j2
@@ -17,7 +17,7 @@ RUN apt-get install -y --no-install-recommends libpq-dev \
 ADD gnocchi-base-archive /gnocchi-base-source
 RUN ln -s gnocchi-base-source/* gnocchi \
     && useradd --user-group gnocchi \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /gnocchi \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /gnocchi \
     && mkdir -p /etc/gnocchi /var/log/gnocchi /home/gnocchi \
     && cp -r /gnocchi/etc/* /etc/gnocchi/ \
     && chown -R gnocchi: /etc/gnocchi /var/log/gnocchi /home/gnocchi
diff --git a/docker/heat/heat-base/Dockerfile.j2 b/docker/heat/heat-base/Dockerfile.j2
index 992051ac5b..7bdfb14836 100644
--- a/docker/heat/heat-base/Dockerfile.j2
+++ b/docker/heat/heat-base/Dockerfile.j2
@@ -14,7 +14,7 @@ RUN yum -y install \
 ADD heat-base-archive /heat-base-source
 RUN ln -s heat-base-source/* heat \
     && useradd --user-group heat \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /heat \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /heat \
     && mkdir -p /etc/heat /var/log/heat /home/heat \
     && cp -r /heat/etc/heat/* /etc/heat/ \
     && chown -R heat: /etc/heat /var/log/heat /home/heat
diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2
index b8e483f419..f9e5a7fab2 100644
--- a/docker/horizon/Dockerfile.j2
+++ b/docker/horizon/Dockerfile.j2
@@ -43,16 +43,16 @@ RUN apt-get install -y --no-install-recommends \
 
 ADD horizon-archive /horizon-source
 RUN ln -s horizon-source/* horizon \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /horizon \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /horizon \
     && useradd --user-group horizon \
     && mkdir -p /etc/openstack-dashboard /home/horizon \
-    && ln -s /etc/openstack-dashboard/local_settings /usr/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py \
+    && ln -s /etc/openstack-dashboard/local_settings /var/lib/kolla/venv/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py \
     && cp -r /horizon/openstack_dashboard/conf/* /etc/openstack-dashboard/ \
     && cp /horizon/openstack_dashboard/local/local_settings.py.example /etc/openstack-dashboard/local_settings \
-    && cp /horizon/manage.py /usr/bin/manage.py \
-    && /usr/bin/python /usr/bin/manage.py collectstatic --noinput --clear \
-    && /usr/bin/python /usr/bin/manage.py compress --force \
-    && chown -R horizon: /etc/openstack-dashboard /home/horizon /usr/lib/python2.7/site-packages/static
+    && cp /horizon/manage.py /var/lib/kolla/venv/bin/manage.py \
+    && /var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py collectstatic --noinput --clear \
+    && /var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py compress --force \
+    && chown -R horizon: /etc/openstack-dashboard /home/horizon /var/lib/kolla/venv/lib/python2.7/site-packages/static
 
 {% endif %}
 
diff --git a/docker/ironic/ironic-base/Dockerfile.j2 b/docker/ironic/ironic-base/Dockerfile.j2
index 109afed564..45f1f97cb7 100644
--- a/docker/ironic/ironic-base/Dockerfile.j2
+++ b/docker/ironic/ironic-base/Dockerfile.j2
@@ -20,7 +20,7 @@ RUN yum -y install \
 ADD ironic-base-archive /ironic-base-source
 RUN ln -s ironic-base-source/* ironic \
     && useradd --user-group ironic \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /ironic \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /ironic \
     && mkdir -p /etc/ironic /var/log/ironic /home/ironic \
     && cp -r /ironic/etc/ironic/* /etc/ironic/ \
     && chown -R ironic: /etc/ironic /var/log/ironic /home/ironic
diff --git a/docker/ironic/ironic-discoverd/Dockerfile.j2 b/docker/ironic/ironic-discoverd/Dockerfile.j2
index 536d2b878b..bf4817a861 100644
--- a/docker/ironic/ironic-discoverd/Dockerfile.j2
+++ b/docker/ironic/ironic-discoverd/Dockerfile.j2
@@ -4,7 +4,7 @@ MAINTAINER {{ maintainer }}
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-RUN pip install ironic-discoverd
+RUN /var/lib/kolla/venv/bin/pip install ironic-discoverd
 # discoverd no longer in delorean 9/28/2015, switch to inspector on TODO
 #RUN yum -y install \
 #    openstack-ironic-discoverd \
diff --git a/docker/keystone/Dockerfile.j2 b/docker/keystone/Dockerfile.j2
index e3e25f3dbe..033385ee6e 100644
--- a/docker/keystone/Dockerfile.j2
+++ b/docker/keystone/Dockerfile.j2
@@ -38,7 +38,7 @@ RUN apt-get install -y --no-install-recommends \
 ADD keystone-archive /keystone-source
 RUN ln -s keystone-source/* keystone \
     && useradd --user-group keystone \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /keystone \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /keystone \
     && mkdir -p /etc/keystone /var/www/cgi-bin/keystone /var/log/apache2 /home/keystone \
     && cp -r /keystone/etc/* /etc/keystone/ \
     && cp /keystone/httpd/keystone.py /var/www/cgi-bin/keystone/admin \
diff --git a/docker/kolla-ansible/Dockerfile.j2 b/docker/kolla-ansible/Dockerfile.j2
index 8d38346629..e25ab520d8 100644
--- a/docker/kolla-ansible/Dockerfile.j2
+++ b/docker/kolla-ansible/Dockerfile.j2
@@ -1,23 +1,42 @@
-FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
+FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
 MAINTAINER {{ maintainer }}
 
 {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
 RUN yum -y install \
         gcc \
+        git \
         libffi-devel \
         libxml2-devel \
         libxslt-devel \
+        mariadb-devel \
+        mariadb-libs \
         openssl-devel \
         python-devel \
         openssh-clients \
     && yum clean all
 
-RUN pip install -U pip wheel
+{% elif base_distro in ['ubuntu', 'debian'] %}
+
+RUN apt-get -y --no-install-recommends install \
+        build-essential \
+        ca-certificates \
+        git \
+        libffi-dev \
+        libmariadbclient-dev \
+        libssl-dev \
+        libxslt1-dev \
+        python-dev \
+    && apt-get clean
 
 {% endif %}
 
-RUN pip --no-cache-dir install \
+RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
+    && python get-pip.py \
+    && rm get-pip.py \
+    && pip install -U wheel \
+    && pip --no-cache-dir install \
+        MySQL-python \
         shade \
         pyudev
 
diff --git a/docker/magnum/magnum-base/Dockerfile.j2 b/docker/magnum/magnum-base/Dockerfile.j2
index c9a60dd23c..c6307c3dd6 100644
--- a/docker/magnum/magnum-base/Dockerfile.j2
+++ b/docker/magnum/magnum-base/Dockerfile.j2
@@ -25,7 +25,7 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
 ADD magnum-base-archive /magnum-base-source
 RUN ln -s magnum-base-source/* magnum \
     && useradd --user-group magnum \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /magnum \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /magnum \
     && mkdir -p /etc/magnum /var/log/magnum /home/magnum \
     && cp -r /magnum/etc/magnum/* /etc/magnum \
     && chown -R magnum: /etc/magnum /var/log/magnum /home/magnum
diff --git a/docker/murano/murano-base/Dockerfile.j2 b/docker/murano/murano-base/Dockerfile.j2
index cf45bfb377..344c16ad8d 100644
--- a/docker/murano/murano-base/Dockerfile.j2
+++ b/docker/murano/murano-base/Dockerfile.j2
@@ -6,7 +6,7 @@ MAINTAINER {{ maintainer }}
 ADD murano-base-archive /murano-base-source
 RUN ln -s murano-base-source/* murano \
     && useradd --user-group murano \
-    && pip --no-cache-dir install /murano \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install /murano \
     && mkdir -p /etc/murano /var/log/murano /home/murano \
     && cp -r /murano/etc/murano/* /etc/murano/ \
     && chown -R murano: /etc/murano /var/log/murano /home/murano
diff --git a/docker/neutron/neutron-agents/neutron-dhcp-agent/start.sh b/docker/neutron/neutron-agents/neutron-dhcp-agent/start.sh
index 474b6a0b48..47c2ee1607 100755
--- a/docker/neutron/neutron-agents/neutron-dhcp-agent/start.sh
+++ b/docker/neutron/neutron-agents/neutron-dhcp-agent/start.sh
@@ -5,7 +5,7 @@ set -o errexit
 source /var/lib/kolla/config-sudoers.sh
 
 # Will be removed when neutron-agents is a thin container
-CMD="/usr/bin/neutron-dhcp-agent"
+CMD="neutron-dhcp-agent"
 ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini"
 
 exec $CMD $ARGS
diff --git a/docker/neutron/neutron-agents/neutron-l3-agent/start.sh b/docker/neutron/neutron-agents/neutron-l3-agent/start.sh
index 0ba99d1fd9..da1b1cc570 100755
--- a/docker/neutron/neutron-agents/neutron-l3-agent/start.sh
+++ b/docker/neutron/neutron-agents/neutron-l3-agent/start.sh
@@ -5,7 +5,7 @@ set -o errexit
 source /var/lib/kolla/config-sudoers.sh
 
 # Will be removed when this container is broken out into thin containers
-CMD="/usr/bin/neutron-l3-agent"
+CMD="neutron-l3-agent"
 ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini --config-file /etc/neutron/plugins/ml2/ml2_conf.ini"
 
 exec $CMD $ARGS
diff --git a/docker/neutron/neutron-agents/neutron-metadata-agent/start.sh b/docker/neutron/neutron-agents/neutron-metadata-agent/start.sh
index 8a0b5e9382..9464a5196c 100755
--- a/docker/neutron/neutron-agents/neutron-metadata-agent/start.sh
+++ b/docker/neutron/neutron-agents/neutron-metadata-agent/start.sh
@@ -5,7 +5,7 @@ set -o errexit
 source /var/lib/kolla/config-sudoers.sh
 
 # Will be removed when this container is broken out in thin containers
-CMD="/usr/bin/neutron-metadata-agent"
+CMD="neutron-metadata-agent"
 ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini"
 
 exec $CMD $ARGS
diff --git a/docker/neutron/neutron-base/Dockerfile.j2 b/docker/neutron/neutron-base/Dockerfile.j2
index d0c02728a7..a13d3114d5 100644
--- a/docker/neutron/neutron-base/Dockerfile.j2
+++ b/docker/neutron/neutron-base/Dockerfile.j2
@@ -39,7 +39,7 @@ RUN apt-get install -y --no-install-recommends \
 ADD neutron-base-archive /neutron-base-source
 RUN ln -s neutron-base-source/* neutron \
     && useradd --user-group neutron \
-    && pip --no-cache-dir install /neutron \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install /neutron \
     && mkdir -p /etc/neutron /usr/share/neutron /var/log/neutron /home/neutron \
     && cp -r /neutron/etc/* /etc/neutron/ \
     && cp -r /neutron/etc/neutron/* /etc/neutron/ \
diff --git a/docker/nova/nova-base/Dockerfile.j2 b/docker/nova/nova-base/Dockerfile.j2
index baeda40259..4b2fea8b43 100644
--- a/docker/nova/nova-base/Dockerfile.j2
+++ b/docker/nova/nova-base/Dockerfile.j2
@@ -36,7 +36,7 @@ RUN apt-get install -y --no-install-recommends \
 ADD nova-base-archive /nova-base-source
 RUN ln -s nova-base-source/* nova \
     && useradd --user-group nova \
-    && pip --no-cache-dir install /nova \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install /nova \
     && mkdir -p /etc/nova /var/log/nova /home/nova \
     && cp -r /nova/etc/nova/* /etc/nova/ \
     && chown -R nova: /etc/nova /var/log/nova /home/nova
diff --git a/docker/nova/nova-compute/Dockerfile.j2 b/docker/nova/nova-compute/Dockerfile.j2
index 41b2e01838..90dd8de2e9 100644
--- a/docker/nova/nova-compute/Dockerfile.j2
+++ b/docker/nova/nova-compute/Dockerfile.j2
@@ -15,9 +15,8 @@ RUN yum -y install \
 {% elif install_type == 'source' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-RUN pip uninstall -y requests \
-    && yum -y install \
-        libvirt-python \
+RUN yum -y install \
+        libvirt-devel \
         openvswitch \
         qemu-img \
         sysfsutils \
@@ -27,12 +26,16 @@ RUN pip uninstall -y requests \
     {% elif base_distro in ['ubuntu', 'debian'] %}
 
 RUN apt-get install -y --no-install-recommends \
+        libvirt-dev \
         qemu-utils \
         ceph-common \
     && apt-get clean \
     && mkdir -p /etc/ceph
 
     {% endif %}
+
+RUN /var/lib/kolla/venv/bin/pip install --no-cache-dir libvirt-python
+
 {% endif %}
 
 {{ include_footer }}
diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2
index 1db7eb011d..900fc3b4dd 100644
--- a/docker/openstack-base/Dockerfile.j2
+++ b/docker/openstack-base/Dockerfile.j2
@@ -74,10 +74,13 @@ RUN apt-get install -y --no-install-recommends \
 
 ADD openstack-base-archive /openstack-base-source
 RUN ln -s openstack-base-source/* /requirements \
+    && mkdir /var/lib/kolla \
     && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
     && python get-pip.py \
     && rm get-pip.py \
-    && pip --no-cache-dir install -U -c requirements/upper-constraints.txt \
+    && pip install -U virtualenv \
+    && virtualenv /var/lib/kolla/venv \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -U -c requirements/upper-constraints.txt \
         python-barbicanclient \
         python-ceilometerclient \
         python-congressclient \
@@ -96,5 +99,6 @@ RUN ln -s openstack-base-source/* /requirements \
         python-openstackclient \
         MySQL-python \
         python-memcached
+ENV PATH /var/lib/kolla/venv/bin:$PATH
 
 {% endif %}
diff --git a/docker/swift/swift-base/Dockerfile.j2 b/docker/swift/swift-base/Dockerfile.j2
index e48bcc7f69..d6afb2b24a 100644
--- a/docker/swift/swift-base/Dockerfile.j2
+++ b/docker/swift/swift-base/Dockerfile.j2
@@ -13,7 +13,7 @@ RUN yum -y install openstack-swift \
 ADD swift-base-archive /swift-base-source
 RUN ln -s swift-base-source/* swift \
     && useradd --user-group swift \
-    && pip --no-cache-dir install /swift \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install /swift \
     && mkdir -p /etc/swift /var/log/swift /home/swift \
     && cp -r /swift/etc/* /etc/swift/ \
     && chown -R swift: /etc/swift /var/log/swift /home/swift
diff --git a/docker/swift/swift-base/build-swift-ring.py b/docker/swift/swift-base/build-swift-ring.py
index d7386392d9..af20af7e68 100644
--- a/docker/swift/swift-base/build-swift-ring.py
+++ b/docker/swift/swift-base/build-swift-ring.py
@@ -67,7 +67,7 @@ def run(args):
               'and zones are required')
         sys.exit(1)
 
-    run_cmd(['/usr/bin/swift-ring-builder',
+    run_cmd(['swift-ring-builder',
              args.ring_file,
              'create',
              args.part_power,
@@ -75,13 +75,13 @@ def run(args):
              args.min_part_hours])
 
     for i in xrange(len(hosts)):
-        run_cmd(['/usr/bin/swift-ring-builder',
+        run_cmd(['swift-ring-builder',
                  args.ring_file,
                  'add',
                  'z{}-{}/{}'.format(zones[i], hosts[i], devices[i]),
                  weights[i]])
 
-    run_cmd(['/usr/bin/swift-ring-builder', args.ring_file, 'rebalance'])
+    run_cmd(['swift-ring-builder', args.ring_file, 'rebalance'])
 
 
 def main():
diff --git a/docker/tempest/Dockerfile.j2 b/docker/tempest/Dockerfile.j2
index f8330f217d..d194e25ee1 100644
--- a/docker/tempest/Dockerfile.j2
+++ b/docker/tempest/Dockerfile.j2
@@ -13,7 +13,7 @@ RUN yum -y install \
 
 ADD tempest-archive /tempest-source
 RUN ln -s tempest-source/* tempest \
-    && pip --no-cache-dir install -c requirements/upper-constraints.txt /tempest \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install -c requirements/upper-constraints.txt /tempest \
     && mkdir -p /etc/tempest /var/log/tempest /etc/tempest/tempest_lock
 
 {% endif %}
diff --git a/docker/zaqar/Dockerfile.j2 b/docker/zaqar/Dockerfile.j2
index d058818333..796119e57d 100644
--- a/docker/zaqar/Dockerfile.j2
+++ b/docker/zaqar/Dockerfile.j2
@@ -13,7 +13,7 @@ RUN yum -y install openstack-zaqar \
 ADD zaqar-archive /zaqar-source
 RUN ln -s zaqar-source/* zaqar \
     && useradd --user-group zaqar \
-    && pip --no-cache-dir install /zaqar \
+    && /var/lib/kolla/venv/bin/pip --no-cache-dir install /zaqar \
     && mkdir -p /etc/zaqar /var/log/zaqar /home/zaqar \
     && cp -r /zaqar/etc/* /etc/zaqar/ \
     && chown -R zaqar: /etc/zaqar /var/log/zaqar /home/zaqar