Merge "Freshen samples"
diff --git a/README.md b/README.md
index fd66e96..872b16b 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,22 @@
 
 You can override environment variables used in `stack.sh` by creating file name `localrc`.  It is likely that you will need to do this to tweak your networking configuration should you need to access your cloud from a different host.
 
+# RPC Backend
+
+Multiple RPC backends are available. Currently, this
+includes RabbitMQ (default), Qpid, and ZeroMQ. Your backend of
+choice may be selected via the `localrc`.
+
+Note that selecting more than one RPC backend will result in a failure.
+
+Example (ZeroMQ):
+
+    ENABLED_SERVICES="$ENABLED_SERVICES,-rabbit,-qpid,zeromq"
+
+Example (Qpid):
+
+    ENABLED_SERVICES="$ENABLED_SERVICES,-rabbit,-zeromq,qpid"
+
 # Swift
 
 Swift is not installed by default, you can enable easily by adding this to your `localrc`:
diff --git a/lib/cinder b/lib/cinder
index 1bad5c0..5f0b255 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -115,6 +115,8 @@
 
     if is_service_enabled qpid ; then
         iniset $CINDER_CONF DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
+    elif is_service_enabled zeromq; then
+        iniset $CINDER_CONF DEFAULT rpc_backend nova.openstack.common.rpc.impl_zmq
     elif [ -n "$RABBIT_HOST" ] &&  [ -n "$RABBIT_PASSWORD" ]; then
         iniset $CINDER_CONF DEFAULT rabbit_host $RABBIT_HOST
         iniset $CINDER_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
diff --git a/stack.sh b/stack.sh
index 91380c5..3e3d8cf 100755
--- a/stack.sh
+++ b/stack.sh
@@ -142,6 +142,23 @@
     exit 1
 fi
 
+# Make sure we only have one rpc backend enabled.
+rpc_backend_cnt=0
+for svc in qpid zeromq rabbit; do
+    is_service_enabled $svc &&
+        ((rpc_backend_cnt++))
+done
+if [ "$rpc_backend_cnt" -gt 1 ]; then
+    echo "ERROR: only one rpc backend may be enabled,"
+    echo "       set only one of 'rabbit', 'qpid', 'zeromq'"
+    echo "       via ENABLED_SERVICES."
+elif [ "$rpc_backend_cnt" == 0 ]; then
+    echo "ERROR: at least one rpc backend must be enabled,"
+    echo "       set one of 'rabbit', 'qpid', 'zeromq'"
+    echo "       via ENABLED_SERVICES."
+fi
+unset rpc_backend_cnt
+
 # Make sure we only have one volume service enabled.
 if is_service_enabled cinder && is_service_enabled n-vol; then
     echo "ERROR: n-vol and cinder must not be enabled at the same time"
@@ -655,6 +672,12 @@
     else
         install_package qpidd
     fi
+elif is_service_enabled zeromq; then
+    if [[ "$os_PACKAGE" = "rpm" ]]; then
+        install_package zeromq python-zmq
+    else
+        install_package libzmq1 python-zmq
+    fi
 fi
 
 if is_service_enabled mysql; then
@@ -893,8 +916,8 @@
 fi
 
 
-# Rabbit or Qpid
-# --------------
+# Finalize queue instllation
+# --------------------------
 
 if is_service_enabled rabbit; then
     # Start rabbitmq-server
@@ -1274,6 +1297,8 @@
     iniset $Q_CONF_FILE DEFAULT control_exchange quantum
     if is_service_enabled qpid ; then
         iniset $Q_CONF_FILE DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
+    elif is_service_enabled zeromq; then
+        iniset $Q_CONF_FILE DEFAULT rpc_backend quantum.openstack.common.rpc.impl_zmq
     elif [ -n "$RABBIT_HOST" ] &&  [ -n "$RABBIT_PASSWORD" ]; then
         iniset $Q_CONF_FILE DEFAULT rabbit_host $RABBIT_HOST
         iniset $Q_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
@@ -1898,7 +1923,9 @@
 add_nova_opt "api_paste_config=$NOVA_CONF_DIR/api-paste.ini"
 add_nova_opt "image_service=nova.image.glance.GlanceImageService"
 add_nova_opt "ec2_dmz_host=$EC2_DMZ_HOST"
-if is_service_enabled qpid ; then
+if is_service_enabled zeromq; then
+    add_nova_opt "rpc_backend=nova.openstack.common.rpc.impl_zmq"
+elif is_service_enabled qpid; then
     add_nova_opt "rpc_backend=nova.rpc.impl_qpid"
 elif [ -n "$RABBIT_HOST" ] &&  [ -n "$RABBIT_PASSWORD" ]; then
     add_nova_opt "rabbit_host=$RABBIT_HOST"
@@ -2142,6 +2169,8 @@
     fi
 fi
 
+screen_it zeromq "cd $NOVA_DIR && $NOVA_DIR/bin/nova-rpc-zmq-receiver"
+
 # Launch the nova-api and wait for it to answer before continuing
 if is_service_enabled n-api; then
     add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"