Merge "Add IPv6 support to devstack infrastructure"
diff --git a/README.md b/README.md
index 34e451d..acc3e5a 100644
--- a/README.md
+++ b/README.md
@@ -115,6 +115,16 @@
 
 `mysql` is the default database.
 
+# RPC Backend
+
+Support for a RabbitMQ RPC backend is included. Additional RPC backends may
+be available via external plugins.  Enabling or disabling RabbitMQ is handled
+via the usual service functions and ``ENABLED_SERVICES``.
+
+Example disabling RabbitMQ in ``local.conf``:
+
+    disable_service rabbit
+
 # Apache Frontend
 
 Apache web server can be enabled for wsgi services that support being deployed
@@ -177,7 +187,7 @@
 
 Basic Setup
 
-In order to enable Neutron a single node setup, you'll need the
+In order to enable Neutron in a single node setup, you'll need the
 following settings in your `local.conf`:
 
     disable_service n-net
@@ -187,47 +197,38 @@
     enable_service q-l3
     enable_service q-meta
     enable_service q-metering
-    # Optional, to enable tempest configuration as part of DevStack
-    enable_service tempest
 
 Then run `stack.sh` as normal.
 
 DevStack supports setting specific Neutron configuration flags to the
-service, Open vSwitch plugin and LinuxBridge plugin configuration files.
-To make use of this feature, the settings can be added to ``local.conf``.
-The old ``Q_XXX_EXTRA_XXX_OPTS`` variables are deprecated and will be removed
-in the near future.  The ``local.conf`` headers for the replacements are:
-
-* ``Q_SRV_EXTRA_OPTS``:
+service, ML2 plugin, DHCP and L3 configuration files:
 
     [[post-config|/$Q_PLUGIN_CONF_FILE]]
-    [linuxbridge]   # or [ovs]
-
-Example extra config in `local.conf`:
-
-    [[post-config|/$Q_PLUGIN_CONF_FILE]]
-    [agent]
-    tunnel_type=vxlan
-    vxlan_udp_port=8472
+    [ml2]
+    mechanism_drivers=openvswitch,l2population
 
     [[post-config|$NEUTRON_CONF]]
     [DEFAULT]
-    tenant_network_type=vxlan
+    quota_port=42
 
-DevStack also supports configuring the Neutron ML2 plugin. The ML2 plugin
-can run with the OVS, LinuxBridge, or Hyper-V agents on compute hosts. This
-is a simple way to configure the ml2 plugin:
+    [[post-config|$Q_L3_CONF_FILE]]
+    [DEFAULT]
+    agent_mode=legacy
+
+    [[post-config|$Q_DHCP_CONF_FILE]]
+    [DEFAULT]
+    dnsmasq_dns_servers = 8.8.8.8,8.8.4.4
+
+The ML2 plugin can run with the OVS, LinuxBridge, or Hyper-V agents on compute
+hosts. This is a simple way to configure the ml2 plugin:
 
     # VLAN configuration
-    Q_PLUGIN=ml2
     ENABLE_TENANT_VLANS=True
 
     # GRE tunnel configuration
-    Q_PLUGIN=ml2
     ENABLE_TENANT_TUNNELS=True
 
     # VXLAN tunnel configuration
-    Q_PLUGIN=ml2
     Q_ML2_TENANT_NETWORK_TYPE=vxlan
 
 The above will default in DevStack to using the OVS on each compute host.
diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh
index 04892b0..a0de4cc 100755
--- a/exercises/neutron-adv-test.sh
+++ b/exercises/neutron-adv-test.sh
@@ -19,18 +19,6 @@
 
 set -o errtrace
 
-trap failed ERR
-function failed {
-    local r=$?
-    set +o errtrace
-    set +o xtrace
-    echo "Failed to execute"
-    echo "Starting cleanup..."
-    delete_all
-    echo "Finished cleanup"
-    exit $r
-}
-
 # Print the commands being run so that we can see the command that triggers
 # an error.  It is also useful for following allowing as the install occurs.
 set -o xtrace
@@ -441,6 +429,18 @@
     fi
 }
 
+trap failed ERR
+function failed {
+    local r=$?
+    set +o errtrace
+    set +o xtrace
+    echo "Failed to execute"
+    echo "Starting cleanup..."
+    delete_all
+    echo "Finished cleanup"
+    exit $r
+}
+
 # Kick off script
 # ---------------
 
diff --git a/files/apache-nova-api.template b/files/apache-nova-api.template
index 301a3bd..4908152 100644
--- a/files/apache-nova-api.template
+++ b/files/apache-nova-api.template
@@ -14,3 +14,12 @@
     %SSLCERTFILE%
     %SSLKEYFILE%
 </VirtualHost>
+
+Alias /compute %PUBLICWSGI%
+<Location /compute>
+    SetHandler wsgi-script
+    Options +ExecCGI
+    WSGIProcessGroup nova-api
+    WSGIApplicationGroup %{GLOBAL}
+    WSGIPassAuthorization On
+</Location>
diff --git a/functions-common b/functions-common
index 39c1bfc..e4a3358 100644
--- a/functions-common
+++ b/functions-common
@@ -812,7 +812,7 @@
     # Gets service id
     local service_id=$(
         # Gets service id
-        openstack service show $1 -f value -c id 2>/dev/null ||
+        openstack service show $2 -f value -c id 2>/dev/null ||
         # Creates new service if not exists
         openstack service create \
             $2 \
diff --git a/inc/python b/inc/python
index ca185f0..54e19a7 100644
--- a/inc/python
+++ b/inc/python
@@ -203,7 +203,7 @@
 function is_in_projects_txt {
     local project_dir=$1
     local project_name=$(basename $project_dir)
-    return grep "/$project_name\$" $REQUIREMENTS_DIR/projects.txt >/dev/null
+    grep -q "/$project_name\$" $REQUIREMENTS_DIR/projects.txt
 }
 
 # ``pip install -e`` the package, which processes the dependencies
@@ -238,7 +238,9 @@
     if [ -n "$REQUIREMENTS_DIR" ]; then
         # Constrain this package to this project directory from here on out.
         local name=$(awk '/^name.*=/ {print $3}' $project_dir/setup.cfg)
-        $REQUIREMENTS_DIR/.venv/bin/edit-constraints $REQUIREMENTS_DIR/upper-constraints.txt -- $name "$flags $project_dir"
+        $REQUIREMENTS_DIR/.venv/bin/edit-constraints \
+            $REQUIREMENTS_DIR/upper-constraints.txt -- $name \
+            "$flags file://$project_dir#egg=$name"
     fi
 
     setup_package $project_dir $flags
diff --git a/lib/ceilometer b/lib/ceilometer
index ed9b933..163ed0b 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -360,16 +360,6 @@
     fi
 }
 
-# install_ceilometermiddleware() - Collect source and prepare
-function install_ceilometermiddleware {
-    if use_library_from_git "ceilometermiddleware"; then
-        git_clone_by_name "ceilometermiddleware"
-        setup_dev_lib "ceilometermiddleware"
-    else
-        pip_install_gr ceilometermiddleware
-    fi
-}
-
 # start_ceilometer() - Start running processes, including screen
 function start_ceilometer {
     run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
diff --git a/lib/ceph b/lib/ceph
index cbdc3b8..16dcda2 100644
--- a/lib/ceph
+++ b/lib/ceph
@@ -264,10 +264,6 @@
     sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${GLANCE_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring
     sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring
 
-    # NOTE(eharney): When Glance has fully migrated to Glance store,
-    # default_store can be removed from [DEFAULT].  (See lib/glance.)
-    iniset $GLANCE_API_CONF DEFAULT default_store rbd
-    iniset $GLANCE_API_CONF DEFAULT show_image_direct_url True
     iniset $GLANCE_API_CONF glance_store default_store rbd
     iniset $GLANCE_API_CONF glance_store stores "file, http, rbd"
     iniset $GLANCE_API_CONF glance_store rbd_store_ceph_conf $CEPH_CONF_FILE
diff --git a/lib/neutron_plugins/midonet b/lib/neutron_plugins/midonet
index 9e72aa0..ca0b70c 100644
--- a/lib/neutron_plugins/midonet
+++ b/lib/neutron_plugins/midonet
@@ -1,4 +1,10 @@
 #!/bin/bash
 
-# REVISIT(devvesa): This file is intentionally left empty
-# in order to keep Q_PLUGIN=midonet work.
+# REVISIT(devvesa): This file is needed so Q_PLUGIN=midonet will work.
+
+# FIXME(yamamoto): This function should not be here, but unfortunately
+# devstack calls it before the external plugins are fetched
+function has_neutron_plugin_security_group {
+    # 0 means True here
+    return 0
+}
diff --git a/lib/neutron_plugins/ml2 b/lib/neutron_plugins/ml2
old mode 100644
new mode 100755
index 2733f1f..13ffee9
--- a/lib/neutron_plugins/ml2
+++ b/lib/neutron_plugins/ml2
@@ -107,11 +107,6 @@
         iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
     fi
 
-    if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
-        # Set local_ip if TENANT_TUNNELS are enabled.
-        iniset /$Q_PLUGIN_CONF_FILE ovs local_ip $TUNNEL_ENDPOINT_IP
-    fi
-
     populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2 mechanism_drivers=$Q_ML2_PLUGIN_MECHANISM_DRIVERS
 
     populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2 type_drivers=$Q_ML2_PLUGIN_TYPE_DRIVERS
diff --git a/lib/nova b/lib/nova
index ee74843..5fbce5d 100644
--- a/lib/nova
+++ b/lib/nova
@@ -407,19 +407,25 @@
 
             local nova_service=$(get_or_create_service "nova" \
                 "compute" "Nova Compute Service")
+            local nova_api_url
+            if [[ "$NOVA_USE_MOD_WSGI" == "False" ]]; then
+                nova_api_url="$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT"
+            else
+                nova_api_url="$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST/compute"
+            fi
             get_or_create_endpoint $nova_service \
                 "$REGION_NAME" \
-                "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s" \
-                "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s" \
-                "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s"
+                "$nova_api_url/v2/\$(tenant_id)s" \
+                "$nova_api_url/v2/\$(tenant_id)s" \
+                "$nova_api_url/v2/\$(tenant_id)s"
 
             local nova_v21_service=$(get_or_create_service "novav21" \
                 "computev21" "Nova Compute Service V2.1")
             get_or_create_endpoint $nova_v21_service \
                 "$REGION_NAME" \
-                "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/\$(tenant_id)s" \
-                "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/\$(tenant_id)s" \
-                "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/\$(tenant_id)s"
+                "$nova_api_url/v2.1/\$(tenant_id)s" \
+                "$nova_api_url/v2.1/\$(tenant_id)s" \
+                "$nova_api_url/v2.1/\$(tenant_id)s"
         fi
     fi
 
diff --git a/lib/swift b/lib/swift
index a8c02b3..8147b7a 100644
--- a/lib/swift
+++ b/lib/swift
@@ -698,6 +698,21 @@
     fi
 }
 
+# install_ceilometermiddleware() - Collect source and prepare
+#   note that this doesn't really have anything to do with ceilometer;
+#   though ceilometermiddleware has ceilometer in its name as an
+#   artifact of history, it is not a ceilometer specific tool. It
+#   simply generates pycadf-based notifications about requests and
+#   responses on the swift proxy
+function install_ceilometermiddleware {
+    if use_library_from_git "ceilometermiddleware"; then
+        git_clone_by_name "ceilometermiddleware"
+        setup_dev_lib "ceilometermiddleware"
+    else
+        pip_install_gr ceilometermiddleware
+    fi
+}
+
 # start_swift() - Start running processes, including screen
 function start_swift {
     # (re)start memcached to make sure we have a clean memcache.
diff --git a/stackrc b/stackrc
index 5cacb18..3728813 100644
--- a/stackrc
+++ b/stackrc
@@ -154,7 +154,7 @@
 #
 # - True : use upper-constraints.txt to constrain versions of packages intalled
 #          and do not edit projects at all.
-USE_CONSTRAINTS=${USE_CONSTRAINTS:-False}
+USE_CONSTRAINTS=$(trueorfalse False USE_CONSTRAINTS)
 
 # Repositories
 # ------------
diff --git a/tools/update_clouds_yaml.py b/tools/update_clouds_yaml.py
index 0862135..3a364fe 100755
--- a/tools/update_clouds_yaml.py
+++ b/tools/update_clouds_yaml.py
@@ -43,6 +43,9 @@
                 'project_name': args.os_project_name,
             },
         }
+        if args.os_identity_api_version == '3':
+            self._cloud_data['auth']['user_domain_id'] = 'default'
+            self._cloud_data['auth']['project_domain_id'] = 'default'
         if args.os_cacert:
             self._cloud_data['cacert'] = args.os_cacert