Merge "Update NVP plugin name for Neutron."
diff --git a/exercises/quantum-adv-test.sh b/exercises/neutron-adv-test.sh
similarity index 100%
rename from exercises/quantum-adv-test.sh
rename to exercises/neutron-adv-test.sh
diff --git a/files/apts/quantum b/files/apts/neutron
similarity index 100%
rename from files/apts/quantum
rename to files/apts/neutron
diff --git a/files/rpms-suse/quantum b/files/rpms-suse/neutron
similarity index 100%
rename from files/rpms-suse/quantum
rename to files/rpms-suse/neutron
diff --git a/files/rpms/quantum b/files/rpms/neutron
similarity index 100%
rename from files/rpms/quantum
rename to files/rpms/neutron
diff --git a/lib/keystone b/lib/keystone
index 4b93992..1b6970d 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -3,11 +3,12 @@
 
 # Dependencies:
 # ``functions`` file
+# ``DEST``, ``STACK_USER``
+# ``IDENTITY_API_VERSION``
 # ``BASE_SQL_CONN``
 # ``SERVICE_HOST``, ``SERVICE_PROTOCOL``
 # ``SERVICE_TOKEN``
 # ``S3_SERVICE_PORT`` (template backend only)
-# ``STACK_USER``
 
 # ``stack.sh`` calls the entry points in this order:
 #
@@ -119,6 +120,10 @@
         iniset $KEYSTONE_CONF identity driver "keystone.identity.backends.ldap.Identity"
     fi
 
+    # Set the URL advertised in the ``versions`` structure returned by the '/' route
+    iniset $KEYSTONE_CONF DEFAULT public_endpoint "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:%(public_port)s/"
+    iniset $KEYSTONE_CONF DEFAULT admin_endpoint "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:%(admin_port)s/"
+
     if is_service_enabled tls-proxy; then
         # Set the service ports for a proxy to take the originals
         iniset $KEYSTONE_CONF DEFAULT public_port $KEYSTONE_SERVICE_PORT_INT
@@ -249,9 +254,9 @@
         keystone endpoint-create \
             --region RegionOne \
             --service_id $KEYSTONE_SERVICE \
-            --publicurl "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0" \
-            --adminurl "$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0" \
-            --internalurl "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0"
+            --publicurl "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION" \
+            --adminurl "$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v$IDENTITY_API_VERSION" \
+            --internalurl "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION"
     fi
 }
 
@@ -302,7 +307,7 @@
     # Start Keystone in a screen window
     screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
     echo "Waiting for keystone to start..."
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= curl -s http://$SERVICE_HOST:$service_port/v2.0/ >/dev/null; do sleep 1; done"; then
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= curl -s http://$SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/ >/dev/null; do sleep 1; done"; then
       die $LINENO "keystone did not start"
     fi
 
diff --git a/lib/neutron_plugins/ovs_base b/lib/neutron_plugins/ovs_base
index 0a2765b..0a53bff 100644
--- a/lib/neutron_plugins/ovs_base
+++ b/lib/neutron_plugins/ovs_base
@@ -44,9 +44,9 @@
         # Ensure that the service is started
         restart_service openvswitch
     elif is_suse; then
-        ### FIXME: Find out if package can be pushed to Factory
-        echo "OpenVSwitch packages can be installed from Cloud:OpenStack:Master in OBS"
-        restart_service openvswitch
+        install_package openvswitch
+        restart_service openvswitch-switch
+        restart_service openvswitch-controller
     fi
 }
 
diff --git a/lib/nova b/lib/nova
index 24d5cf9..db82aa2 100644
--- a/lib/nova
+++ b/lib/nova
@@ -490,6 +490,8 @@
     if is_service_enabled ceilometer; then
         iniset $NOVA_CONF DEFAULT instance_usage_audit "True"
         iniset $NOVA_CONF DEFAULT instance_usage_audit_period "hour"
+        iniset $NOVA_CONF DEFAULT notify_on_state_change "vm_and_task_state"
+        iniset $NOVA_CONF DEFAULT notify_on_any_change "True"
         iniset_multiline $NOVA_CONF DEFAULT notification_driver "nova.openstack.common.notifier.rpc_notifier" "ceilometer.compute.nova_notifier"
     fi
 
diff --git a/lib/rpc_backend b/lib/rpc_backend
index 4b04053..462e6cc 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -170,8 +170,9 @@
         # Set MATCHMAKER_REDIS_HOST if running multi-node.
         MATCHMAKER_REDIS_HOST=${MATCHMAKER_REDIS_HOST:-127.0.0.1}
         iniset $file matchmaker_redis host $MATCHMAKER_REDIS_HOST
-    elif is_service_enabled qpid; then
+    elif is_service_enabled qpid || [ -n "$QPID_HOST" ]; then
         iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
+        iniset $file $section qpid_hostname $QPID_HOST
         if is_ubuntu; then
             QPID_PASSWORD=`sudo strings /etc/qpid/qpidd.sasldb | grep -B1 admin | head -1`
             iniset $file $section qpid_password $QPID_PASSWORD
diff --git a/lib/tempest b/lib/tempest
index 8a844b9..0e066a8 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -273,6 +273,9 @@
         iniset $TEMPEST_CONF orchestration heat_available "True"
     fi
 
+    # Scenario
+    iniset $TEMPEST_CONF scenario img_dir "$FILES/images/cirros-0.3.1-x86_64-uec"
+
     # Volume
     CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
     if [ $CINDER_MULTI_LVM_BACKEND == "True" ]; then
diff --git a/openrc b/openrc
index adf92b9..a23c6e9 100644
--- a/openrc
+++ b/openrc
@@ -75,6 +75,9 @@
 # Set the pointer to our CA certificate chain.  Harmless if TLS is not used.
 export OS_CACERT=$INT_CA_DIR/ca-chain.pem
 
+# Identity API version
+export OS_IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
+
 # Currently novaclient needs you to specify the *compute api* version.  This
 # needs to match the config of your catalog returned by Keystone.
 export NOVA_VERSION=${NOVA_VERSION:-1.1}
diff --git a/stackrc b/stackrc
index 212d340..50774e4 100644
--- a/stackrc
+++ b/stackrc
@@ -37,6 +37,9 @@
 # Set the default Nova APIs to enable
 NOVA_ENABLED_APIS=ec2,osapi_compute,metadata
 
+# Configure Identity API version: 2.0, 3
+IDENTITY_API_VERSION=2.0
+
 # Whether to use 'dev mode' for screen windows. Dev mode works by
 # stuffing text into the screen windows so that a developer can use
 # ctrl-c, up-arrow, enter to restart the service. Starting services
diff --git a/tools/xen/README.md b/tools/xen/README.md
index 039e660..af54d72 100644
--- a/tools/xen/README.md
+++ b/tools/xen/README.md
@@ -25,15 +25,9 @@
 The `install_os_domU.sh` script will:
  - Setup XenAPI plugins
  - Create the named networks, if they don't exist
- - Install an Ubuntu Virtual Machine, with 4 network interfaces:
-   - eth0 - internal xapi interface
-   - eth1 - VM interface, connected to `VM_BRIDGE_OR_NET_NAME` defaults to
-   `"OpenStack VM Network"`.
-   - eth2 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME`,
-     defaults to `xenbr0`, XenServer's bridge associated with the Hypervisors
-     `eth0`.
-   - eth3 - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` defaults to
-   `"OpenStack Public Network"`.
+ - Preseed-Netinstall an Ubuntu Virtual Machine, with 1 network interface:
+   - eth0 - Connected to `UBUNTU_INST_BRIDGE_OR_NET_NAME`, defaults to
+   `MGT_BRIDGE_OR_NET_NAME`
  - After the Ubuntu install process finished, the network configuration is
  modified to:
    - eth0 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME`
@@ -100,9 +94,6 @@
     # Give extra time for boot
     ACTIVE_TIMEOUT=45
 
-    # Settings for netinstalling Ubuntu
-    UBUNTU_INST_RELEASE=precise
-
     # NOTE: the value of FLAT_NETWORK_BRIDGE will automatically be determined
     # by install_os_domU.sh script.
     EOF
diff --git a/tools/xen/functions b/tools/xen/functions
index 4e37554..3a69a5d 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 function xapi_plugin_location {
-    for PLUGIN_DIR in "/etc/xapi.d/plugins/" "/usr/lib/xcp/plugins/"; do
+    for PLUGIN_DIR in "/etc/xapi.d/plugins/" "/usr/lib/xcp/plugins/" "/usr/lib/xapi/plugins"; do
         if [ -d $PLUGIN_DIR ]; then
             echo $PLUGIN_DIR
             return 0
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index 65eb97c..21aa729 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -199,13 +199,11 @@
     # Update the template
     $THIS_DIR/scripts/install_ubuntu_template.sh $PRESEED_URL
 
-    # create a new VM with the given template
-    # creating the correct VIFs and metadata
+    # create a new VM from the given template with eth0 attached to the given
+    # network
     $THIS_DIR/scripts/install-os-vpx.sh \
         -t "$UBUNTU_INST_TEMPLATE_NAME" \
-        -v "$VM_BRIDGE_OR_NET_NAME" \
-        -m "$MGT_BRIDGE_OR_NET_NAME" \
-        -p "$PUB_BRIDGE_OR_NET_NAME" \
+        -n "$UBUNTU_INST_BRIDGE_OR_NET_NAME" \
         -l "$GUEST_NAME" \
         -r "$OSDOMU_MEM_MB"
 
diff --git a/tools/xen/scripts/install-os-vpx.sh b/tools/xen/scripts/install-os-vpx.sh
index c82f870..8ee8b67 100755
--- a/tools/xen/scripts/install-os-vpx.sh
+++ b/tools/xen/scripts/install-os-vpx.sh
@@ -19,106 +19,48 @@
 
 set -eux
 
-[[ -f "/etc/xensource-inventory" ]] && source "/etc/xensource-inventory" || source "/etc/xcp/inventory"
-
-NAME="XenServer OpenStack VPX"
-DATA_VDI_SIZE="500MiB"
-BRIDGE_M=
-BRIDGE_P=
-VPX_FILE=os-vpx.xva
-AS_TEMPLATE=
-FROM_TEMPLATE=
+BRIDGE=
 RAM=
-WAIT_FOR_NETWORK=
 BALLOONING=
+NAME_LABEL=
+TEMPLATE_NAME=
 
 usage()
 {
 cat << EOF
 
-  Usage: $0 [-f FILE_PATH] [-d DISK_SIZE] [-v BRIDGE_NAME] [-m BRIDGE_NAME] [-p BRIDGE_NAME]
-            [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL]
+  Usage: $0 -t TEMPLATE_NW_INSTALL -l NAME_LABEL [-n BRIDGE] [-r RAM] [-b] 
 
-  Installs XenServer OpenStack VPX.
+  Install a VM from a template
 
   OPTIONS:
 
      -h           Shows this message.
-     -i           Install OpenStack VPX as template.
-     -c           Clone from existing template.
-     -w           Wait for the network settings to show up before exiting.
+     -t template  VM template to use
      -b           Enable memory ballooning. When set min_RAM=RAM/2 max_RAM=RAM.
-     -f path      Specifies the path to the XVA.
-                  Default to ./os-vpx.xva.
-     -d disk-size Specifies the size in MiB for the data disk.
-                  Defaults to 500 MiB.
-     -m bridge    Specifies the bridge for the isolated management network.
-                  Defaults to xenbr0.
-     -v bridge    Specifies the bridge for the vm network
-     -p bridge    Specifies the bridge for the externally facing network.
      -r MiB       Specifies RAM used by the VPX, in MiB.
                   By default it will take the value from the XVA.
      -l name      Specifies the name label for the VM.
-     -t template  Network install an openstack domU from this template
-
-  EXAMPLES:
-
-     Create a VPX that connects to the isolated management network using the
-     default bridge with a data disk of 1GiB:
-            install-os-vpx.sh -f /root/os-vpx-devel.xva -d 1024
-
-     Create a VPX that connects to the isolated management network using xenbr1
-     as bridge:
-            install-os-vpx.sh -m xenbr1
-
-     Create a VPX that connects to both the management and public networks
-     using xenbr1 and xapi4 as bridges:
-            install-os-vpx.sh -m xenbr1 -p xapi4
-
-     Create a VPX that connects to both the management and public networks
-     using the default for management traffic:
-            install-os-vpx.sh -m xapi4
-
+     -n bridge    The bridge/network to use for eth0. Defaults to xenbr0
 EOF
 }
 
 get_params()
 {
-  while getopts "hicwbf:d:v:m:p:r:l:t:" OPTION;
+  while getopts "hbn:r:l:t:" OPTION;
   do
     case $OPTION in
       h) usage
          exit 1
          ;;
-      i)
-         AS_TEMPLATE=1
-         ;;
-      c)
-         FROM_TEMPLATE=1
-         ;;
-      w)
-         WAIT_FOR_NETWORK=1
-         ;;
       b)
          BALLOONING=1
          ;;
-      f)
-         VPX_FILE=$OPTARG
-         ;;
-      d)
-         DATA_VDI_SIZE="${OPTARG}MiB"
-         ;;
-      m)
-         BRIDGE_M=$OPTARG
-         ;;
-      p)
-         BRIDGE_P=$OPTARG
-         ;;
       r)
          RAM=$OPTARG
          ;;
-      v)
-         BRIDGE_V=$OPTARG
+      n)
+         BRIDGE=$OPTARG
          ;;
       l)
          NAME_LABEL=$OPTARG
@@ -132,9 +74,19 @@
          ;;
     esac
   done
-  if [[ -z $BRIDGE_M ]]
+  if [[ -z $BRIDGE ]]
   then
-     BRIDGE_M=xenbr0
+     BRIDGE=xenbr0
+  fi
+
+  if [[ -z $TEMPLATE_NAME ]]; then
+    echo "Please specify a template name" >&2
+    exit 1
+  fi
+
+  if [[ -z $NAME_LABEL ]]; then
+    echo "Please specify a name-label for the new VM" >&2
+    exit 1
   fi
 }
 
@@ -147,34 +99,6 @@
 }
 
 
-get_dest_sr()
-{
-  IFS=,
-  sr_uuids=$(xe sr-list --minimal other-config:i18n-key=local-storage)
-  dest_sr=""
-  for sr_uuid in $sr_uuids
-  do
-    pbd=$(xe pbd-list --minimal sr-uuid=$sr_uuid host-uuid=$INSTALLATION_UUID)
-    if [ "$pbd" ]
-    then
-      echo "$sr_uuid"
-      unset IFS
-      return
-    fi
-  done
-  unset IFS
-
-  dest_sr=$(xe_min sr-list uuid=$(xe_min pool-list params=default-SR))
-  if [ "$dest_sr" = "" ]
-  then
-    echo "No local storage and no default storage; cannot import VPX." >&2
-    exit 1
-  else
-    echo "$dest_sr"
-  fi
-}
-
-
 find_network()
 {
   result=$(xe_min network-list bridge="$1")
@@ -186,137 +110,12 @@
 }
 
 
-find_template()
-{
-  xe_min template-list other-config:os-vpx=true
-}
-
-
-renumber_system_disk()
-{
-  local v="$1"
-  local vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk userdevice=xvda \
-                                   params=vdi-uuid)
-  if [ "$vdi_uuid" ]
-  then
-    local vbd_uuid=$(xe_min vbd-list vm-uuid="$v" vdi-uuid="$vdi_uuid")
-    xe vbd-destroy uuid="$vbd_uuid"
-    local new_vbd_uuid=$(xe vbd-create vm-uuid="$v" vdi-uuid="$vdi_uuid" \
-                         device=0 bootable=true type=Disk)
-    xe vbd-param-set other-config:owner uuid="$new_vbd_uuid"
-  fi
-}
-
-
 create_vif()
 {
-  xe vif-create vm-uuid="$1" network-uuid="$2" device="$3"
-}
-
-create_gi_vif()
-{
   local v="$1"
-  # Note that we've made the outbound device eth1, so that it comes up after
-  # the guest installer VIF, which means that the outbound one wins in terms
-  # of gateway.
-  local gi_network_uuid=$(xe_min network-list \
-                                 other-config:is_guest_installer_network=true)
-  create_vif "$v" "$gi_network_uuid" "0" >/dev/null
-}
-
-create_vm_vif()
-{
-  local v="$1"
-  echo "Installing VM interface on $BRIDGE_V."
-  local out_network_uuid=$(find_network "$BRIDGE_V")
-  create_vif "$v" "$out_network_uuid" "1" >/dev/null
-}
-
-create_management_vif()
-{
-  local v="$1"
-  echo "Installing management interface on $BRIDGE_M."
-  local out_network_uuid=$(find_network "$BRIDGE_M")
-  create_vif "$v" "$out_network_uuid" "2" >/dev/null
-}
-
-
-# This installs the interface for public traffic, only if a bridge is specified
-# The interface is not configured at this stage, but it will be, once the admin
-# tasks are complete for the services of this VPX
-create_public_vif()
-{
-  local v="$1"
-  if [[ -z $BRIDGE_P ]]
-  then
-    echo "Skipping installation of interface for public traffic."
-  else
-    echo "Installing public interface on $BRIDGE_P."
-    pub_network_uuid=$(find_network "$BRIDGE_P")
-    create_vif "$v" "$pub_network_uuid" "3" >/dev/null
-  fi
-}
-
-
-label_system_disk()
-{
-  local v="$1"
-  local vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk userdevice=0 \
-                                   params=vdi-uuid)
-  xe vdi-param-set \
-     name-label="$NAME system disk" \
-     other-config:os-vpx=true \
-     uuid=$vdi_uuid
-}
-
-
-create_data_disk()
-{
-  local v="$1"
-
-  local sys_vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk params=vdi-uuid)
-  local data_vdi_uuid=$(xe_min vdi-list other-config:os-vpx-data=true)
-
-  if echo "$data_vdi_uuid" | grep -q ,
-  then
-    echo "Multiple data disks found -- assuming that you want a new one."
-    data_vdi_uuid=""
-  else
-    data_in_use=$(xe_min vbd-list vdi-uuid="$data_vdi_uuid")
-    if [ "$data_in_use" != "" ]
-    then
-      echo "Data disk already in use -- will create another one."
-      data_vdi_uuid=""
-    fi
-  fi
-
-  if [ "$data_vdi_uuid" = "" ]
-  then
-    echo -n "Creating new data disk ($DATA_VDI_SIZE)... "
-    sr_uuid=$(xe_min vdi-list params=sr-uuid uuid="$sys_vdi_uuid")
-    data_vdi_uuid=$(xe vdi-create name-label="$NAME data disk" \
-                                  sr-uuid="$sr_uuid" \
-                                  type=user \
-                                  virtual-size="$DATA_VDI_SIZE")
-    xe vdi-param-set \
-       other-config:os-vpx-data=true \
-       uuid="$data_vdi_uuid"
-    dom0_uuid=$(xe_min vm-list is-control-domain=true)
-    vbd_uuid=$(xe vbd-create device=autodetect type=Disk \
-                             vdi-uuid="$data_vdi_uuid" vm-uuid="$dom0_uuid")
-    xe vbd-plug uuid=$vbd_uuid
-    dev=$(xe_min vbd-list params=device uuid=$vbd_uuid)
-    mke2fs -q -j -m0 /dev/$dev
-    e2label /dev/$dev vpxstate
-    xe vbd-unplug uuid=$vbd_uuid
-    xe vbd-destroy uuid=$vbd_uuid
-  else
-    echo -n "Attaching old data disk... "
-  fi
-  vbd_uuid=$(xe vbd-create device=2 type=Disk \
-                           vdi-uuid="$data_vdi_uuid" vm-uuid="$v")
-  xe vbd-param-set other-config:os-vpx-data=true uuid=$vbd_uuid
-  echo "done."
+  echo "Installing VM interface on [$BRIDGE]"
+  local out_network_uuid=$(find_network "$BRIDGE")
+  xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0"
 }
 
 
@@ -342,34 +141,6 @@
 }
 
 
-set_all()
-{
-  local v="$1"
-  set_memory "$v"
-  set_auto_start "$v"
-  label_system_disk "$v"
-  create_gi_vif "$v"
-  create_vm_vif "$v"
-  create_management_vif "$v"
-  create_public_vif "$v"
-}
-
-
-log_vifs()
-{
-  local v="$1"
-
-  (IFS=,
-   for vif in $(xe_min vif-list vm-uuid="$v")
-   do
-    dev=$(xe_min vif-list uuid="$vif" params=device)
-    mac=$(xe_min vif-list uuid="$vif" params=MAC | sed -e 's/:/-/g')
-    echo "eth$dev has MAC $mac."
-   done
-   unset IFS) | sort
-}
-
-
 destroy_vifs()
 {
   local v="$1"
@@ -384,116 +155,11 @@
 
 get_params "$@"
 
-thisdir=$(dirname "$0")
-
-if [ "$FROM_TEMPLATE" ]
-then
-  template_uuid=$(find_template)
-  name=$(xe_min template-list params=name-label uuid="$template_uuid")
-  echo -n "Cloning $name... "
-  vm_uuid=$(xe vm-clone vm="$template_uuid" new-name-label="$name")
-  xe vm-param-set is-a-template=false uuid="$vm_uuid"
-  echo $vm_uuid.
-
-  destroy_vifs "$vm_uuid"
-  set_all "$vm_uuid"
-elif [ "$TEMPLATE_NAME" ]
-then
-  echo $TEMPLATE_NAME
-  vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL")
-  destroy_vifs "$vm_uuid"
-  set_auto_start "$vm_uuid"
-  create_gi_vif "$vm_uuid"
-  create_vm_vif "$vm_uuid"
-  create_management_vif "$vm_uuid"
-  create_public_vif "$vm_uuid"
-  xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
-  xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
-  set_memory "$vm_uuid"
-else
-  if [ ! -f "$VPX_FILE" ]
-  then
-      # Search $thisdir/$VPX_FILE too.  In particular, this is used when
-      # installing the VPX from the supp-pack, because we want to be able to
-      # invoke this script from the RPM and the firstboot script.
-      if [ -f "$thisdir/$VPX_FILE" ]
-      then
-          VPX_FILE="$thisdir/$VPX_FILE"
-      else
-          echo "$VPX_FILE does not exist." >&2
-          exit 1
-      fi
-  fi
-
-  echo "Found OS-VPX File: $VPX_FILE. "
-
-  dest_sr=$(get_dest_sr)
-
-  echo -n "Installing $NAME... "
-  vm_uuid=$(xe vm-import filename=$VPX_FILE sr-uuid="$dest_sr")
-  echo $vm_uuid.
-
-  renumber_system_disk "$vm_uuid"
-
-  nl=${NAME_LABEL:-$(xe_min vm-list params=name-label uuid=$vm_uuid)}
-  xe vm-param-set \
-    "name-label=${nl/ import/}" \
-    other-config:os-vpx=true \
-    uuid=$vm_uuid
-
-  set_all "$vm_uuid"
-  create_data_disk "$vm_uuid"
-
-  if [ "$AS_TEMPLATE" ]
-  then
-    xe vm-param-set uuid="$vm_uuid" is-a-template=true \
-                                    other-config:instant=true
-    echo -n "Installing VPX from template... "
-    vm_uuid=$(xe vm-clone vm="$vm_uuid" new-name-label="${nl/ import/}")
-    xe vm-param-set is-a-template=false uuid="$vm_uuid"
-    echo "$vm_uuid."
-  fi
-fi
-
-
-log_vifs "$vm_uuid"
-
-echo -n "Starting VM... "
+vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL")
+destroy_vifs "$vm_uuid"
+set_auto_start "$vm_uuid"
+create_vif "$vm_uuid"
+xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
+xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
+set_memory "$vm_uuid"
 xe vm-start uuid=$vm_uuid
-echo "done."
-
-
-show_ip()
-{
-  ip_addr=$(echo "$1" | sed -n "s,^.*"$2"/ip: \([^;]*\).*$,\1,p")
-  echo -n "IP address for $3: "
-  if [ "$ip_addr" = "" ]
-  then
-    echo "did not appear."
-  else
-    echo "$ip_addr."
-  fi
-}
-
-
-if [ "$WAIT_FOR_NETWORK" ]
-then
-  echo "Waiting for network configuration... "
-  i=0
-  while [ $i -lt 600 ]
-  do
-    ip=$(xe_min vm-list params=networks uuid=$vm_uuid)
-    if [ "$ip" != "<not in database>" ]
-    then
-      show_ip "$ip" "1" "$BRIDGE_M"
-      if [[ $BRIDGE_P ]]
-      then
-        show_ip "$ip" "2" "$BRIDGE_P"
-      fi
-      echo "Installation complete."
-      exit 0
-    fi
-    sleep 10
-    let i=i+1
-  done
-fi
diff --git a/tools/xen/scripts/install_ubuntu_template.sh b/tools/xen/scripts/install_ubuntu_template.sh
index 5cbe2ac..d80ed09 100755
--- a/tools/xen/scripts/install_ubuntu_template.sh
+++ b/tools/xen/scripts/install_ubuntu_template.sh
@@ -53,7 +53,7 @@
 pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 \
 console-setup/ask_detect=false locale=${UBUNTU_INST_LOCALE} \
 keyboard-configuration/layoutcode=${UBUNTU_INST_KEYBOARD} \
-netcfg/choose_interface=${UBUNTU_INST_IFACE} \
+netcfg/choose_interface=eth0 \
 netcfg/get_hostname=os netcfg/get_domain=os auto \
 url=${preseed_url}"
 
diff --git a/tools/xen/scripts/manage-vdi b/tools/xen/scripts/manage-vdi
index 05c4b07..381e671 100755
--- a/tools/xen/scripts/manage-vdi
+++ b/tools/xen/scripts/manage-vdi
@@ -32,7 +32,7 @@
   vbd_uuid=$1
 
   dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
-  if [[ "$dev" =~ "sm/" ]]; then
+  if [[ "$dev" =~ "sm/" || "$dev" =~ "blktap-2/" ]]; then
     DEBIAN_FRONTEND=noninteractive \
         apt-get --option "Dpkg::Options::=--force-confold" --assume-yes \
         install kpartx &> /dev/null || true
@@ -49,7 +49,7 @@
 
 function clean_dev_mappings() {
   dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
-  if [[ "$dev" =~ "sm/" ]]; then
+  if [[ "$dev" =~ "sm/" || "$dev" =~ "blktap-2/" ]]; then
     kpartx -dv "/dev/$dev"
   fi
 }
diff --git a/tools/xen/xenrc b/tools/xen/xenrc
index c343891..97c0930 100644
--- a/tools/xen/xenrc
+++ b/tools/xen/xenrc
@@ -60,8 +60,8 @@
 PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
 
 # Ubuntu install settings
-UBUNTU_INST_RELEASE="oneiric"
-UBUNTU_INST_TEMPLATE_NAME="Ubuntu 11.10 (64-bit) for DevStack"
+UBUNTU_INST_RELEASE="precise"
+UBUNTU_INST_TEMPLATE_NAME="Ubuntu 12.04 (64-bit) for DevStack"
 # For 12.04 use "precise" and update template name
 # However, for 12.04, you should be using
 # XenServer 6.1 and later or XCP 1.6 or later
@@ -72,11 +72,8 @@
 UBUNTU_INST_HTTP_PROXY=""
 UBUNTU_INST_LOCALE="en_US"
 UBUNTU_INST_KEYBOARD="us"
-# network configuration for ubuntu netinstall.
-# TODO(matelakat): get rid of legacy network interfaces
-# specify "eth2" to use the management network
-# specify "eth3" to use the public network
-UBUNTU_INST_IFACE="eth2"
+# network configuration for ubuntu netinstall
+UBUNTU_INST_BRIDGE_OR_NET_NAME=${UBUNTU_INST_BRIDGE_OR_NET_NAME:-"$MGT_BRIDGE_OR_NET_NAME"}
 UBUNTU_INST_IP="dhcp"
 UBUNTU_INST_NAMESERVERS=""
 UBUNTU_INST_NETMASK=""