Merge "Enable CDH and Spark plugin by default in Sahara"
diff --git a/files/rpms/general b/files/rpms/general
index a648214..56a9331 100644
--- a/files/rpms/general
+++ b/files/rpms/general
@@ -27,4 +27,5 @@
 libyaml-devel
 gettext  # used for compiling message catalogs
 net-tools
-java-1.7.0-openjdk-headless  # NOPRIME
+java-1.7.0-openjdk-headless  # NOPRIME rhel7,f20
+java-1.8.0-openjdk-headless  # NOPRIME f21,f22
diff --git a/lib/cinder_backends/lvm b/lib/cinder_backends/lvm
index d83c31a..52fc6fb 100644
--- a/lib/cinder_backends/lvm
+++ b/lib/cinder_backends/lvm
@@ -78,9 +78,9 @@
 
     for pv_info in $(sudo pvs --noheadings -o name,vg_name --separator ';'); do
         echo_summary "Evaluate PV info for Cinder lvm.conf: $pv_info"
-        IFS=';' read pv vg <<< $pv_info
+        IFS=';' read pv vg <<< "$pv_info"
         for line in ${conf_entries}; do
-            IFS='=' read label group <<< $line
+            IFS='=' read label group <<< "$line"
             group=$(echo $group|sed "s/^ *//g")
             if [[ "$vg" == "$group" ]]; then
                 new="\"a$pv/\", "
diff --git a/lib/neutron b/lib/neutron
index 8d27feb..3804e05 100755
--- a/lib/neutron
+++ b/lib/neutron
@@ -538,13 +538,16 @@
         die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
         die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE"
         NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2)
+        die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID"
 
         if [[ "$IP_VERSION" =~ 4.* ]]; then
             SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
+            die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $TENANT_ID"
         fi
 
         if [[ "$IP_VERSION" =~ .*6 ]]; then
             SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2)
+            die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $PROVIDER_SUBNET_NAME_V6 $TENANT_ID"
         fi
 
         sudo ip link set $OVS_PHYSICAL_BRIDGE up
diff --git a/lib/neutron_plugins/midonet b/lib/neutron_plugins/midonet
index 23ad8b2..9e72aa0 100644
--- a/lib/neutron_plugins/midonet
+++ b/lib/neutron_plugins/midonet
@@ -1,100 +1,4 @@
 #!/bin/bash
-#
-# Neutron MidoNet plugin
-# ----------------------
 
-MIDONET_DIR=${MIDONET_DIR:-$DEST/midonet}
-MIDONET_API_PORT=${MIDONET_API_PORT:-8080}
-MIDONET_API_URL=${MIDONET_API_URL:-http://localhost:$MIDONET_API_PORT/midonet-api}
-
-# Save trace setting
-MN_XTRACE=$(set +o | grep xtrace)
-set +o xtrace
-
-function is_neutron_ovs_base_plugin {
-    # MidoNet does not use l3-agent
-    # 0 means True here
-    return 1
-}
-
-function neutron_plugin_create_nova_conf {
-    NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"}
-}
-
-function neutron_plugin_install_agent_packages {
-    :
-}
-
-function neutron_plugin_configure_common {
-    Q_PLUGIN_CONF_PATH=etc/neutron/plugins/midonet
-    Q_PLUGIN_CONF_FILENAME=midonet.ini
-    Q_PLUGIN_CLASS="neutron.plugins.midonet.plugin.MidonetPluginV2"
-
-    # MidoNet implements LBaaS API in the plugin, not as an LBaaS driver.
-    # In this model, the plugin references the 'neutron_lbaas' module but
-    # does not require starting an LBaaS service.  Devstack, however, clones
-    # 'neutron_lbaas' only if 'lbaas' service is enabled.  To get around this,
-    # always clone 'neutron_lbaas' so that it is made available to the plugin.
-    # Also, discontinue if the 'lbaas' service is enabled.
-    if is_service_enabled q-lbaas; then
-        die $LINENO "LBaaS service should be disabled for the MidoNet plugin"
-    fi
-    git_clone $NEUTRON_LBAAS_REPO $NEUTRON_LBAAS_DIR $NEUTRON_LBAAS_BRANCH
-    setup_develop $NEUTRON_LBAAS_DIR
-}
-
-function neutron_plugin_configure_debug_command {
-    :
-}
-
-function neutron_plugin_configure_dhcp_agent {
-    DHCP_DRIVER=${DHCP_DRIVER:-"neutron.plugins.midonet.agent.midonet_driver.DhcpNoOpDriver"}
-    neutron_plugin_setup_interface_driver $Q_DHCP_CONF_FILE
-    iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_driver $DHCP_DRIVER
-    iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces True
-    iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
-}
-
-function neutron_plugin_configure_l3_agent {
-    die $LINENO "q-l3 must not be executed with MidoNet plugin!"
-}
-
-function neutron_plugin_configure_plugin_agent {
-    die $LINENO "q-agt must not be executed with MidoNet plugin!"
-}
-
-function neutron_plugin_configure_service {
-    if [[ "$MIDONET_API_URL" != "" ]]; then
-        iniset /$Q_PLUGIN_CONF_FILE MIDONET midonet_uri $MIDONET_API_URL
-    fi
-    if [[ "$MIDONET_USERNAME" != "" ]]; then
-        iniset /$Q_PLUGIN_CONF_FILE MIDONET username $MIDONET_USERNAME
-    fi
-    if [[ "$MIDONET_PASSWORD" != "" ]]; then
-        iniset /$Q_PLUGIN_CONF_FILE MIDONET password $MIDONET_PASSWORD
-    fi
-    if [[ "$MIDONET_PROJECT_ID" != "" ]]; then
-        iniset /$Q_PLUGIN_CONF_FILE MIDONET project_id $MIDONET_PROJECT_ID
-    fi
-
-    Q_L3_ENABLED=True
-    Q_L3_ROUTER_PER_TENANT=True
-}
-
-function neutron_plugin_setup_interface_driver {
-    local conf_file=$1
-    iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.MidonetInterfaceDriver
-}
-
-function has_neutron_plugin_security_group {
-    # 0 means True here
-    return 0
-}
-
-function neutron_plugin_check_adv_test_requirements {
-    # 0 means True here
-    return 1
-}
-
-# Restore xtrace
-$MN_XTRACE
+# REVISIT(devvesa): This file is intentionally left empty
+# in order to keep Q_PLUGIN=midonet work.
diff --git a/lib/neutron_thirdparty/midonet b/lib/neutron_thirdparty/midonet
deleted file mode 100644
index 2c82d48..0000000
--- a/lib/neutron_thirdparty/midonet
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-#
-# MidoNet
-# -------
-
-# This file implements functions required to configure MidoNet as the third-party
-# system used with devstack's Neutron.  To include this file, specify the following
-# variables in localrc:
-#
-# * enable_service midonet
-#
-
-# MidoNet devstack destination dir
-MIDONET_DIR=${MIDONET_DIR:-$DEST/midonet}
-
-# MidoNet client repo
-MIDONET_CLIENT_REPO=${MIDONET_CLIENT_REPO:-https://github.com/midokura/python-midonetclient.git}
-MIDONET_CLIENT_BRANCH=${MIDONET_CLIENT_BRANCH:-master}
-MIDONET_CLIENT_DIR=${MIDONET_CLIENT_DIR:-$MIDONET_DIR/python-midonetclient}
-
-# Save trace setting
-MN3_XTRACE=$(set +o | grep xtrace)
-set +o xtrace
-
-function configure_midonet {
-    :
-}
-
-function init_midonet {
-    :
-}
-
-function install_midonet {
-    git_clone $MIDONET_CLIENT_REPO $MIDONET_CLIENT_DIR $MIDONET_CLIENT_BRANCH
-    export PYTHONPATH=$MIDONET_CLIENT_DIR/src:$PYTHONPATH
-}
-
-function start_midonet {
-    :
-}
-
-function stop_midonet {
-    :
-}
-
-function check_midonet {
-    :
-}
-
-# Restore xtrace
-$MN3_XTRACE
diff --git a/pkg/elasticsearch.sh b/pkg/elasticsearch.sh
index 15e1b2b..447596a 100755
--- a/pkg/elasticsearch.sh
+++ b/pkg/elasticsearch.sh
@@ -44,7 +44,7 @@
 
 function configure_elasticsearch {
     # currently a no op
-    ::
+    :
 }
 
 function start_elasticsearch {
@@ -78,7 +78,11 @@
         sudo dpkg -i ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.deb
         sudo update-rc.d elasticsearch defaults 95 10
     elif is_fedora; then
-        is_package_installed java-1.7.0-openjdk-headless || install_package java-1.7.0-openjdk-headless
+        if [[ "$os_RELEASE" -ge "21" ]]; then
+            is_package_installed java-1.8.0-openjdk-headless || install_package java-1.8.0-openjdk-headless
+        else
+            is_package_installed java-1.7.0-openjdk-headless || install_package java-1.7.0-openjdk-headless
+        fi
         yum_install ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
         sudo /bin/systemctl daemon-reload
         sudo /bin/systemctl enable elasticsearch.service
diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh
index cc5275f..f8edd16 100755
--- a/tools/fixup_stuff.sh
+++ b/tools/fixup_stuff.sh
@@ -123,3 +123,9 @@
     fi
 
 fi
+
+# The version of pip(1.5.4) supported by python-virtualenv(1.11.4) has
+# connection issues under proxy, hence uninstalling python-virtualenv package
+# and installing the latest version using pip.
+uninstall_package python-virtualenv
+pip_install -U virtualenv
diff --git a/tools/image_list.sh b/tools/image_list.sh
index 0bb49ab..88c1d09 100755
--- a/tools/image_list.sh
+++ b/tools/image_list.sh
@@ -9,6 +9,8 @@
 # dummy in the end position to trigger the fall through case.
 DRIVERS="openvz ironic libvirt vsphere xenserver dummy"
 
+CIRROS_ARCHS="x86_64 i386"
+
 # Extra variables to trigger getting additional images.
 export ENABLED_SERVICES="h-api,tr-api"
 HEAT_FETCHED_TEST_IMAGE="Fedora-i386-20-20131211.1-sda"
@@ -17,12 +19,15 @@
 # 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
+    for arch in $CIRROS_ARCHS; do
+        CIRROS_ARCH=$arch
+        VIRT_DRIVER=$driver
+        URLS=$(source $TOP_DIR/stackrc && echo $IMAGE_URLS)
+        if [[ ! -z "$ALL_IMAGES" ]]; then
+            ALL_IMAGES+=,
+        fi
+        ALL_IMAGES+=$URLS
+    done
 done
 
 # Make a nice list