Merge "Set default_network in tempest.conf"
diff --git a/lib/config b/lib/config
index c28072f..1678aec 100644
--- a/lib/config
+++ b/lib/config
@@ -35,7 +35,7 @@
 
     $CONFIG_AWK_CMD -v matchgroup=$matchgroup -v configfile=$configfile '
         BEGIN { group = "" }
-        /^\[\[.+|.*\]\]/ {
+        /^\[\[.+\|.*\]\]/ {
             if (group == "") {
                 gsub("[][]", "", $1);
                 split($1, a, "|");
diff --git a/lib/glance b/lib/glance
index 2e29a8f..b278796 100644
--- a/lib/glance
+++ b/lib/glance
@@ -124,6 +124,8 @@
         iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance
         iniset $GLANCE_API_CONF DEFAULT swift_store_key $SERVICE_PASSWORD
         iniset $GLANCE_API_CONF DEFAULT swift_store_create_container_on_put True
+
+        iniset_multiline DEFAULT known_stores glance.store.filesystem.Store glance.store.http.Store glance.store.swift.Store
     fi
 
     cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
diff --git a/lib/keystone b/lib/keystone
index 712a509..29b9604 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -403,7 +403,7 @@
         screen_it key "cd $KEYSTONE_DIR && sudo tail -f /var/log/$APACHE_NAME/keystone"
     else
         # Start Keystone in a screen window
-        screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
+        screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG --debug"
     fi
 
     echo "Waiting for keystone to start..."
diff --git a/lib/neutron b/lib/neutron
index dbc5843..a7519ad 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -757,6 +757,16 @@
 # Utility Functions
 #------------------
 
+# _neutron_service_plugin_class_add() - add service plugin class
+function _neutron_service_plugin_class_add() {
+    local service_plugin_class=$1
+    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
+        Q_SERVICE_PLUGIN_CLASSES=$service_plugin_class
+    elif [[ ! ,${Q_SERVICE_PLUGIN_CLASSES}, =~ ,${service_plugin_class}, ]]; then
+        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$service_plugin_class"
+    fi
+}
+
 # _neutron_setup_rootwrap() - configure Neutron's rootwrap
 function _neutron_setup_rootwrap() {
     if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
diff --git a/lib/neutron_plugins/ml2 b/lib/neutron_plugins/ml2
index b5b1873..ab4e347 100644
--- a/lib/neutron_plugins/ml2
+++ b/lib/neutron_plugins/ml2
@@ -54,11 +54,7 @@
     Q_PLUGIN_CLASS="neutron.plugins.ml2.plugin.Ml2Plugin"
     # The ML2 plugin delegates L3 routing/NAT functionality to
     # the L3 service plugin which must therefore be specified.
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
-        Q_SERVICE_PLUGIN_CLASSES=$ML2_L3_PLUGIN
-    else
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$ML2_L3_PLUGIN"
-    fi
+    _neutron_service_plugin_class_add $ML2_L3_PLUGIN
 }
 
 function neutron_plugin_configure_service() {
diff --git a/lib/neutron_plugins/services/firewall b/lib/neutron_plugins/services/firewall
index 580071f..8273e54 100644
--- a/lib/neutron_plugins/services/firewall
+++ b/lib/neutron_plugins/services/firewall
@@ -8,11 +8,7 @@
 FWAAS_PLUGIN=neutron.services.firewall.fwaas_plugin.FirewallPlugin
 
 function neutron_fwaas_configure_common() {
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
-        Q_SERVICE_PLUGIN_CLASSES=$FWAAS_PLUGIN
-    else
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$FWAAS_PLUGIN"
-    fi
+    _neutron_service_plugin_class_add $FWAAS_PLUGIN
 }
 
 function neutron_fwaas_configure_driver() {
diff --git a/lib/neutron_plugins/services/loadbalancer b/lib/neutron_plugins/services/loadbalancer
index 2699a9b..5d7a94e 100644
--- a/lib/neutron_plugins/services/loadbalancer
+++ b/lib/neutron_plugins/services/loadbalancer
@@ -19,11 +19,7 @@
 }
 
 function neutron_agent_lbaas_configure_common() {
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
-        Q_SERVICE_PLUGIN_CLASSES=$LBAAS_PLUGIN
-    else
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$LBAAS_PLUGIN"
-    fi
+    _neutron_service_plugin_class_add $LBAAS_PLUGIN
 }
 
 function neutron_agent_lbaas_configure_agent() {
diff --git a/lib/neutron_plugins/services/metering b/lib/neutron_plugins/services/metering
index b105429..37952bb 100644
--- a/lib/neutron_plugins/services/metering
+++ b/lib/neutron_plugins/services/metering
@@ -10,11 +10,7 @@
 METERING_PLUGIN="neutron.services.metering.metering_plugin.MeteringPlugin"
 
 function neutron_agent_metering_configure_common() {
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
-        Q_SERVICE_PLUGIN_CLASSES=$METERING_PLUGIN
-    else
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$METERING_PLUGIN"
-    fi
+    _neutron_service_plugin_class_add $METERING_PLUGIN
 }
 
 function neutron_agent_metering_configure_agent() {
diff --git a/lib/neutron_plugins/services/vpn b/lib/neutron_plugins/services/vpn
index 55d0a76..02370e7 100644
--- a/lib/neutron_plugins/services/vpn
+++ b/lib/neutron_plugins/services/vpn
@@ -15,11 +15,7 @@
 }
 
 function neutron_vpn_configure_common() {
-    if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
-        Q_SERVICE_PLUGIN_CLASSES=$VPN_PLUGIN
-    else
-        Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$VPN_PLUGIN"
-    fi
+    _neutron_service_plugin_class_add $VPN_PLUGIN
 }
 
 function neutron_vpn_stop() {
diff --git a/lib/neutron_thirdparty/trema b/lib/neutron_thirdparty/trema
index 9efd3f6..bdc2356 100644
--- a/lib/neutron_thirdparty/trema
+++ b/lib/neutron_thirdparty/trema
@@ -62,7 +62,7 @@
     sudo sed -i -e "s|/home/sliceable_switch/script|$TREMA_SS_SCRIPT_DIR|" \
         $TREMA_SS_APACHE_CONFIG
     sudo a2enmod rewrite actions
-    sudo a2ensite sliceable_switch
+    sudo a2ensite sliceable_switch.conf
 
     cp $TREMA_SS_DIR/sliceable_switch_null.conf $TREMA_SS_CONFIG
     sed -i -e "s|^\$apps_dir.*$|\$apps_dir = \"$TREMA_DIR/apps\"|" \
diff --git a/lib/swift b/lib/swift
index 3bf2b78..96929db 100644
--- a/lib/swift
+++ b/lib/swift
@@ -378,8 +378,8 @@
         iniuncomment ${swift_node_config} DEFAULT log_facility
         iniset ${swift_node_config} DEFAULT log_facility LOG_LOCAL${log_facility}
 
-        iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers
-        iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers 1
+        iniuncomment ${swift_node_config} DEFAULT workers
+        iniset ${swift_node_config} DEFAULT workers 1
 
         iniuncomment ${swift_node_config} DEFAULT disable_fallocate
         iniset ${swift_node_config} DEFAULT disable_fallocate true
diff --git a/stack.sh b/stack.sh
index ce5fbd4..d54a652 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1104,10 +1104,7 @@
 
 if is_service_enabled q-svc; then
     echo_summary "Starting Neutron"
-
     start_neutron_service_and_check
-    create_neutron_initial_network
-    setup_neutron_debug
 elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then
     NM_CONF=${NOVA_CONF}
     if is_service_enabled n-cell; then
@@ -1127,6 +1124,12 @@
 if is_service_enabled neutron; then
     start_neutron_agents
 fi
+# Once neutron agents are started setup initial network elements
+if is_service_enabled q-svc; then
+    echo_summary "Creating initial neutron network elements"
+    create_neutron_initial_network
+    setup_neutron_debug
+fi
 if is_service_enabled nova; then
     echo_summary "Starting Nova"
     start_nova
diff --git a/stackrc b/stackrc
index e89e64d..695bdb1 100644
--- a/stackrc
+++ b/stackrc
@@ -282,8 +282,9 @@
         IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"};;
 esac
 
+HEAT_FETCHED_TEST_IMAGE=${HEAT_FETCHED_TEST_IMAGE:-""}
 if [[ "$HEAT_FETCHED_TEST_IMAGE" == "Fedora-i386-20-20131211.1-sda" ]]; then
-    IMAGE_URLS+=",https://dl.fedoraproject.org/pub/alt/stage/20-RC1.1/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"
 fi
 
 # 10Gb default volume backing file size
diff --git a/tools/docker/install_docker.sh b/tools/docker/install_docker.sh
index 2e5b510..375cfe9 100755
--- a/tools/docker/install_docker.sh
+++ b/tools/docker/install_docker.sh
@@ -45,7 +45,7 @@
 
 echo "Waiting for docker daemon to start..."
 DOCKER_GROUP=$(groups | cut -d' ' -f1)
-CONFIGURE_CMD="while ! /bin/echo -e 'GET /v1.3/version HTTP/1.0\n\n' | socat - unix-connect:$DOCKER_UNIX_SOCKET | grep -q '200 OK'; do
+CONFIGURE_CMD="while ! /bin/echo -e 'GET /v1.3/version HTTP/1.0\n\n' | socat - unix-connect:$DOCKER_UNIX_SOCKET 2>/dev/null | grep -q '200 OK'; do
     # Set the right group on docker unix socket before retrying
     sudo chgrp $DOCKER_GROUP $DOCKER_UNIX_SOCKET
     sudo chmod g+rw $DOCKER_UNIX_SOCKET
diff --git a/tools/xen/xenrc b/tools/xen/xenrc
index c0ea3bc..cd28234 100644
--- a/tools/xen/xenrc
+++ b/tools/xen/xenrc
@@ -63,8 +63,8 @@
 PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
 
 # Ubuntu install settings
-UBUNTU_INST_RELEASE="precise"
-UBUNTU_INST_TEMPLATE_NAME="Ubuntu 12.04 (64-bit) for DevStack"
+UBUNTU_INST_RELEASE="saucy"
+UBUNTU_INST_TEMPLATE_NAME="Ubuntu 13.10 (64-bit) for DevStack"
 # For 12.04 use "precise" and update template name
 # However, for 12.04, you should be using
 # XenServer 6.1 and later or XCP 1.6 or later