Merge "Silence commands to echo copyright notices"
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index d477c42..9a34c76 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -2,12 +2,14 @@
 #
 # Initial data for Keystone using python-keystoneclient
 #
-# Tenant               User       Roles
+# Tenant               User         Roles
 # ------------------------------------------------------------------
-# service              glance     admin
-# service              heat       service        # if enabled
+# service              glance       service
+# service              glance-swift ResellerAdmin
+# service              heat         service        # if enabled
+# service              ceilometer   admin          # if enabled
 # Tempest Only:
-# alt_demo             alt_demo  Member
+# alt_demo             alt_demo     Member
 #
 # Variables set before calling this script:
 # SERVICE_TOKEN - aka admin_token in keystone.conf
@@ -96,7 +98,19 @@
     keystone user-role-add \
         --tenant $SERVICE_TENANT_NAME \
         --user glance \
-        --role admin
+        --role service
+    # required for swift access
+    if [[ "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
+        keystone user-create \
+            --name=glance-swift \
+            --pass="$SERVICE_PASSWORD" \
+            --tenant $SERVICE_TENANT_NAME \
+            --email=glance-swift@example.com
+        keystone user-role-add \
+            --tenant $SERVICE_TENANT_NAME \
+            --user glance-swift \
+            --role ResellerAdmin
+    fi
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
         keystone service-create \
             --name=glance \
diff --git a/functions b/functions
index 73d65ce..281b676 100644
--- a/functions
+++ b/functions
@@ -1450,7 +1450,7 @@
         # vmdk disk type
         vmdk_create_type="$(head -25 $IMAGE | grep -a -F -m 1 'createType=' $IMAGE)"
         vmdk_create_type="${vmdk_create_type#*\"}"
-        vmdk_create_type="${vmdk_create_type%?}"
+        vmdk_create_type="${vmdk_create_type%\"*}"
 
         descriptor_data_pair_msg="Monolithic flat and VMFS disks "`
                                     `"should use a descriptor-data pair."
@@ -1495,6 +1495,8 @@
                 IMAGE_NAME="${flat_fname}"
             fi
             vmdk_disktype="preallocated"
+        elif [[ "$vmdk_create_type" = "streamOptimized" ]]; then
+            vmdk_disktype="streamOptimized"
         elif [[ -z "$vmdk_create_type" ]]; then
             # *-flat.vmdk provided: attempt to retrieve the descriptor (*.vmdk)
             # to retrieve appropriate metadata
@@ -1533,10 +1535,8 @@
                     vmdk_adapter_type="${vmdk_adapter_type%?}"
                 fi
             fi
-            #TODO(alegendre): handle streamOptimized once supported by the VMware driver.
             vmdk_disktype="preallocated"
         else
-            #TODO(alegendre): handle streamOptimized once supported by the VMware driver.
             vmdk_disktype="preallocated"
         fi
 
diff --git a/lib/ceilometer b/lib/ceilometer
index 30bf3ae..f9c7691 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -105,6 +105,7 @@
 # configure_ceilometerclient() - Set config files, create data dirs, etc
 function configure_ceilometerclient() {
     setup_develop $CEILOMETERCLIENT_DIR
+    sudo install -D -m 0644 -o $STACK_USER {$CEILOMETERCLIENT_DIR/tools/,/etc/bash_completion.d/}ceilometer.bash_completion
 }
 
 # configure_ceilometer() - Set config files, create data dirs, etc
@@ -137,7 +138,9 @@
     iniset $CEILOMETER_CONF DEFAULT os_password $SERVICE_PASSWORD
     iniset $CEILOMETER_CONF DEFAULT os_tenant_name $SERVICE_TENANT_NAME
 
-    iniset $CEILOMETER_CONF keystone_authtoken auth_protocol http
+    iniset $CEILOMETER_CONF keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
+    iniset $CEILOMETER_CONF keystone_authtoken auth_port $KEYSTONE_AUTH_PORT
+    iniset $CEILOMETER_CONF keystone_authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
     iniset $CEILOMETER_CONF keystone_authtoken admin_user ceilometer
     iniset $CEILOMETER_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
     iniset $CEILOMETER_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
diff --git a/lib/glance b/lib/glance
index 2d41ea4..00f499a 100644
--- a/lib/glance
+++ b/lib/glance
@@ -124,7 +124,7 @@
     if is_service_enabled s-proxy; then
         iniset $GLANCE_API_CONF DEFAULT default_store swift
         iniset $GLANCE_API_CONF DEFAULT swift_store_auth_address $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/
-        iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance
+        iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance-swift
         iniset $GLANCE_API_CONF DEFAULT swift_store_key $SERVICE_PASSWORD
         iniset $GLANCE_API_CONF DEFAULT swift_store_create_container_on_put True
 
diff --git a/lib/heat b/lib/heat
index 467619f..f171cb4 100644
--- a/lib/heat
+++ b/lib/heat
@@ -157,6 +157,7 @@
 function install_heatclient() {
     git_clone $HEATCLIENT_REPO $HEATCLIENT_DIR $HEATCLIENT_BRANCH
     setup_develop $HEATCLIENT_DIR
+    sudo install -D -m 0644 -o $STACK_USER {$HEATCLIENT_DIR/tools/,/etc/bash_completion.d/}heat.bash_completion
 }
 
 # install_heat() - Collect source and prepare
diff --git a/lib/nova b/lib/nova
index d5f7514..dbc5c3d 100644
--- a/lib/nova
+++ b/lib/nova
@@ -240,11 +240,6 @@
         sudo sysctl -w net.ipv4.ip_forward=1
 
         if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
-            # When libguestfs is available for file injection, enable using
-            # libguestfs to inspect the image and figure out the proper
-            # partition to inject into.
-            iniset $NOVA_CONF libvirt inject_partition '-1'
-
             # Check for kvm (hardware based virtualization).  If unable to initialize
             # kvm, we drop back to the slower emulation mode (qemu).  Note: many systems
             # come with hardware virtualization disabled in BIOS.
@@ -500,6 +495,12 @@
     iniset $NOVA_CONF DEFAULT ec2_dmz_host "$EC2_DMZ_HOST"
     iniset_rpc_backend nova $NOVA_CONF DEFAULT
     iniset $NOVA_CONF DEFAULT glance_api_servers "$GLANCE_HOSTPORT"
+
+    if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
+        # File injection is being disabled by default in the near future -
+        # disable it here for now to avoid surprises later.
+        iniset $NOVA_CONF libvirt inject_partition '-2'
+    fi
 }
 
 function init_nova_cells() {
diff --git a/lib/nova_plugins/hypervisor-docker b/lib/nova_plugins/hypervisor-docker
index 0153953..bb934b8 100644
--- a/lib/nova_plugins/hypervisor-docker
+++ b/lib/nova_plugins/hypervisor-docker
@@ -31,10 +31,10 @@
 DOCKER_PID_FILE=/var/run/docker.pid
 DOCKER_REGISTRY_PORT=${DOCKER_REGISTRY_PORT:-5042}
 
-DOCKER_IMAGE=${DOCKER_IMAGE:-http://get.docker.io/images/openstack/docker-ut.tar.gz}
-DOCKER_IMAGE_NAME=docker-busybox
-DOCKER_REGISTRY_IMAGE=${DOCKER_REGISTRY_IMAGE:-http://get.docker.io/images/openstack/docker-registry.tar.gz}
-DOCKER_REGISTRY_IMAGE_NAME=docker-registry
+DOCKER_IMAGE=${DOCKER_IMAGE:-busybox:latest}
+DOCKER_IMAGE_NAME=busybox
+DOCKER_REGISTRY_IMAGE=${DOCKER_REGISTRY_IMAGE:-registry:latest}
+DOCKER_REGISTRY_IMAGE_NAME=registry
 DOCKER_REPOSITORY_NAME=${SERVICE_HOST}:${DOCKER_REGISTRY_PORT}/${DOCKER_IMAGE_NAME}
 
 DOCKER_APT_REPO=${DOCKER_APT_REPO:-https://get.docker.io/ubuntu}
diff --git a/tools/bash8.py b/tools/bash8.py
index edf7da4..2623358 100755
--- a/tools/bash8.py
+++ b/tools/bash8.py
@@ -30,8 +30,18 @@
 import re
 import sys
 
-
 ERRORS = 0
+IGNORE = None
+
+
+def register_ignores(ignores):
+    global IGNORE
+    if ignores:
+        IGNORE='^(' + '|'.join(ignores.split(',')) + ')'
+
+
+def should_ignore(error):
+    return IGNORE and re.search(IGNORE, error)
 
 
 def print_error(error, line):
@@ -97,11 +107,13 @@
         description='A bash script style checker')
     parser.add_argument('files', metavar='file', nargs='+',
                         help='files to scan for errors')
+    parser.add_argument('-i', '--ignore', help='Rules to ignore')
     return parser.parse_args()
 
 
 def main():
     opts = get_options()
+    register_ignores(opts.ignore)
     check_files(opts.files)
 
     if ERRORS > 0:
diff --git a/tools/docker/install_docker.sh b/tools/docker/install_docker.sh
index 375cfe9..4fa2386 100755
--- a/tools/docker/install_docker.sh
+++ b/tools/docker/install_docker.sh
@@ -55,21 +55,10 @@
     die $LINENO "docker did not start"
 fi
 
+# Get guest container image
+docker pull $DOCKER_IMAGE
+docker tag $DOCKER_IMAGE $DOCKER_IMAGE_NAME
 
-# Get Docker image
-if [[ ! -r $FILES/docker-ut.tar.gz ]]; then
-    (cd $FILES; curl -OR $DOCKER_IMAGE)
-fi
-if [[ ! -r $FILES/docker-ut.tar.gz ]]; then
-    die $LINENO "Docker image unavailable"
-fi
-docker import - $DOCKER_IMAGE_NAME <$FILES/docker-ut.tar.gz
-
-# Get Docker registry image
-if [[ ! -r $FILES/docker-registry.tar.gz ]]; then
-    (cd $FILES; curl -OR $DOCKER_REGISTRY_IMAGE)
-fi
-if [[ ! -r $FILES/docker-registry.tar.gz ]]; then
-    die $LINENO "Docker registry image unavailable"
-fi
-docker import - $DOCKER_REGISTRY_IMAGE_NAME <$FILES/docker-registry.tar.gz
+# Get docker-registry image
+docker pull $REGISTRY_IMAGE
+docker tag $REGISTRY_IMAGE $REGISTRY_IMAGE_NAME