Xenserver

From SingletonMillerWiki
Revision as of 13:04, 11 August 2013 by Martin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This project shows you how to install and configure the Free Open Source Virtualisation system XenServer. [1] This article applies to Xenserver v6.2

Equipment Required

  1. Virtualisation capable Multicore PC (Host) [2]
  2. monitor, keyboard attached to the host.
  3. Windows PC for remote server administration

Software Required

Download both the Xenserver Installation ISO and the XenCenter Windows Management Console software from [3]

Installing XenServer and XenCenter

Installing XenServer on a physical host

Burn the Xenserver installation ISO to a CD Rom. Making a bootable USB stick is a viable alternative for hosts that doesn't have a suitable optical drive. UNetbootin [4] can burn the ISO to a usb stick.

Before you start check the Host BIOS setting for virtualisation are enabled, you're looking for settings for VT-d.

Boot the host to the installation media, you may need to select the media at boot time using <backspace>, <F12>. Refer to your system manual for how to select which media to boot from.

  1. Following the initial boot messages and the Welcome to XenServer screen, select your keyboard layout for the installation.
  2. Read and accept the XenServer End User License Agreement (EULA).
  3. Select perform a clean installation.
  4. If you have multiple hard disks, choose a Primary Disk for the installation. Select Ok
  5. Choose which disk(s) you would like to use for virtual machine storage. Choose Ok.
  6. Select Local media as your installation source
  7. When prompted about if you would like to install any supplemental packs, choose No to continue
  8. Select Skip Verification, and then choose Ok.
  9. Set and confirm a root password --IMPORTANT-- for server security enter a stong password. [5]
  10. Select the settings for your network (the defaults for Hostname and DHCP is usually fine)
  11. Select your time zone — the geographical area and then city
  12. Enable NTP
  13. Select Install XenServer.
  14. From the Installation Complete screen, --eject the installation media --, and then select Ok to reboot

the server.

After the reboot the monitor should show the admin console, make a note of the IP address of the server, this is required for the next step. <Optional> Login to your router and bind the IP address above to the MAC address of the host so the IP address will be static the next time the server reboots.

Installing XenCenter on windows

XenCenter is the remote administration tool for Xenserver. Install the software using the installation package downloaded previously.

Initial XenCentre

Connecting XenCenter to the XenServer host

Whilst its possible to do most administrative tasks directly via the Xenserver console, Xencentre provides an easy means of administration remotely or when you have multiple servers.

Add the IP and password for your server

Activating XenServer

When you install XenServer it starts in an unlicensed state. When it is unlicensed, there are no restrictions on its functionality or features, with the exception of the application of hotfixes using XenCenter. In order to receive updates, XenServer hosts must be licensed.

To license XenServer, you must buy and download a license file from Citrix.com and install one of the following Citrix license servers.

Creating Virtual Machines

A new VM requires an installation ISO for local or remote access.

Select the New VM from the XenCentre utility.

Creating a Windows VM

Select the required Windows Template

Install your media in the host and follow the normal installation process.

Creating a Linux VM

I've found that selecting the correct linux template does always work and that selecting 'Other install media' provided better results.

Installation of Xenserver Tools

Install the xenserver tools to each VM using XenCentre menu VM / Install Xenserver tools. These tools provide access to advanced features in your VM.

Hardware Passthrough

GPU passthrough

Right click on the VM entry in the XenCentre, select the properties. If the VM is shutdown the GPU can be selected to be passed through to the VM. Once the GPU is assigned and the VM restarted then the XenCentre

Select the required Windows Template

When a GPU is

SATA Direct Local Disk Access

The following assumes that your server has additional drives that were added after xenserver was installed or were excluded from the integration in to the LVM for the system. The most common reason for doing this is that you have a removeable drive or want completely seperate storage for a VM.

To determine which devices are already used by the system

# df -h | grep sd
/dev/sdc1             4.0G  1.9G  2.0G  50% /

Here the only drive used by xenserver is /dev/sdc.

To determine which harddrives are available

# fdisk -l | grep /dev/sd

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sda: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdc: 80.0 GB, 80026361856 bytes
/dev/sdc1   *           1        9692    78150743+  ee  EFI GPT

Drives /dev/sda and /dev/sdb are installed but not used by the system.

Following instructions where found here [6]. In order to get Xenserver to recognize the SATA drive we’ll need to create some symbolic links in the hypervisor’s /dev/xapi/block directory

SSH in to your xenserver using a user with admin privledges. Edit the config file using

# nano /etc/udev/rules.d/50-udev.rules

assuming the drive is device /dev/sdb append the following lines to the file.

ACTION=="add", KERNEL=="sdb", SYMLINK+="xapi/block/%k", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
ACTION=="remove", KERNEL=="sdb", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"

You can add additional lines for additional devices (such as sdc, sdd) if you wish.

Save and reboot Xenserver. Your attached SATA hard disk should now be recognized as a removable storage device, which can now be attached to a virtual machine via the XenCenter console. It’ll be using an emulated SCSI controller instead of USB, which means full read/write throughput! Don’t forget to attach/detach the drive via XenCenter to/from the VM of your choice – while it’s physically “hot swapable”, you can’t just yank the physical drive out of a running VM that’s using it.

PCI Passthrough

Identify the device ID of the PCI bus you wish to passthrough, run the following on the xenserver via SSH.

# lspci

Im looking for the TV cards

01:00.0 Multimedia video controller: Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder (rev 04)
02:00.0 Multimedia controller: Philips Semiconductors SAA7160 (rev 03)

The required deviceIDs are 01:00.0 and 02:00.0.

Now edit /boot/extlinux.conf and add pciback.hide=(01:00.0) after the splash command.

# nano /boot/extlinux.conf
label xe
  # XenServer
  kernel mboot.c32
  append .... $console=tty0 quiet vga=785 splash pciback.hide=(01:00.0)(02:00.0) --- /boot/initrd-2.6-xen.i$

Multiple device can be appended to the pciback.hide as pciback.hide=(01:00.0)(02:00.0). Once the file is edited execute the following

# extlinux -i /boot

run xe vm-list to find the VM uuid

# xe vm-list
uuid ( RO)           : 5a8495dc-3b56-9544-e844-0950a2beaa74
     name-label ( RW): Mythbuntu
    power-state ( RO): halted


uuid ( RO)           : ee7b6e2d-723a-43ee-bec8-7bb7757b2faa
     name-label ( RW): Control domain on host: xenserver
    power-state ( RO): running

Shutdown all the VMs on the server and then reboot it. After the reboot, login and set the vm paramters for the deviceID and the VM uuid. For one device

# xe vm-param-set other-config:pci=0/0000:01:00.0 uuid=5a8495dc-3b56-9544-e844-0950a2beaa74

or multiple devices seperate the ID with a ','. remember the leading '0/', eg.

# xe vm-param-set other-config:pci=0/0000:01:00.0,0/0000:02:00.0 uuid=5a8495dc-3b56-9544-e844-0950a2beaa74

Start the VM via XenCentre or the CLI using

# xe vm-start uuid=5a8495dc-3b56-9544-e844-0950a2beaa74

use lspci on the VM to check the passthrough is working.

$  lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 SCSI storage controller: XenSource, Inc. Xen Platform Device (rev 01)
00:05.0 Multimedia controller: Philips Semiconductors SAA7160 (rev 03)
00:06.0 Multimedia video controller: Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder (rev 04)

Success!

Keyboard and Mouse Passthrough

TODO

Remote Control Passthrough

TODO

References

  1. Xenserver
  2. Xenserver hardware compatability
  3. XenCenter Software Download Centre
  4. UNetbootin bootable USB utility
  5. Password Selection Advice
  6. SATA drive passthrough
  7. http://www.xenserver.org/