Merge "Devstack support for Neutron VPNaaS"
diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh
index 0a24fe9..6679670 100755
--- a/exercises/neutron-adv-test.sh
+++ b/exercises/neutron-adv-test.sh
@@ -100,15 +100,6 @@
 DEMO1_ROUTER1_NET="demo1-net1"
 DEMO2_ROUTER1_NET="demo2-net1"
 
-KEYSTONE="keystone"
-
-# Manually create a token by querying keystone (sending JSON data).  Keystone
-# returns a token and catalog of endpoints.  We use python to parse the token
-# and save it.
-
-TOKEN=`keystone token-get | grep ' id ' | awk '{print $4}'`
-die_if_not_set $LINENO TOKEN "Keystone fail to get token"
-
 # Various functions
 # -----------------
 
@@ -150,21 +141,21 @@
 
 function get_tenant_id {
     local TENANT_NAME=$1
-    local TENANT_ID=`keystone tenant-list | grep " $TENANT_NAME " | head -n 1 | get_field 1`
+    local TENANT_ID=`openstack project list | grep " $TENANT_NAME " | head -n 1 | get_field 1`
     die_if_not_set $LINENO TENANT_ID "Failure retrieving TENANT_ID for $TENANT_NAME"
     echo "$TENANT_ID"
 }
 
 function get_user_id {
     local USER_NAME=$1
-    local USER_ID=`keystone user-list | grep $USER_NAME | awk '{print $2}'`
+    local USER_ID=`openstack user list | grep $USER_NAME | awk '{print $2}'`
     die_if_not_set $LINENO USER_ID "Failure retrieving USER_ID for $USER_NAME"
     echo "$USER_ID"
 }
 
 function get_role_id {
     local ROLE_NAME=$1
-    local ROLE_ID=`keystone role-list | grep $ROLE_NAME | awk '{print $2}'`
+    local ROLE_ID=`openstack role list | grep $ROLE_NAME | awk '{print $2}'`
     die_if_not_set $LINENO ROLE_ID "Failure retrieving ROLE_ID for $ROLE_NAME"
     echo "$ROLE_ID"
 }
@@ -199,28 +190,21 @@
 }
 
 function add_tenant {
-    local TENANT=$1
-    local USER=$2
-
-    $KEYSTONE tenant-create --name=$TENANT
-    $KEYSTONE user-create --name=$USER --pass=${ADMIN_PASSWORD}
-
-    local USER_ID=$(get_user_id $USER)
-    local TENANT_ID=$(get_tenant_id $TENANT)
-
-    $KEYSTONE user-role-add --user-id $USER_ID --role-id $(get_role_id Member) --tenant-id $TENANT_ID
+    openstack project create $1
+    openstack user create $2 --password ${ADMIN_PASSWORD} --project $1
+    openstack role add Member --project $1 --user $2
 }
 
 function remove_tenant {
     local TENANT=$1
     local TENANT_ID=$(get_tenant_id $TENANT)
-    $KEYSTONE tenant-delete $TENANT_ID
+    openstack project delete $TENANT_ID
 }
 
 function remove_user {
     local USER=$1
     local USER_ID=$(get_user_id $USER)
-    $KEYSTONE user-delete $USER_ID
+    openstack user delete $USER_ID
 }
 
 function create_tenants {
diff --git a/files/apts/n-api b/files/apts/n-api
index e0e5e7f..b4372d9 100644
--- a/files/apts/n-api
+++ b/files/apts/n-api
@@ -1,2 +1,3 @@
 python-dateutil
 msgpack-python
+fping
diff --git a/files/rpms-suse/n-api b/files/rpms-suse/n-api
index 0f08daa..6f59e60 100644
--- a/files/rpms-suse/n-api
+++ b/files/rpms-suse/n-api
@@ -1 +1,2 @@
 python-dateutil
+fping
diff --git a/files/rpms/horizon b/files/rpms/horizon
index 2dd24e0..38d349d 100644
--- a/files/rpms/horizon
+++ b/files/rpms/horizon
@@ -1,5 +1,4 @@
 Django
-django-registration
 gcc
 httpd # NOPRIME
 mod_wsgi  # NOPRIME
diff --git a/files/rpms/n-api b/files/rpms/n-api
index 0f08daa..6f59e60 100644
--- a/files/rpms/n-api
+++ b/files/rpms/n-api
@@ -1 +1,2 @@
 python-dateutil
+fping
diff --git a/lib/cinder b/lib/cinder
index dd2956a..dadbe40 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -274,6 +274,10 @@
     iniset $CINDER_CONF DEFAULT lock_path $CINDER_STATE_PATH
     iniset $CINDER_CONF DEFAULT periodic_interval $CINDER_PERIODIC_INTERVAL
 
+    if is_service_enabled swift; then
+        iniset $CINDER_CONF DEFAULT backup_swift_url "http://$SERVICE_HOST:8080/v1/AUTH_"
+    fi
+
     if is_service_enabled ceilometer; then
         iniset $CINDER_CONF DEFAULT notification_driver "cinder.openstack.common.notifier.rpc_notifier"
     fi
diff --git a/lib/heat b/lib/heat
index f66f0a8..26d58e0 100644
--- a/lib/heat
+++ b/lib/heat
@@ -96,7 +96,7 @@
     iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1/waitcondition
     iniset $HEAT_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST:$HEAT_API_CW_PORT
     iniset $HEAT_CONF database connection `database_connection_url heat`
-    iniset $HEAT_CONF DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/random`
+    iniset $HEAT_CONF DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/urandom`
 
     # logging
     iniset $HEAT_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
diff --git a/lib/horizon b/lib/horizon
index 27c2d26..90a2bc5 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -114,11 +114,9 @@
 
     local horizon_conf=/etc/$APACHE_NAME/$APACHE_CONF_DIR/horizon.conf
     if is_ubuntu; then
-        # Clean up the old config name
-        sudo rm -f /etc/apache2/sites-enabled/000-default
-        # Be a good citizen and use the distro tools here
+        disable_apache_site 000-default
         sudo touch $horizon_conf
-        sudo a2ensite horizon.conf
+        enable_apache_site horizon.conf
     elif is_fedora; then
         sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
     elif is_suse; then
diff --git a/lib/neutron b/lib/neutron
index f110d9e..f4a7f38 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -274,7 +274,7 @@
     if is_service_enabled q-fwaas; then
         _configure_neutron_fwaas
     fi
-    if is_service_enabled q-svc; then
+    if is_service_enabled q-agt q-svc; then
         _configure_neutron_service
     fi
     if is_service_enabled q-agt; then
diff --git a/lib/tempest b/lib/tempest
index a4558ce..ebee315 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -153,6 +153,7 @@
     # user and tenant are set up...
     ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
     ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
+    ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
     TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
     TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
     ALT_USERNAME=${ALT_USERNAME:-alt_demo}
@@ -267,6 +268,7 @@
     iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
     iniset $TEMPEST_CONFIG identity admin_password "$password"
     iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
+    iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
     iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
 
     # Image
@@ -321,11 +323,8 @@
     iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
 
     # Orchestration test image
-    if [[ ! -z "$HEAT_FETCHED_TEST_IMAGE" ]]; then
-        iniset $TEMPEST_CONFIG orchestration image_ref "$HEAT_FETCHED_TEST_IMAGE"
-    elif [[ "$HEAT_CREATE_TEST_IMAGE" = "True" ]]; then
-        disk_image_create /usr/share/tripleo-image-elements "vm fedora heat-cfntools" "i386" "fedora-vm-heat-cfntools-tempest"
-        iniset $TEMPEST_CONFIG orchestration image_ref "fedora-vm-heat-cfntools-tempest"
+    if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
+        iniset $TEMPEST_CONFIG orchestration image_ref $(basename "$HEAT_CFN_IMAGE_URL" ".qcow2")
     fi
 
     # Scenario
diff --git a/stack.sh b/stack.sh
index c715a85..983a6bf 100755
--- a/stack.sh
+++ b/stack.sh
@@ -425,7 +425,7 @@
 
 # Rabbit connection info
 if is_service_enabled rabbit; then
-    RABBIT_HOST=${RABBIT_HOST:-localhost}
+    RABBIT_HOST=${RABBIT_HOST:-$SERVICE_HOST}
     read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
 fi
 
diff --git a/stackrc b/stackrc
index 4418be1..8320c9b 100644
--- a/stackrc
+++ b/stackrc
@@ -341,11 +341,23 @@
         IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"};;
 esac
 
+# if heat is enabled, bring in a linux image with cfn enabled
+# TODO(sdague) this next block can be removed after nodepool has the 64bit image in it's cache
 HEAT_FETCHED_TEST_IMAGE=${HEAT_FETCHED_TEST_IMAGE:-""}
 if [[ "$HEAT_FETCHED_TEST_IMAGE" == "Fedora-i386-20-20131211.1-sda" ]]; then
+    HEAT_CFN_IMAGE_URL="https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Images/i386/$HEAT_FETCHED_TEST_IMAGE.qcow2"
     IMAGE_URLS+=",https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Images/i386/$HEAT_FETCHED_TEST_IMAGE.qcow2"
+elif [[ "$HEAT_FETCHED_TEST_IMAGE" == "Fedora-x86_64-20-20131211.1-sda" ]]; then
+    HEAT_CFN_IMAGE_URL="https://download.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2"
+    IMAGE_URLS+=",https://download.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2"
 fi
 
+# Uncomment after nodepool changes land
+#if [[ "$ENABLED_SERVICES" =~ 'h-api' ]]; then
+#    HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"https://download.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2"}
+#    IMAGE_URLS+=",$HEAT_CFN_IMAGE_URL"
+#fi
+
 # 10Gb default volume backing file size
 VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-10250M}
 
diff --git a/tools/build_docs.sh b/tools/build_docs.sh
index c566e63..384b1fa 100755
--- a/tools/build_docs.sh
+++ b/tools/build_docs.sh
@@ -22,7 +22,7 @@
 # --------
 
 # Source repo/branch for DevStack
-MASTER_REPO=${MASTER_REPO:-https://github.com/openstack-dev/devstack.git}
+MASTER_REPO=${MASTER_REPO:-git://git.openstack.org/openstack-dev/devstack}
 MASTER_BRANCH=${MASTER_BRANCH:-master}
 
 # http://devstack.org is a GitHub gh-pages site in the https://github.com/cloudbuilders/devtack.git repo
diff --git a/tools/image_list.sh b/tools/image_list.sh
new file mode 100755
index 0000000..fa6b92e
--- /dev/null
+++ b/tools/image_list.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Keep track of the devstack directory
+TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
+
+source $TOP_DIR/functions
+
+# Possible virt drivers, if we have more, add them here. Always keep
+# dummy in the end position to trigger the fall through case.
+DRIVERS="openvz ironic libvirt vsphere xenserver dummy"
+
+# Extra variables to trigger getting additional images.
+ENABLED_SERVICES=h-api
+HEAT_FETCHED_TEST_IMAGE="Fedora-i386-20-20131211.1-sda"
+
+# Loop over all the virt drivers and collect all the possible images
+ALL_IMAGES=""
+for driver in $DRIVERS; do
+    VIRT_DRIVER=$driver
+    URLS=$(source $TOP_DIR/stackrc && echo $IMAGE_URLS)
+    if [[ ! -z "$ALL_IMAGES" ]]; then
+        ALL_IMAGES+=,
+    fi
+    ALL_IMAGES+=$URLS
+done
+
+# Make a nice list
+echo $ALL_IMAGES | tr ',' '\n' | sort | uniq
+
+# Sanity check - ensure we have a minimum number of images
+num=$(echo $ALL_IMAGES | tr ',' '\n' | sort | uniq | wc -l)
+if [[ "$num" -lt 5 ]]; then
+    echo "ERROR: We only found $num images in $ALL_IMAGES, which can't be right."
+    exit 1
+fi