Merge "Add q-l3 conntrack dependency for ubuntu"
diff --git a/lib/dib b/lib/dib
index 809217b..88d9fd8 100644
--- a/lib/dib
+++ b/lib/dib
@@ -35,15 +35,6 @@
 ORC_DIR=$DEST/os-refresh-config
 OAC_DIR=$DEST/os-apply-config
 
-# Include the apt-sources element in builds if we have an
-# alternative sources.list specified.
-if [ -n "$DIB_APT_SOURCES" ]; then
-    if [ ! -e "$DIB_APT_SOURCES" ]; then
-        die $LINENO "DIB_APT_SOURCES set but not found at $DIB_APT_SOURCES"
-    fi
-    EXTRA_ELEMENTS="apt-sources"
-fi
-
 # Functions
 # ---------
 
@@ -106,6 +97,15 @@
 
     local image_path=$TOP_DIR/files/$image_name.qcow2
 
+    # Include the apt-sources element in builds if we have an
+    # alternative sources.list specified.
+    if [ -n "$DIB_APT_SOURCES" ]; then
+        if [ ! -e "$DIB_APT_SOURCES" ]; then
+            die $LINENO "DIB_APT_SOURCES set but not found at $DIB_APT_SOURCES"
+        fi
+        local extra_elements="apt-sources"
+    fi
+
     # Set the local pip repo as the primary index mirror so the
     # image is built with local packages
     local pypi_mirror_url=http://$SERVICE_HOST:$DIB_PIP_REPO_PORT/
@@ -127,7 +127,7 @@
     DIB_OFFLINE=$DIB_BUILD_OFFLINE \
     PYPI_MIRROR_URL=$pypi_mirror_url \
     PYPI_MIRROR_URL_1=$pypi_mirror_url_1 \
-    disk-image-create -a amd64 $image_elements $EXTRA_ELEMENTS \
+    disk-image-create -a amd64 $image_elements ${extra_elements:-} \
         --image-cache $DIB_IMAGE_CACHE \
         -o $image_path
 
diff --git a/lib/dstat b/lib/dstat
index d1db469..8165e5c 100644
--- a/lib/dstat
+++ b/lib/dstat
@@ -29,7 +29,7 @@
     DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv"
     if [[ -n ${LOGDIR} ]]; then
         screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $LOGDIR/$DSTAT_FILE"
-        if [[ -n ${SCREEN_LOGDIR} ]]; then
+        if [[ -n ${SCREEN_LOGDIR} && ${SCREEN_LOGDIR} != ${LOGDIR} ]]; then
             # Drop the backward-compat symlink
             ln -sf $LOGDIR/$DSTAT_FILE ${SCREEN_LOGDIR}/$DSTAT_FILE
         fi
diff --git a/lib/neutron_plugins/ovs_base b/lib/neutron_plugins/ovs_base
index cde5298..2997c6c 100644
--- a/lib/neutron_plugins/ovs_base
+++ b/lib/neutron_plugins/ovs_base
@@ -28,7 +28,7 @@
 
 function neutron_ovs_base_cleanup {
     # remove all OVS ports that look like Neutron created ports
-    for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do
+    for port in $(sudo ovs-vsctl list port | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do
         sudo ovs-vsctl del-port ${port}
     done
 
diff --git a/lib/rpc_backend b/lib/rpc_backend
index d87d620..981b80b 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -243,7 +243,7 @@
     if is_service_enabled zeromq; then
         iniset $file $section rpc_backend "zmq"
         iniset $file $section rpc_zmq_matchmaker \
-            oslo.messaging._drivers.matchmaker_redis.MatchMakerRedis
+            oslo_messaging._drivers.matchmaker_redis.MatchMakerRedis
         # Set MATCHMAKER_REDIS_HOST if running multi-node.
         MATCHMAKER_REDIS_HOST=${MATCHMAKER_REDIS_HOST:-127.0.0.1}
         iniset $file matchmaker_redis host $MATCHMAKER_REDIS_HOST
@@ -252,7 +252,7 @@
         if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
             iniset $file $section rpc_backend "amqp"
         else
-            iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
+            iniset $file $section rpc_backend "qpid"
         fi
         iniset $file $section qpid_hostname ${QPID_HOST:-$SERVICE_HOST}
         if [ -n "$QPID_USERNAME" ]; then
@@ -260,7 +260,7 @@
             iniset $file $section qpid_password $QPID_PASSWORD
         fi
     elif is_service_enabled rabbit || { [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; }; then
-        iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_kombu
+        iniset $file $section rpc_backend "rabbit"
         iniset $file $section rabbit_hosts $RABBIT_HOST
         iniset $file $section rabbit_password $RABBIT_PASSWORD
         iniset $file $section rabbit_userid $RABBIT_USERID
diff --git a/lib/swift b/lib/swift
index ee4543c..e6e1212 100644
--- a/lib/swift
+++ b/lib/swift
@@ -409,16 +409,27 @@
     # Configure Crossdomain
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:crossdomain use "egg:swift#crossdomain"
 
-    # Configure Keystone
-    sed -i '/^# \[filter:authtoken\]/,/^# \[filter:keystoneauth\]$/ s/^#[ \t]*//' ${SWIFT_CONFIG_PROXY_SERVER}
-    configure_auth_token_middleware ${SWIFT_CONFIG_PROXY_SERVER} swift $SWIFT_AUTH_CACHE_DIR filter:authtoken
+
     # This causes the authtoken middleware to use the same python logging
     # adapter provided by the swift proxy-server, so that request transaction
     # IDs will included in all of its log messages.
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken log_name swift
 
-    iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth use
-    iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles
+    # NOTE(jamielennox): swift cannot use the regular configure_auth_token_middleware function because swift
+    # doesn't use oslo.config which is the only way to configure auth plugins with the middleare.
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken paste.filter_factory keystonemiddleware.auth_token:filter_factory
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken identity_uri $KEYSTONE_AUTH_URI
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken admin_user swift
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken admin_password $SERVICE_PASSWORD
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken auth_uri $KEYSTONE_SERVICE_URI
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken cafile $SSL_BUNDLE_FILE
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken signing_dir $SWIFT_AUTH_CACHE_DIR
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken delay_auth_decision 1
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken cache swift.cache
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken include_service_catalog False
+
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth use "egg:swift#keystoneauth"
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles "Member, admin"
 
     # Configure Tempauth. In the sample config file, Keystoneauth is commented
diff --git a/stack.sh b/stack.sh
index 198a347..cda302f 100755
--- a/stack.sh
+++ b/stack.sh
@@ -895,7 +895,7 @@
     sleep 1
 
     # Set a reasonable status bar
-    SCREEN_HARDSTATUS=${SCREEN_HARDSTATUS-:}
+    SCREEN_HARDSTATUS=${SCREEN_HARDSTATUS:-}
     if [ -z "$SCREEN_HARDSTATUS" ]; then
         SCREEN_HARDSTATUS='%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'
     fi
diff --git a/stackrc b/stackrc
index ff82140..99748ce 100644
--- a/stackrc
+++ b/stackrc
@@ -32,15 +32,11 @@
 # ``disable_service`` functions in ``local.conf``.
 # For example, to enable Swift add this to ``local.conf``:
 #  enable_service s-proxy s-object s-container s-account
-# In order to enable Neutron (a single node setup) add the following
-# settings in ``local.conf``:
+# In order to enable nova-networking add the following settings in
+# `` local.conf ``:
 #  [[local|localrc]]
-#  disable_service n-net
-#  enable_service q-svc
-#  enable_service q-agt
-#  enable_service q-dhcp
-#  enable_service q-l3
-#  enable_service q-meta
+#  disable_service q-svc q-agt q-dhcp q-l3 q-meta
+#  enable_service n-net
 #  # Optional, to enable tempest configuration as part of devstack
 #  enable_service tempest
 function isset {
@@ -54,14 +50,16 @@
 
 # this allows us to pass ENABLED_SERVICES
 if ! isset ENABLED_SERVICES ; then
-    # core compute (glance / keystone / nova (+ nova-network))
-    ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-xvnc,n-cauth
+    # core compute (glance / keystone / nova)
+    ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-xvnc,n-cauth
     # cinder
     ENABLED_SERVICES+=,c-sch,c-api,c-vol
     # heat
     ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
     # dashboard
     ENABLED_SERVICES+=,horizon
+    # neutron
+    ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta
     # additional services
     ENABLED_SERVICES+=,rabbit,tempest,mysql
 fi
diff --git a/tools/xen/build_xva.sh b/tools/xen/build_xva.sh
index 7002e6e..25bf58c 100755
--- a/tools/xen/build_xva.sh
+++ b/tools/xen/build_xva.sh
@@ -104,7 +104,7 @@
 task
 
 pre-start script
-    rm -f /var/run/devstack.succeeded
+    rm -f /opt/stack/runsh.succeeded
 end script
 
 script
@@ -127,7 +127,7 @@
         IPADDR=\$(ip -4 address show eth0 | sed -n 's/.*inet \\([0-9\.]\\+\\).*/\1/p')
         echo "  Management IP:   \$IPADDR"
         echo -n "  Devstack run:    "
-        if [ -e /var/run/devstack.succeeded ]; then
+        if [ -e /opt/stack/runsh.succeeded ]; then
             echo "SUCCEEDED"
         else
             echo "FAILED"