Merge "Added functions for get a ip on an instance"
diff --git a/functions b/functions
index b56df08..37876e0 100644
--- a/functions
+++ b/functions
@@ -387,8 +387,9 @@
         # CentOS release 5.5 (Final)
         # CentOS Linux release 6.0 (Final)
         # Fedora release 16 (Verne)
+        # XenServer release 6.2.0-70446c (xenenterprise)
         os_CODENAME=""
-        for r in "Red Hat" CentOS Fedora; do
+        for r in "Red Hat" CentOS Fedora XenServer; do
             os_VENDOR=$r
             if [[ -n "`grep \"$r\" /etc/redhat-release`" ]]; then
                 ver=`sed -e 's/^.* \(.*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release`
@@ -451,6 +452,8 @@
     elif [[ "$os_VENDOR" =~ (Red Hat) || "$os_VENDOR" =~ (CentOS) ]]; then
         # Drop the . release as we assume it's compatible
         DISTRO="rhel${os_RELEASE::1}"
+    elif [[ "$os_VENDOR" =~ (XenServer) ]]; then
+        DISTRO="xs$os_RELEASE"
     else
         # Catch-all for now is Vendor + Release + Update
         DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE"
diff --git a/lib/cinder b/lib/cinder
index b39fbdc..54cf844 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -287,6 +287,14 @@
             CINDER_GLUSTERFS_SHARES=$(echo $CINDER_GLUSTERFS_SHARES | tr ";" "\n")
             echo "$CINDER_GLUSTERFS_SHARES" > $CINDER_CONF_DIR/glusterfs_shares
         fi
+    elif [ "$CINDER_DRIVER" == "vsphere" ]; then
+        echo_summary "Using VMware vCenter driver"
+        iniset $CINDER_CONF DEFAULT enabled_backends vmware
+        iniset $CINDER_CONF vmware host_ip "$VMWAREAPI_IP"
+        iniset $CINDER_CONF vmware host_username "$VMWAREAPI_USER"
+        iniset $CINDER_CONF vmware host_password "$VMWAREAPI_PASSWORD"
+        iniset $CINDER_CONF vmware cluster_name "$VMWAREAPI_CLUSTER"
+        iniset $CINDER_CONF vmware volume_driver "cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver"
     fi
 
     if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
diff --git a/lib/neutron_plugins/nicira b/lib/neutron_plugins/nicira
index eabc417..e9deb64 100644
--- a/lib/neutron_plugins/nicira
+++ b/lib/neutron_plugins/nicira
@@ -90,7 +90,7 @@
         iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
         Q_L3_ENABLED=True
         Q_L3_ROUTER_PER_TENANT=True
-        iniset /$Q_PLUGIN_CONF_FILE nvp enable_metadata_access_network True
+        iniset /$Q_PLUGIN_CONF_FILE nvp metadata_mode access_network
     fi
     if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then
         iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID
diff --git a/lib/oslo b/lib/oslo
index de5ec4e..449c4de 100644
--- a/lib/oslo
+++ b/lib/oslo
@@ -41,7 +41,7 @@
 # cleanup_oslo() - purge possibly old versions of oslo
 function cleanup_oslo() {
     # this means we've got an old olso installed, lets get rid of it
-    if find /usr | grep oslo.config | grep -v oslo.config.egg-link > /dev/null; then
+    if ! python -c 'import oslo.config' 2>/dev/null; then
         echo "Found old oslo.config... removing to ensure consistency"
         local PIP_CMD=$(get_pip_command)
         pip_install olso.config
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index 92b1317..997644d 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -29,6 +29,10 @@
 # xapi functions
 . $THIS_DIR/functions
 
+# Determine what system we are running on.
+# Might not be XenServer if we're using xenserver-core
+GetDistro
+
 #
 # Get Settings
 #