Move hypervisor-specific code into a case statement

Change-Id: Id799506f180ac81d493f49de140cc079338430aa
diff --git a/stackrc b/stackrc
index 871c8a1..edf5a82 100644
--- a/stackrc
+++ b/stackrc
@@ -164,14 +164,25 @@
 
 # Nova hypervisor configuration.  We default to libvirt with **kvm** but will
 # drop back to **qemu** if we are unable to load the kvm module.  ``stack.sh`` can
-# also install an **LXC** or **OpenVZ** based system.
+# also install an **LXC**, **OpenVZ** or **XenAPI** based system.
 VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
-LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
-if [[ "$os_VENDOR" =~ (Debian) ]]; then
-  LIBVIRT_GROUP=libvirt
-else
-  LIBVIRT_GROUP=libvirtd
-fi
+case "$VIRT_DRIVER" in
+    libvirt)
+        LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
+        if [[ "$os_VENDOR" =~ (Debian) ]]; then
+            LIBVIRT_GROUP=libvirt
+        else
+            LIBVIRT_GROUP=libvirtd
+        fi
+        ;;
+    xenserver)
+        # Xen config common to nova and quantum
+        XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
+        XENAPI_USER=${XENAPI_USER:-"root"}
+        ;;
+    *)
+        ;;
+esac
 
 # Specify a comma-separated list of UEC images to download and install into glance.
 # supported urls here are:
@@ -234,10 +245,6 @@
 # Compatibility until it's eradicated from CI
 USE_SCREEN=${SCREEN_DEV:-$USE_SCREEN}
 
-# Xen config common to nova and quantum
-XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
-XENAPI_USER=${XENAPI_USER:-"root"}
-
 # Local variables:
 # mode: shell-script
 # End: