Merge "Install api-paste.ini and policy.json"
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/glance b/files/rpms/glance
index eff6c2c..34e3f9a 100644
--- a/files/rpms/glance
+++ b/files/rpms/glance
@@ -3,7 +3,7 @@
 python-devel
 python-eventlet
 python-greenlet
-python-paste-deploy
+python-paste-deploy #dist:f16,f17,f18
 python-routes
 python-sqlalchemy
 python-wsgiref
diff --git a/files/rpms/horizon b/files/rpms/horizon
index 12f75ba..151e7e2 100644
--- a/files/rpms/horizon
+++ b/files/rpms/horizon
@@ -17,8 +17,8 @@
 python-mox
 python-netaddr
 python-nose
-python-paste
-python-paste-deploy
+python-paste        #dist:f16,f17,f18
+python-paste-deploy #dist:f16,f17,f18
 python-pep8
 python-routes
 python-sphinx
diff --git a/files/rpms/keystone b/files/rpms/keystone
index 59868c7..078adf7 100644
--- a/files/rpms/keystone
+++ b/files/rpms/keystone
@@ -1,11 +1,13 @@
 python-greenlet
-python-lxml
-python-paste
-python-paste-deploy
-python-paste-script
+python-lxml         #dist:f16,f17,f18
+python-paste        #dist:f16,f17,f18
+python-paste-deploy #dist:f16,f17,f18
+python-paste-script #dist:f16,f17,f18
 python-routes
-python-setuptools
+python-setuptools   #dist:f16,f17,f18
 python-sqlalchemy
 python-sqlite2
 python-webob
 sqlite
+
+# Deps installed via pip for RHEL
\ No newline at end of file
diff --git a/files/rpms/nova b/files/rpms/nova
index 7ff926b..328e7d6 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
@@ -28,9 +29,11 @@
 python-migrate
 python-mox
 python-netaddr
-python-paramiko
-python-paste
-python-paste-deploy
+python-paramiko # dist:f16,f17,f18
+# ^ on RHEL, brings in python-crypto which conflicts with version from
+# pip we need
+python-paste        # dist:f16,f17,f18
+python-paste-deploy # dist:f16,f17,f18
 python-qpid
 python-routes
 python-sqlalchemy
diff --git a/files/rpms/quantum b/files/rpms/quantum
index 05398fc..450e39c 100644
--- a/files/rpms/quantum
+++ b/files/rpms/quantum
@@ -10,14 +10,16 @@
 python-iso8601
 python-kombu
 python-netaddr
-python-paste
-python-paste-deploy
+#rhel6 gets via pip
+python-paste        # dist:f16,f17,f18
+python-paste-deploy # dist:f16,f17,f18
 python-qpid
 python-routes
 python-sqlalchemy
 python-suds
 rabbitmq-server # NOPRIME
-qpid-cpp-server-daemon # NOPRIME
+qpid-cpp-server-daemon # NOPRIME dist:f16,f17,f18
+qpid-cpp-server        # NOPRIME dist:rhel6
 sqlite
 sudo
 vconfig
diff --git a/files/rpms/ryu b/files/rpms/ryu
index 4a4fc52..7cf3bd7 100644
--- a/files/rpms/ryu
+++ b/files/rpms/ryu
@@ -1,5 +1,5 @@
-python-setuptools
 python-gevent
 python-gflags
 python-netifaces
+python-setuptools #dist:f16,f17,f18
 python-sphinx
diff --git a/files/rpms/swift b/files/rpms/swift
index ce41ceb..1b36e34 100644
--- a/files/rpms/swift
+++ b/files/rpms/swift
@@ -8,8 +8,8 @@
 python-greenlet
 python-netifaces
 python-nose
-python-paste-deploy
-python-setuptools
+python-paste-deploy # dist:f16,f17,f18
+python-setuptools   # dist:f16,f17,f18
 python-simplejson
 python-webob
 pyxattr
diff --git a/lib/rpc_backend b/lib/rpc_backend
index 7d165a4..3c485e4 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -21,9 +21,22 @@
 # Functions
 # ---------
 
+
 # Make sure we only have one rpc backend enabled.
 # Also check the specified rpc backend is available on your platform.
 function check_rpc_backend() {
+    local rpc_needed=1
+    # We rely on the fact that filenames in lib/* match the service names
+    # that can be passed as arguments to is_service_enabled.
+    # We check for a call to iniset_rpc_backend in these files, meaning
+    # the service needs a backend.
+    rpc_candidates=$(grep -rl iniset_rpc_backend . | awk -F/ '{print $NF}')
+    for c in ${rpc_candidates}; do
+        if is_service_enabled $c; then
+            rpc_needed=0
+            break
+        fi
+    done
     local rpc_backend_cnt=0
     for svc in qpid zeromq rabbit; do
         is_service_enabled $svc &&
@@ -33,7 +46,7 @@
         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
+    elif [ "$rpc_backend_cnt" == 0 ] && [ "$rpc_needed" == 0 ]; then
         echo "ERROR: at least one rpc backend must be enabled,"
         echo "       set one of 'rabbit', 'qpid', 'zeromq'"
         echo "       via ENABLED_SERVICES."
@@ -57,7 +70,11 @@
         fi
     elif is_service_enabled qpid; then
         if is_fedora; then
-            uninstall_package qpid-cpp-server-daemon
+            if [[ $DISTRO =~ (rhel6) ]]; then
+                uninstall_package qpid-cpp-server
+            else
+                uninstall_package qpid-cpp-server-daemon
+            fi
         elif is_ubuntu; then
             uninstall_package qpidd
         else
@@ -87,7 +104,16 @@
         rm -f "$tfile"
     elif is_service_enabled qpid; then
         if is_fedora; then
-            install_package qpid-cpp-server-daemon
+            if [[ $DISTRO =~ (rhel6) ]]; then
+                install_package qpid-cpp-server
+
+               # RHEL6 leaves "auth=yes" in /etc/qpidd.conf, it needs to
+               # be no or you get GSS authentication errors as it
+               # attempts to default to this.
+                sudo sed -i.bak 's/^auth=yes$/auth=no/' /etc/qpidd.conf
+            else
+                install_package qpid-cpp-server-daemon
+            fi
         elif is_ubuntu; then
             install_package qpidd
             sudo sed -i '/PLAIN/!s/mech_list: /mech_list: PLAIN /' /etc/sasl2/qpidd.conf
diff --git a/stack.sh b/stack.sh
index 90e607e..e192588 100755
--- a/stack.sh
+++ b/stack.sh
@@ -105,7 +105,7 @@
 
 # Warn users who aren't on an explicitly supported distro, but allow them to
 # override check and attempt installation with ``FORCE=yes ./stack``
-if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|f16|f17|f18|opensuse-12.2) ]]; then
+if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|f16|f17|f18|opensuse-12.2|rhel6) ]]; then
     echo "WARNING: this script has not been tested on $DISTRO"
     if [[ "$FORCE" != "yes" ]]; then
         die $LINENO "If you wish to run this script anyway run with FORCE=yes"
@@ -589,8 +589,10 @@
     install_swift
     configure_swift
 
+    # swift3 middleware to provide S3 emulation to Swift
     if is_service_enabled swift3; then
-        # swift3 middleware to provide S3 emulation to Swift
+        # replace the nova-objectstore port by the swift port
+        S3_SERVICE_PORT=8080
         git_clone $SWIFT3_REPO $SWIFT3_DIR $SWIFT3_BRANCH
         setup_develop $SWIFT3_DIR
     fi
@@ -930,6 +932,37 @@
            iniset $NOVA_CONF baremetal ${I/=/ }
         done
 
+   # PowerVM
+   # -------
+
+    elif [ "$VIRT_DRIVER" = 'powervm' ]; then
+        echo_summary "Using PowerVM driver"
+        POWERVM_MGR_TYPE=${POWERVM_MGR_TYPE:-"ivm"}
+        POWERVM_MGR_HOST=${POWERVM_MGR_HOST:-"powervm.host"}
+        POWERVM_MGR_USER=${POWERVM_MGR_USER:-"padmin"}
+        POWERVM_MGR_PASSWD=${POWERVM_MGR_PASSWD:-"password"}
+        POWERVM_IMG_REMOTE_PATH=${POWERVM_IMG_REMOTE_PATH:-"/tmp"}
+        POWERVM_IMG_LOCAL_PATH=${POWERVM_IMG_LOCAL_PATH:-"/tmp"}
+        iniset $NOVA_CONF DEFAULT compute_driver nova.virt.powervm.PowerVMDriver
+        iniset $NOVA_CONF DEFAULT powervm_mgr_type $POWERVM_MGR_TYPE
+        iniset $NOVA_CONF DEFAULT powervm_mgr $POWERVM_MGR_HOST
+        iniset $NOVA_CONF DEFAULT powervm_mgr_user $POWERVM_MGR_USER
+        iniset $NOVA_CONF DEFAULT powervm_mgr_passwd $POWERVM_MGR_PASSWD
+        iniset $NOVA_CONF DEFAULT powervm_img_remote_path $POWERVM_IMG_REMOTE_PATH
+        iniset $NOVA_CONF DEFAULT powervm_img_local_path $POWERVM_IMG_LOCAL_PATH
+
+    # vSphere API
+    # -------
+
+    elif [ "$VIRT_DRIVER" = 'vsphere' ]; then
+        echo_summary "Using VMware vCenter driver"
+        iniset $NOVA_CONF DEFAULT compute_driver "vmwareapi.VMwareVCDriver"
+        VMWAREAPI_USER=${VMWAREAPI_USER:-"root"}
+        iniset $NOVA_CONF DEFAULT vmwareapi_host_ip "$VMWAREAPI_IP"
+        iniset $NOVA_CONF DEFAULT vmwareapi_host_username "$VMWAREAPI_USER"
+        iniset $NOVA_CONF DEFAULT vmwareapi_host_password "$VMWAREAPI_PASSWORD"
+        iniset $NOVA_CONF DEFAULT vmwareapi_cluster_name "$VMWAREAPI_CLUSTER"
+
     # Default
     # -------
 
diff --git a/stackrc b/stackrc
index c55e8dc..f99eab1 100644
--- a/stackrc
+++ b/stackrc
@@ -199,6 +199,8 @@
                 IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"};;
         esac
         ;;
+    vsphere)
+        IMAGE_URLS="";;
     *) # 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"};;