Merge "Add genisoimage to package dependencies:"
diff --git a/functions b/functions
index b94c611..11f7d50 100644
--- a/functions
+++ b/functions
@@ -117,20 +117,32 @@
 }
 
 
+function _get_package_dir() {
+    local pkg_dir
+    if is_ubuntu; then
+        pkg_dir=$FILES/apts
+    elif is_fedora; then
+        pkg_dir=$FILES/rpms
+    elif is_suse; then
+        pkg_dir=$FILES/rpms-suse
+    else
+        exit_distro_not_supported "list of packages"
+    fi
+    echo "$pkg_dir"
+}
+
 # get_packages() collects a list of package names of any type from the
 # prerequisite files in ``files/{apts|rpms}``.  The list is intended
 # to be passed to a package installer such as apt or yum.
 #
-# Only packages required for the services in ``ENABLED_SERVICES`` will be
+# Only packages required for the services in 1st argument will be
 # included.  Two bits of metadata are recognized in the prerequisite files:
 # - ``# NOPRIME`` defers installation to be performed later in stack.sh
 # - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
 #   of the package to the distros listed.  The distro names are case insensitive.
-#
-# Uses globals ``ENABLED_SERVICES``
-# get_packages dir
 function get_packages() {
-    local package_dir=$1
+    local services=$1
+    local package_dir=$(_get_package_dir)
     local file_to_parse
     local service
 
@@ -141,7 +153,7 @@
     if [[ -z "$DISTRO" ]]; then
         GetDistro
     fi
-    for service in general ${ENABLED_SERVICES//,/ }; do
+    for service in general ${services//,/ }; do
         # Allow individual services to specify dependencies
         if [[ -e ${package_dir}/${service} ]]; then
             file_to_parse="${file_to_parse} $service"
diff --git a/lib/cinder b/lib/cinder
index c8291a2..f487c8e 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -50,8 +50,13 @@
     CINDER_BIN_DIR=$(get_python_exec_prefix)
 fi
 
-# Name of the lvm volume group to use/create for iscsi volumes
+# Support for multi lvm backend configuration (default is no support)
+CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
+
+# Name of the lvm volume groups to use/create for iscsi volumes
+# VOLUME_GROUP2 is used only if CINDER_MULTI_LVM_BACKEND = True
 VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
+VOLUME_GROUP2=${VOLUME_GROUP2:-stack-volumes2}
 VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
 
 # _clean_volume_group removes all cinder volumes from the specified volume group
@@ -106,6 +111,9 @@
 
     # Campsite rule: leave behind a volume group at least as clean as we found it
     _clean_volume_group $VOLUME_GROUP $VOLUME_NAME_PREFIX
+    if [ "$CINDER_MULTI_LVM_BACKEND" = "True" ]; then
+        _clean_volume_group $VOLUME_GROUP2 $VOLUME_NAME_PREFIX
+    fi
 }
 
 # configure_cinder() - Set config files, create data dirs, etc
@@ -164,8 +172,18 @@
     cp $CINDER_DIR/etc/cinder/cinder.conf.sample $CINDER_CONF
     iniset $CINDER_CONF DEFAULT auth_strategy keystone
     iniset $CINDER_CONF DEFAULT verbose True
-    iniset $CINDER_CONF DEFAULT volume_group $VOLUME_GROUP
-    iniset $CINDER_CONF DEFAULT volume_name_template ${VOLUME_NAME_PREFIX}%s
+    if [ "$CINDER_MULTI_LVM_BACKEND" = "True" ]; then
+        iniset $CINDER_CONF DEFAULT enabled_backends lvmdriver-1,lvmdriver-2
+        iniset $CINDER_CONF lvmdriver-1 volume_group $VOLUME_GROUP
+        iniset $CINDER_CONF lvmdriver-1 volume_driver cinder.volume.drivers.lvm.LVMISCSIDriver
+        iniset $CINDER_CONF lvmdriver-1 volume_backend_name LVM_iSCSI
+        iniset $CINDER_CONF lvmdriver-2 volume_group $VOLUME_GROUP2
+        iniset $CINDER_CONF lvmdriver-2 volume_driver cinder.volume.drivers.lvm.LVMISCSIDriver
+        iniset $CINDER_CONF lvmdriver-2 volume_backend_name LVM_iSCSI
+    else
+        iniset $CINDER_CONF DEFAULT volume_group $VOLUME_GROUP
+        iniset $CINDER_CONF DEFAULT volume_name_template ${VOLUME_NAME_PREFIX}%s
+    fi
     iniset $CINDER_CONF DEFAULT iscsi_helper tgtadm
     local dburl
     database_connection_url dburl cinder
@@ -263,12 +281,14 @@
 }
 
 create_cinder_volume_group() {
-    # Configure a default volume group called '`stack-volumes`' for the volume
-    # service if it does not yet exist.  If you don't wish to use a file backed
-    # volume group, create your own volume group called ``stack-volumes`` before
-    # invoking ``stack.sh``.
+    # According to the CINDER_MULTI_LVM_BACKEND value, configure one or two default volumes
+    # group called ``stack-volumes`` (and ``stack-volumes2``) for the volume
+    # service if it (they) does (do) not yet exist. If you don't wish to use a
+    # file backed volume group, create your own volume group called ``stack-volumes``
+    # and ``stack-volumes2`` before invoking ``stack.sh``.
     #
-    # By default, the backing file is 5G in size, and is stored in ``/opt/stack/data``.
+    # By default, the two backing files are 5G in size, and are stored in
+    # ``/opt/stack/data``.
 
     if ! sudo vgs $VOLUME_GROUP; then
         VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DATA_DIR/${VOLUME_GROUP}-backing-file}
@@ -283,6 +303,23 @@
             sudo vgcreate $VOLUME_GROUP $DEV
         fi
     fi
+    if [ "$CINDER_MULTI_LVM_BACKEND" = "True" ]; then
+        #set up the second volume if CINDER_MULTI_LVM_BACKEND is enabled
+
+        if ! sudo vgs $VOLUME_GROUP2; then
+            VOLUME_BACKING_FILE2=${VOLUME_BACKING_FILE2:-$DATA_DIR/${VOLUME_GROUP2}-backing-file}
+
+            # Only create if the file doesn't already exists
+            [[ -f $VOLUME_BACKING_FILE2 ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE2
+
+            DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE2`
+
+            # Only create if the loopback device doesn't contain $VOLUME_GROUP
+            if ! sudo vgs $VOLUME_GROUP2; then
+                sudo vgcreate $VOLUME_GROUP2 $DEV
+            fi
+        fi
+    fi
 
     mkdir -p $CINDER_STATE_PATH/volumes
 }
@@ -314,6 +351,9 @@
             sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
             # Start with a clean volume group
             _clean_volume_group $VOLUME_GROUP $VOLUME_NAME_PREFIX
+            if [ "$CINDER_MULTI_LVM_BACKEND" = "True" ]; then
+                _clean_volume_group $VOLUME_GROUP2 $VOLUME_NAME_PREFIX
+            fi
         fi
     fi
 
diff --git a/tools/info.sh b/tools/info.sh
index ef1f338..14ab8f6 100755
--- a/tools/info.sh
+++ b/tools/info.sh
@@ -88,17 +88,7 @@
 # - We are going to check packages only for the services needed.
 # - We are parsing the packages files and detecting metadatas.
 
-if is_ubuntu; then
-    PKG_DIR=$FILES/apts
-elif is_fedora; then
-    PKG_DIR=$FILES/rpms
-elif is_suse; then
-    PKG_DIR=$FILES/rpms-suse
-else
-    exit_distro_not_supported "list of packages"
-fi
-
-for p in $(get_packages $PKG_DIR); do
+for p in $(get_packages $ENABLED_SERVICES); do
     if [[ "$os_PACKAGE" = "deb" ]]; then
         ver=$(dpkg -s $p 2>/dev/null | grep '^Version: ' | cut -d' ' -f2)
     elif [[ "$os_PACKAGE" = "rpm" ]]; then
diff --git a/tools/install_prereqs.sh b/tools/install_prereqs.sh
index 4d151db..7c4386f 100755
--- a/tools/install_prereqs.sh
+++ b/tools/install_prereqs.sh
@@ -54,15 +54,7 @@
 # ================
 
 # Install package requirements
-if is_ubuntu; then
-    install_package $(get_packages $FILES/apts)
-elif is_fedora; then
-    install_package $(get_packages $FILES/rpms)
-elif is_suse; then
-    install_package $(get_packages $FILES/rpms-suse)
-else
-    exit_distro_not_supported "list of packages"
-fi
+install_package $(get_packages $ENABLED_SERVICES)
 
 if [[ -n "$SYSLOG" && "$SYSLOG" != "False" ]]; then
     if is_ubuntu || is_fedora; then