Virtualization XenServer Lead image: Goss Vitalij, Fotolia
Goss Vitalij, Fotolia
 

Server virtualization with Citrix XenServer

Hot Off the Press

Version 5.6 of Citrix XenServer is a feature-stripped version of the virtualization product and is available free, in addition to the commercial Advanced, Enterprise, and Platinum editions. By Ramon Wartala

In the summer of 2007, Citrix invested around US$ 500 million to acquire XenSource, the developers of the free Xen hypervisor. XenSource and its free hypervisor form the basis for what is probably the biggest rentable cloud today: the Amazon Web Service. On the basis of this extremely mature technology, Citrix launched version 5.6 of its XenServer product family in May 2010. XenServer, the product built around the hypervisor, includes a number of services and additional software tools that help administrators build and manage anything from a simple server to a full-fledged, virtualized data center.

From Xen to XenServer

Currently, four different product versions are available: Free, Advanced, Enterprise, and Platinum. The three commercial products have licensing based on server instances rather than processor cores. Depending on the functional scope, the prices are between US$ 1,000 and US$ 5,000, including 12 months of free upgrades, news, and information.

For server virtualization newcomers, Citrix offers XenServer Free, which you can download [1] without registering. However, you do need to apply for a free license if you run the server for more than 30 days, which means registering on the Citrix website. The license is valid for one year. Besides the XenServer ISO, which installs the host system after you burn it onto a CD, Citrix offers other free services.

In addition to a support CD for installing various Linux guest systems, Citrix offers XenCenter (Figure 1), a Windows-based management application for the host and virtualized guest systems. XenCenter provides a GUI and thus facilitates management of one or more XenServers. To help migrate physical and virtual systems to a XenServer instance, Citrix offers XenConvert, a conversion tool that supports Windows and Linux systems (Figure 2). It supports the VHD, OVF, VMDK, and XVA file formats.

XenCenter – a graphical management tool, but only for Microsoft Windows.
Figure 1: XenCenter – a graphical management tool, but only for Microsoft Windows.
XenConvert converts existing physical or virtual systems.
Figure 2: XenConvert converts existing physical or virtual systems.

XenServer offers both full hardware virtualization (HVM) and paravirtualization (PVM) for guest systems. Hardware-virtualized guest systems use the advanced features of modern x86 CPUs (Intel's VT-x or AMD-V). Paravirtualization works without these processor capabilities but does involve modifying the guest system itself, which is important for low-level drivers. XenServer includes drivers in the form of installable tools for Linux and Windows guest systems.

As of version 5, XenServer is certified for running Windows guests, including an official certificate via the Microsoft Server Virtualization Validated Program (SVVP) for Intel and AMD processors. XenServer supports up to 256GB of RAM, 64 cores, and up to 16 NICs per server. Fibre Channel, NFS, iSCSI, and local disks (Direct Attached) are support as storage. Eight CPUs and a maximum of 32GB can be assigned to each virtual guest.

Several hardware vendors provide drivers and modules for XenServer free of charge. For example, HP offers the System Information System based on the HP SNMP Agent as a free download for XenServer 5.6 and above. Thus, you can load the popular HP system information GUI, which provides a plethora of useful information concerning the server. The SMTP Agent that installs at the same time lets you remotely monitor XenServer using, say, Nagios.

The close link between Citrix and Microsoft is demonstrated by the availability of graphical management tools. Basic management tasks on the host system (Dom0) can be handled using the Curses-based xcconsole and the xe command-line tool. However, XenCenter – the mature, graphical management tool – is only available for Windows. XenCenter makes it easy to start and stop virtual servers and monitor system load. XenCenter lets you log in via the console or the integrated VNC client, which is helpful on systems with a graphical interface after you complete the install.

Snapshots and Backups

Like most other client or server virtualization products, XenServer can also create point-in-time snapshots of the virtual machines (VMs). The product distinguishes between exporting virtual machines to back up files while the virtual machine is stopped and creating live snapshots while the virtual machine is running.

To create snapshots, use one of three approaches: the xe command-line tool on the host system, XenCenter, or a documented API. While the virtual machine is switched off, you can only export to XVA files. Importing snapshots is easy in comparison. A snapshot that you create at server run time acts like a template in XenServer. The Citrix forum includes scripts that create regular backups for a number of virtual machines. Third-party products, such as Alike by QuorumSoft, IC-CIDeR by mySoftIT, or Backup Exec System Recovery by Symantec, add more convenience.

Administrators who aren't afraid of the command line can use a trick to save virtual machines directly. To do so, you need to configure a cronjob on the host system to run a shell script that first creates a snapshot with the xe command-line tool and then exports the snapshot to Xen's own XVA format. After this, you can delete the snapshot and keep backups that are easy to restore.

Test Setup

Installing XenServer on a server system is typically fast and painless, but you'll need to consider network and disk capacities and assignments because these might be difficult to change later, depending on the technology you use. My installation on a HP ProLiant ML350 G6 was easy; I was able to boot the server directly from the XenServer CD. Then, I assigned disk space on the RAID5 system with an LVM filesystem.

Administrators can use templates to set up new VMs. Templates are available for Windows (2000, XP, Vista, 7, Server 2008) and for Linux (CentOS, Debian, Oracle, SUSE); you can handle the set up at the command line on the host system – a Red Hat 4.1.2-based CentOS (kernel v2.6.27), or with the XenCenter application by clicking and installing.

Setting up the hardware for the virtual machines is easy: Specify the number of virtual processors (VCPUs), the RAM size, and local or network-based disk space. To monitor the individual virtual machines and the XenServer itself, use a simple, integrated monitoring tool that quickly reveals memory, CPU, and disk I/O bottlenecks. The free version only gives you historic data from at least 24 hours in the past. The weekly, monthly, and yearly reviews are available only from the Advanced version on. Free RRD tools like Cacti or the RRD-tool for Nagios can easily lift these restrictions.

Need for Speed

Some XenServer users complained about the I/O performance on the guest systems, I was able to measure these speed hits on the HP system compared with the bare metal system. Installing a battery-buffered, 512MB write cache module vastly improved benchmark results that measured multiple, parallel read/write access.

Features

If you plan to implement advanced features such as high availability, including auto-restart and failover technologies, you need a commercial version of XenServer. Administrators can pool servers with identical hardware and migrate virtual machines at run time within the pool (XenMotion). The commercial versions support automatic migration in a failover case. Additionally, XenServer Advanced Edition supports dynamic memory management, which optimizes memory assignments for all guest systems at run time and can assign unused memory to other virtual machines.

Programming for XenServer

A well-documented programming interface (API) lets administrators communicate with the host system at run time and handle recurring tasks. Programming libraries for C#, Java, C, Python, and Microsoft's PowerShell are available from the Citrix Developer Network [2]. Listing 1 uses the Java interface from the XenServer SDK to retrieve a full set of meta-information from the host system.

Listing 1: XenServer API

01 package de.pm.xenserver.test;
02
03 import java.net.URL;
04 import java.util.Map;
05
06 import com.Xensource.xenapi.Connection;
07 import com.Xensource.xenapi.Host;
08 import com.Xensource.xenapi.Session;
09 import com.Xensource.xenapi.Task;
10
11 import de.pm.xenserver.utils.Server;
12
13 public class TestAPI {
14
15     /**
16     * @param args
17     */
18     public static void main(String[] args) throws Exception {
19
20        if (args.length != 3 && args.length != 5)
21        {
22            System.out.println("Expected arguments: <host> <username> <password> [nfs server] [nfs path]");
23            return;
24        }
25
26        Server server = new Server(args[0], args[1], args[2]);
27        URL url = new URL("http://" + server.getHostname());
28        final Connection con = new Connection(url);
29        Session session = Session.loginWithPassword(con, server.getUsername(), server.getPassword(), "1.3");
30
31        Host host = session.getThisHost(con);
32
33        Map<Host, Host.Record> allhostrecs = host.getAllRecords(con);
34        System.out.println("got: " + allhostrecs.size() + " records");
35        if (allhostrecs.size() > 0)
36        {
37            System.out.println(allhostrecs.values().toArray()[0].toString());
38        }
39
40        Map<Task, Task.Record> allrecords = Task.getAllRecords(con);
41        System.out.println("got: " + allrecords.size() + " records");
42        if (allrecords.size() > 0)
43        {
44            System.out.println(allrecords.values().toArray()[0].toString());
45        }
46
47        Session.logout(con);
48     }
49
50 }

Practical Experience

Low-budget servers have long since gained the ability to run more than one application at any given time. Capabilities restricted to expensive mainframes back in the 1970s have now found their way into classic x86 hardware. Multicore systems with sufficient RAM can easily run a handful of virtual server systems today. This capability not only reduces power and space requirements but also facilitates the handling of individual systems.

Permanent competition between VMware, Citrix, and even Microsoft has added features to the free entry-level versions in recent years. The free XenServer version will be fine for small businesses. However, if you need automatic memory management, high-availability options, and advanced reporting and monitoring, the Advanced version for around US$ 1,000 (EUR 750) per server will take you a long way.

If you intend to virtualize both Windows and Linux systems, the current version of XenServer is a good choice [3] [4] [5]. The listing for this article is available from the Admin magazine website [6].