Merge "Use daemon flag only when USE_SCREEN=False"
diff --git a/files/apts/baremetal b/files/apts/baremetal
index 54e76e0..06ffab6 100644
--- a/files/apts/baremetal
+++ b/files/apts/baremetal
@@ -1,6 +1,5 @@
 busybox
 dnsmasq
-gcc
 ipmitool
 make
 open-iscsi
diff --git a/files/apts/general b/files/apts/general
index 020d84f..d81ec7a 100644
--- a/files/apts/general
+++ b/files/apts/general
@@ -5,6 +5,7 @@
 unzip
 wget
 psmisc
+gcc
 git
 lsof # useful when debugging
 openssh-server
diff --git a/files/apts/glance b/files/apts/glance
index e80f447..b5d8c77 100644
--- a/files/apts/glance
+++ b/files/apts/glance
@@ -1,4 +1,3 @@
-gcc
 libffi-dev
 libmysqlclient-dev  # testonly
 libpq-dev           # testonly
diff --git a/files/apts/swift b/files/apts/swift
index 0c27b5b..080ecdb 100644
--- a/files/apts/swift
+++ b/files/apts/swift
@@ -1,5 +1,4 @@
 curl
-gcc
 libffi-dev
 memcached
 python-configobj
diff --git a/files/apts/trema b/files/apts/trema
index 09cb7c6..f685ca5 100644
--- a/files/apts/trema
+++ b/files/apts/trema
@@ -1,5 +1,4 @@
 # Trema
-gcc
 make
 ruby1.8
 rubygems1.8
diff --git a/files/rpms-suse/general b/files/rpms-suse/general
index ff27a3a..82cb09d 100644
--- a/files/rpms-suse/general
+++ b/files/rpms-suse/general
@@ -3,6 +3,7 @@
 ca-certificates-mozilla
 curl
 euca2ools
+gcc
 git-core
 iputils
 libopenssl-devel # to rebuild pyOpenSSL if needed
diff --git a/files/rpms-suse/glance b/files/rpms-suse/glance
index d9844e9..edd1564 100644
--- a/files/rpms-suse/glance
+++ b/files/rpms-suse/glance
@@ -1,4 +1,3 @@
-gcc
 libxml2-devel
 python-PasteDeploy
 python-Routes
diff --git a/files/rpms-suse/swift b/files/rpms-suse/swift
index f3c95aa..4b14098 100644
--- a/files/rpms-suse/swift
+++ b/files/rpms-suse/swift
@@ -1,5 +1,4 @@
 curl
-gcc
 memcached
 python-PasteDeploy
 python-WebOb
diff --git a/files/rpms/general b/files/rpms/general
index 99be725..c940de6 100644
--- a/files/rpms/general
+++ b/files/rpms/general
@@ -2,13 +2,13 @@
 curl
 dbus
 euca2ools # only for testing client
-gcc # dist:rhel6 [2]
+gcc
 git-core
 openssh-server
 openssl
 openssl-devel # to rebuild pyOpenSSL if needed
-libxml2-devel # dist:rhel6 [2]
-libxslt-devel # dist:rhel6 [2]
+libxml2-devel
+libxslt-devel
 psmisc
 pylint
 python-setuptools
@@ -28,7 +28,3 @@
 # but others have versioned (<=0.7).  So if a later version (0.7.1)
 # gets installed in response to an unversioned dependency, it breaks.
 # This pre-installs a compatible 0.6(ish) version from RHEL
-
-# [2] : RHEL6 rpm versions of python-lxml is old, and has to be
-# removed.  Several tools rely on it, so we install the dependencies
-# pip needs to build it here (see tools/install_prereqs.sh)
diff --git a/files/rpms/glance b/files/rpms/glance
index f959c22..fc07fa7 100644
--- a/files/rpms/glance
+++ b/files/rpms/glance
@@ -1,4 +1,3 @@
-gcc
 libffi-devel
 libxml2-devel       # testonly
 libxslt-devel       # testonly
diff --git a/files/rpms/horizon b/files/rpms/horizon
index 38d349d..92afed2 100644
--- a/files/rpms/horizon
+++ b/files/rpms/horizon
@@ -1,5 +1,4 @@
 Django
-gcc
 httpd # NOPRIME
 mod_wsgi  # NOPRIME
 pylint
diff --git a/files/rpms/swift b/files/rpms/swift
index ec53424..938d2c8 100644
--- a/files/rpms/swift
+++ b/files/rpms/swift
@@ -1,5 +1,4 @@
 curl
-gcc
 libffi-devel
 memcached
 python-configobj
diff --git a/lib/ceilometer b/lib/ceilometer
index 59f572c..a4be7af 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -147,9 +147,12 @@
 
     # Install the policy file for the API server
     cp $CEILOMETER_DIR/etc/ceilometer/policy.json $CEILOMETER_CONF_DIR
-    cp $CEILOMETER_DIR/etc/ceilometer/pipeline.yaml $CEILOMETER_CONF_DIR
     iniset $CEILOMETER_CONF DEFAULT policy_file $CEILOMETER_CONF_DIR/policy.json
 
+    cp $CEILOMETER_DIR/etc/ceilometer/pipeline.yaml $CEILOMETER_CONF_DIR
+    cp $CEILOMETER_DIR/etc/ceilometer/api_paste.ini $CEILOMETER_CONF_DIR
+    cp $CEILOMETER_DIR/etc/ceilometer/event_definitions.yaml $CEILOMETER_CONF_DIR
+
     if [ "$CEILOMETER_PIPELINE_INTERVAL" ]; then
         sed -i "s/interval:.*/interval: ${CEILOMETER_PIPELINE_INTERVAL}/" $CEILOMETER_CONF_DIR/pipeline.yaml
     fi
diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt
index 1f2b239..f435456 100644
--- a/lib/nova_plugins/functions-libvirt
+++ b/lib/nova_plugins/functions-libvirt
@@ -28,6 +28,23 @@
         install_package libvirt-python
         install_package python-libguestfs
     fi
+
+    # workaround for
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1098376; if we see
+    # the empty Xen proc file then remove the xen/libxl plugin
+    # shared-libraries (yum remove would uninstall libvirt due to
+    # dependencies, so let's avoid that...)
+    if is_fedora && [ -f /proc/xen/capabilities ] && \
+        [ $(stat -c '%s' /proc/xen/capabilities) -eq 0 ]; then
+        sudo rm -f /usr/lib64/libvirt/connection-driver/libvirt_driver_libxl.so
+        sudo rm -f /usr/lib64/libvirt/connection-driver/libvirt_driver_xen.so
+
+        # another bug requires these to be restarted to avoid
+        # potential hang of libvirtd
+        # https://bugzilla.redhat.com/show_bug.cgi?id=1098866
+        sudo service dbus restart
+        sudo service firewalld restart
+    fi
 }
 
 # Configures the installed libvirt system so that is accessible by
diff --git a/lib/swift b/lib/swift
index 6db779a..1e24c2c 100644
--- a/lib/swift
+++ b/lib/swift
@@ -103,6 +103,10 @@
 # trace through the logs when looking for its use.
 SWIFT_LOG_TOKEN_LENGTH=${SWIFT_LOG_TOKEN_LENGTH:-12}
 
+# Set ``SWIFT_MAX_HEADER_SIZE`` to configure the maximun length of headers in
+# Swift API
+SWIFT_MAX_HEADER_SIZE=${SWIFT_MAX_HEADER_SIZE:-16384}
+
 # Set ``OBJECT_PORT_BASE``, ``CONTAINER_PORT_BASE``, ``ACCOUNT_PORT_BASE``
 # Port bases used in port number calclution for the service "nodes"
 # The specified port number will be used, the additinal ports calculated by
@@ -404,6 +408,7 @@
 
     cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf
     iniset ${SWIFT_CONF_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
+    iniset ${SWIFT_CONF_DIR}/swift.conf swift-constraints max_header_size ${SWIFT_MAX_HEADER_SIZE}
 
     for node_number in ${SWIFT_REPLICAS_SEQ}; do
         swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf
diff --git a/lib/tempest b/lib/tempest
index e899443..fb9971c 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -55,7 +55,7 @@
 BUILD_TIMEOUT=196
 
 
-BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-0.3.1"
+BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
 
 # Cinder/Volume variables
 TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
@@ -305,9 +305,9 @@
     iniset $TEMPEST_CONFIG boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud"
     iniset $TEMPEST_CONFIG boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
     iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
-    iniset $TEMPEST_CONFIG boto ari_manifest cirros-0.3.1-x86_64-initrd.manifest.xml
-    iniset $TEMPEST_CONFIG boto ami_manifest cirros-0.3.1-x86_64-blank.img.manifest.xml
-    iniset $TEMPEST_CONFIG boto aki_manifest cirros-0.3.1-x86_64-vmlinuz.manifest.xml
+    iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-x86_64-initrd.manifest.xml
+    iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-x86_64-blank.img.manifest.xml
+    iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-x86_64-vmlinuz.manifest.xml
     iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
     iniset $TEMPEST_CONFIG boto http_socket_timeout 30
     iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
@@ -327,7 +327,10 @@
     fi
 
     # Scenario
-    iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-0.3.1-x86_64-uec"
+    iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-${CIRROS_VERSION}-x86_64-uec"
+    iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-x86_64-blank.img"
+    iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-x86_64-initrd"
+    iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-x86_64-vmlinuz"
 
     # Large Ops Number
     iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
@@ -408,8 +411,8 @@
 
 # init_tempest() - Initialize ec2 images
 function init_tempest {
-    local base_image_name=cirros-0.3.1-x86_64
-    # /opt/stack/devstack/files/images/cirros-0.3.1-x86_64-uec
+    local base_image_name=cirros-${CIRROS_VERSION}-x86_64
+    # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-x86_64-uec
     local image_dir="$FILES/images/${base_image_name}-uec"
     local kernel="$image_dir/${base_image_name}-vmlinuz"
     local ramdisk="$image_dir/${base_image_name}-initrd"
diff --git a/stack.sh b/stack.sh
index 19d47d6..8fb57c4 100755
--- a/stack.sh
+++ b/stack.sh
@@ -410,7 +410,7 @@
             echo "Invalid chars in password.  Try again:"
         done
         if [ ! $pw ]; then
-            pw=`openssl rand -hex 10`
+            pw=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 20)
         fi
         eval "$var=$pw"
         echo "$var=$pw" >> $localrc
diff --git a/stackrc b/stackrc
index 822403e..6dea983 100644
--- a/stackrc
+++ b/stackrc
@@ -305,12 +305,14 @@
 #    glance as a disk image.  If it ends in .gz, it is uncompressed first.
 #    example:
 #      http://cloud-images.ubuntu.com/releases/precise/release/ubuntu-12.04-server-cloudimg-armel-disk1.img
-#      http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-rootfs.img.gz
+#      http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-rootfs.img.gz
 #  * OpenVZ image:
 #    OpenVZ uses its own format of image, and does not support UEC style images
 
 #IMAGE_URLS="http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz" # old ttylinux-uec image
-#IMAGE_URLS="http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img" # cirros full disk image
+#IMAGE_URLS="http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-disk.img" # cirros full disk image
+
+CIRROS_VERSION=${CIRROS_VERSION:-"0.3.2"}
 
 # Set default image based on ``VIRT_DRIVER`` and ``LIBVIRT_TYPE``, either of
 # which may be set in ``localrc``.  Also allow ``DEFAULT_IMAGE_NAME`` and
@@ -322,11 +324,11 @@
     libvirt)
         case "$LIBVIRT_TYPE" in
             lxc) # the cirros root disk in the uec tarball is empty, so it will not work for lxc
-                DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.1-x86_64-rootfs}
-                IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-rootfs.img.gz"};;
+                DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-rootfs}
+                IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-rootfs.img.gz"};;
             *) # otherwise, use the uec style image (with kernel, ramdisk, disk)
-                DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.1-x86_64-uec}
-                IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"};;
+                DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-uec}
+                IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz"};;
         esac
         ;;
     vsphere)
@@ -336,8 +338,8 @@
         DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.0-x86_64-disk}
         IMAGE_URLS=${IMAGE_URLS:-"https://github.com/downloads/citrix-openstack/warehouse/cirros-0.3.0-x86_64-disk.vhd.tgz"};;
     *) # Default to Cirros with kernel, ramdisk and disk image
-        DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.1-x86_64-uec}
-        IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"};;
+        DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-uec}
+        IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz"};;
 esac
 
 # Use 64bit fedora image if heat is enabled
diff --git a/tools/xen/README.md b/tools/xen/README.md
index 712782b..c8f47be 100644
--- a/tools/xen/README.md
+++ b/tools/xen/README.md
@@ -97,7 +97,7 @@
     # Download a vhd and a uec image
     IMAGE_URLS="\
     https://github.com/downloads/citrix-openstack/warehouse/cirros-0.3.0-x86_64-disk.vhd.tgz,\
-    http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"
+    http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-uec.tar.gz"
 
     # Explicitly set virt driver
     VIRT_DRIVER=xenserver
diff --git a/tools/xen/scripts/install_ubuntu_template.sh b/tools/xen/scripts/install_ubuntu_template.sh
index d80ed09..d4d6567 100755
--- a/tools/xen/scripts/install_ubuntu_template.sh
+++ b/tools/xen/scripts/install_ubuntu_template.sh
@@ -14,6 +14,9 @@
 # This directory
 BASE_DIR=$(cd $(dirname "$0") && pwd)
 
+# Source the top level functions
+source $BASE_DIR/../../../functions
+
 # For default setings see xenrc
 source $BASE_DIR/../xenrc