tools/xen/README.md
bbf56237
 # Getting Started With XenServer and Devstack
b62b4ca2
 
bbf56237
 The purpose of the code in this directory it to help developers bootstrap a
2b69f236
 XenServer 6.2 (older versions may also work) + OpenStack development
bbf56237
 environment. This file gives some pointers on how to get started.
 
 Xenserver is a Type 1 hypervisor, so it is best installed on bare metal.  The
2b69f236
 OpenStack services are configured to run within a virtual machine (called OS
bbf56237
 domU) on the XenServer host. The VM uses the XAPI toolstack to communicate with
 the host over a network connection (see `MGT_BRIDGE_OR_NET_NAME`).
c56885ad
 
9e326779
 The provided localrc helps to build a basic environment.
bbf56237
 
 ## Introduction
 
 ### Requirements
 
9e326779
  - An internet-enabled network with a DHCP server on it
  - XenServer box plugged in to the same network
 This network will be used as the OpenStack management network. The VM Network
 and the Public Network will not be connected to any physical interfaces, only
 new virtual networks will be created by the `install_os_domU.sh` script.
 
bbf56237
 ### Steps to follow
 
9e326779
  - Install XenServer
  - Download Devstack to XenServer
  - Customise `localrc`
  - Start `install_os_domU.sh` script
 
bbf56237
 ### Brief explanation
 
9e326779
 The `install_os_domU.sh` script will:
  - Setup XenAPI plugins
  - Create the named networks, if they don't exist
bbf56237
  - Preseed-Netinstall an Ubuntu Virtual Machine (NOTE: you can save and reuse
    it, see [Reuse the Ubuntu VM](#reuse-the-ubuntu-vm)), with 1 network
    interface:
    - `eth0` - Connected to `UBUNTU_INST_BRIDGE_OR_NET_NAME`, defaults to
      `MGT_BRIDGE_OR_NET_NAME`
5a56cd62
  - After the Ubuntu install process finished, the network configuration is
  modified to:
bbf56237
    - `eth0` - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME`. Xapi
      must be accessible through this network.
    - `eth1` - VM interface, connected to `VM_BRIDGE_OR_NET_NAME`
    - `eth2` - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME`
9e326779
  - Start devstack inside the created OpenStack VM
 
0b3804bf
 ## Step 1: Install Xenserver
bbf56237
 Install XenServer on a clean box. You can download the latest XenServer for
 free from: http://www.xenserver.org/
c56885ad
 
9e326779
 The XenServer IP configuration depends on your local network setup. If you are
 using dhcp, make a reservation for XenServer, so its IP address won't change
 over time. Make a note of the XenServer's IP address, as it has to be specified
 in `localrc`. The other option is to manually specify the IP setup for the
 XenServer box. Please make sure, that a gateway and a nameserver is configured,
 as `install_os_domU.sh` will connect to github.com to get source-code snapshots.
b62b4ca2
 
0b3804bf
 ## Step 2: Download devstack
c0ae3164
 On your XenServer host, run the following commands as root:
b62b4ca2
 
a814f22c
     wget --no-check-certificate https://github.com/openstack-dev/devstack/zipball/master
     unzip -o master -d ./devstack
     cd devstack/*/
b62b4ca2
 
0b3804bf
 ## Step 3: Configure your localrc inside the devstack directory
ca85b799
 Devstack uses a localrc for user-specific configuration.  Note that
9e326779
 the `XENAPI_PASSWORD` must be your dom0 root password.
3eb8f59d
 Of course, use real passwords if this machine is exposed.
b62b4ca2
 
c0ae3164
     cat > ./localrc <<EOF
2781f3bf
     # At the moment, we depend on github's snapshot function.
     GIT_BASE="http://github.com"
 
9e326779
     # Passwords
     # NOTE: these need to be specified, otherwise devstack will try
     # to prompt for these passwords, blocking the install process.
 
b62b4ca2
     MYSQL_PASSWORD=my_super_secret
     SERVICE_TOKEN=my_super_secret
     ADMIN_PASSWORD=my_super_secret
0b3804bf
     SERVICE_PASSWORD=my_super_secret
b62b4ca2
     RABBIT_PASSWORD=my_super_secret
0b3804bf
     SWIFT_HASH="66a3d6b56c1f479c8b4e70ab5c2000f5"
9e326779
     # This will be the password for the OpenStack VM (both stack and root users)
3eb8f59d
     GUEST_PASSWORD=my_super_secret
0b3804bf
 
     # XenAPI parameters
9e326779
     # NOTE: The following must be set to your XenServer root password!
 
0b3804bf
     XENAPI_PASSWORD=my_xenserver_root_password
9e326779
 
0b3804bf
     XENAPI_CONNECTION_URL="http://address_of_your_xenserver"
     VNCSERVER_PROXYCLIENT_ADDRESS=address_of_your_xenserver
 
bbf56237
     # Explicitly set virt driver
1de18c62
     VIRT_DRIVER=xenserver
bbf56237
 
     # Explicitly enable multi-host for nova-network HA
1de18c62
     MULTI_HOST=1
bbf56237
 
1de18c62
     # Give extra time for boot
     ACTIVE_TIMEOUT=45
0b3804bf
 
b62b4ca2
     EOF
 
0b3804bf
 ## Step 4: Run `./install_os_domU.sh` from the `tools/xen` directory
1188904e
 
0b3804bf
     cd tools/xen
     ./install_os_domU.sh
c56885ad
 
0b3804bf
 Once this script finishes executing, log into the VM (openstack domU) that it
 installed and tail the run.sh.log file. You will need to wait until it run.sh
 has finished executing.
1188904e
 
bbf56237
 # Appendix
 
 This section contains useful information for running devstack in CI
 environments / using ubuntu network mirrors.
 
 ## Use a specific Ubuntu mirror for installation
 
 To speed up the Ubuntu installation, you can use a specific mirror. To specify
 a mirror explicitly, include the following settings in your `localrc` file:
 
     UBUNTU_INST_HTTP_HOSTNAME="archive.ubuntu.com"
     UBUNTU_INST_HTTP_DIRECTORY="/ubuntu"
 
 These variables set the `mirror/http/hostname` and `mirror/http/directory`
 settings in the ubuntu preseed file. The minimal ubuntu VM will use the
 specified parameters.
 
 ## Use an http proxy to speed up Ubuntu installation
 
 To further speed up the Ubuntu VM and package installation, an internal http
 proxy could be used. `squid-deb-proxy` has prooven to be stable. To use an http
 proxy, specify:
 
     UBUNTU_INST_HTTP_PROXY="http://ubuntu-proxy.somedomain.com:8000"
 
 in your `localrc` file.
 
 ## Reuse the Ubuntu VM
 
 Performing a minimal ubuntu installation could take a lot of time, depending on
 your mirror/network speed. If you run `install_os_domU.sh` script on a clean
 hypervisor, you can speed up the installation, by re-using the ubuntu vm from
 a previous installation.
 
 ### Export the Ubuntu VM to an XVA
 
 Given you have an nfs export `TEMPLATE_NFS_DIR`:
 
     TEMPLATE_FILENAME=devstack-jeos.xva
     TEMPLATE_NAME=jeos_template_for_devstack
     mountdir=$(mktemp -d)
     mount -t nfs "$TEMPLATE_NFS_DIR" "$mountdir"
     VM="$(xe template-list name-label="$TEMPLATE_NAME" --minimal)"
     xe template-export template-uuid=$VM filename="$mountdir/$TEMPLATE_FILENAME"
     umount "$mountdir"
     rm -rf "$mountdir"
 
 ### Import the Ubuntu VM
 
 Given you have an nfs export `TEMPLATE_NFS_DIR` where you exported the Ubuntu
 VM as `TEMPLATE_FILENAME`:
daadf744
 
bbf56237
     mountdir=$(mktemp -d)
     mount -t nfs "$TEMPLATE_NFS_DIR" "$mountdir"
     xe vm-import filename="$mountdir/$TEMPLATE_FILENAME"
     umount "$mountdir"
     rm -rf "$mountdir"