Merge "Adds PowerVM support for the VIRT_DRIVER conf"
diff --git a/exercises/euca.sh b/exercises/euca.sh
index 50d4744..d704279 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -96,7 +96,7 @@
    # Attach volume to an instance
    euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \
        die $LINENO "Failure attaching volume $VOLUME to $INSTANCE"
-   if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q in-use; do sleep 1; done"; then
+   if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -A 1 in-use | grep -q attach; do sleep 1; done"; then
        die $LINENO "Could not attach $VOLUME to $INSTANCE"
    fi
 
diff --git a/files/rpms-suse/nova b/files/rpms-suse/nova
index 04af7f3..a3fd479 100644
--- a/files/rpms-suse/nova
+++ b/files/rpms-suse/nova
@@ -15,6 +15,7 @@
 libxml2-python
 mysql-community-server # NOPRIME
 parted
+polkit
 python-M2Crypto
 python-m2crypto # dist:sle11sp2
 python-Paste
diff --git a/files/rpms/nova b/files/rpms/nova
index 7ff926b..9d8891d 100644
--- a/files/rpms/nova
+++ b/files/rpms/nova
@@ -15,6 +15,7 @@
 m2crypto
 mysql-server # NOPRIME
 parted
+polkit
 python-boto
 python-carrot
 python-cheetah
diff --git a/functions b/functions
index 88e4a62..02c2b3a 100644
--- a/functions
+++ b/functions
@@ -887,9 +887,18 @@
         SUDO_PIP="sudo"
         CMD_PIP=$(get_pip_command)
     fi
+
+    if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
+        # RHEL6 pip by default doesn't have this (was introduced
+        # around 0.8.1 or so)
+        PIP_USE_MIRRORS=${PIP_USE_MIRRORS:-False}
+    else
+        PIP_USE_MIRRORS=${PIP_USE_MIRRORS:-True}
+    fi
     if [[ "$PIP_USE_MIRRORS" != "False" ]]; then
         PIP_MIRROR_OPT="--use-mirrors"
     fi
+
     $SUDO_PIP PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
         HTTP_PROXY=$http_proxy \
         HTTPS_PROXY=$https_proxy \
diff --git a/lib/cinder b/lib/cinder
index 221108e..82e7454 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -234,6 +234,19 @@
         )
     elif [ "$CINDER_DRIVER" == "sheepdog" ]; then
         iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.sheepdog.SheepdogDriver"
+    elif [ "$CINDER_DRIVER" == "glusterfs" ]; then
+        # To use glusterfs, set the following in localrc:
+        # CINDER_DRIVER=glusterfs
+        # CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1;127.0.0.1:/vol2"
+        # Shares are <host>:<volume> and separated by semicolons.
+
+        iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.glusterfs.GlusterfsDriver"
+        iniset $CINDER_CONF DEFAULT glusterfs_shares_config "$CINDER_CONF_DIR/glusterfs_shares"
+        touch $CINDER_CONF_DIR/glusterfs_shares
+        if [ ! -z "$CINDER_GLUSTERFS_SHARES" ]; then
+            CINDER_GLUSTERFS_SHARES=$(echo $CINDER_GLUSTERFS_SHARES | tr ";" "\n")
+            echo "$CINDER_GLUSTERFS_SHARES" > $CINDER_CONF_DIR/glusterfs_shares
+        fi
     fi
 }
 
diff --git a/lib/quantum_plugins/plumgrid b/lib/quantum_plugins/plumgrid
index b49aa92..912aa7e 100644
--- a/lib/quantum_plugins/plumgrid
+++ b/lib/quantum_plugins/plumgrid
@@ -25,8 +25,10 @@
 }
 
 function quantum_plugin_configure_service() {
-    iniset /$Q_PLUGIN_CONF_FILE PLUMgridNOS nos_server localhost
-    iniset /$Q_PLUGIN_CONF_FILE PLUMgridNOS nos_server_port 7766
+    PLUMGRID_NOS_IP=${PLUMGRID_NOS_IP:-localhost}
+    PLUMGRID_NOS_PORT=${PLUMGRID_NOS_PORT:-7766}
+    iniset /$Q_PLUGIN_CONF_FILE PLUMgridNOS nos_server $PLUMGRID_NOS_IP
+    iniset /$Q_PLUGIN_CONF_FILE PLUMgridNOS nos_server_port $PLUMGRID_NOS_PORT
 }
 
 function quantum_plugin_configure_debug_command() {