As discussed in the article Paravirtualization explained, paravirtualization's major advantage is its efficiencies gained by sharing low level access to devices drivers, versus virtualizing every system call to the hardware.
XenSource provides paravirtualization technology with its Xen product line. Xen has multiple versions of its product to meet various organizations needs. For these examples, version 18.104.22.168 of Xen Enterprise was used.
Virtual machine installation
There are two methods to creating a virtual machine within Xen: Installation via the management console and migration of a physical server to a virtual machine using the Xen p2v tool. Using the installation method, Xen supports Debian 3.1, Red Hat Enterprise Linux 4.1 and 4.4. Using the p2v tool, the aforementioned Linux versions are supported in addition to Red Hat Enterprise Linux 3.6 and SUSE Enterprise Server 9 SP2.
In addition to Linux, Xen also supports several Windows operating systems including Windows XP SP2 and various versions of Windows Server 2003.
Xen consists of a hypervisor and virtual machines. The hypervisor is the base Xen Linux install performed on the bear metal machine. The Xen hypervisor and virtual instances are managed using the Xen administrator console as shown in Figure Xen Console. In addition to the console, Xen also provides command line tools to ease automation. The command line tools are installed by default with the initial install of Xen. The administrator console is installed on a separate system.
The xe (Xen execute) command is very useful for determining the status of virtual machines, installing virtual machines, suspending, rebooting, and other tasks that ease automations.
The xe command's first parameter determines whether the command is meant for the hypervisor or a virtual machine. If the first parameter starts with host- then the command is meant for the hypervisor; whereas, a parameter starting with vm- is meant for a virtual machine.
For example, to determine what virtual machines are running on a particular physical machine running the Xen hypervisor execute the xe host-vm-list command:
[root@xen xen]# xe host-vm-list NAME: vm1-rh4-4 uuid: fb896ead-2736-4cdb-ba71-5738e45a6eb9 state: UP NAME: vm2-deb3.1 uuid: 76920c25-34cb-4fcb-b274-d0e90515e96d state: UP
The parameter host-vm-list is meant for a virtual machine (VM) based upon the host- prefix in the parameter. Also both vm1-rh4-4 and vm2-deb3.1 are both running (state: UP). To suspend the Debian VM, the following is executed:
[root@xen xen]# xe vm-suspend vm-name="vm2-deb3.1"
The status of the Debian VM is now shown as suspended:
[root@xen xen]# xe host-vm-list NAME: vm1-rh4-4 uuid: fb896ead-2736-4cdb-ba71-5738e45a6eb9 state: UP NAME: vm2-deb3.1 uuid: 76920c25-34cb-4fcb-b274-d0e90515e96d state: SUSPENDED
To restart (resume) the suspended Debian VM the vm-resume parameter is used:
[root@xen xen]# xe vm-resume vm-name="vm2-deb3.1"
One of the features of Xen is the capability to clone systems. This is a very powerful function that allows administrators to ensure systems are deployed that follow the appropriate locally defined standards. For example, the sys admin will typically install an operating system, install any additional needed tools and programs (monitoring, backup, applications), and then harden the system by shutting down any unnecessary daemons. This is normally executed with each new system. By cloning a system, the admin no longer needs to carry out these tasks since the cloned system will have the same settings as the original.
To clone a VM, the VM machine must be shutdown (using shutdown –h now, for example.) Remember to shutdown the VM NOT the xen hypervisor which will shut down the physical machine including any VMs on the system.
After shutting down the VM the following command executed on the hypervisor will clone the virtual machine:
[root@xen xen]# xe vm-clone vm-name="vm1-rh4-4" new-name="vm3-rh4-4" new-description="RHEL 4.4"
Virtual system maintenance
Xen allows systems to be shutdown and turned on from the hypervisor. To shutdown a VM use the xe vm-shutdown as follows:
[root@xen xen]# xe vm-shutdown vm-name="vm3-rh4-4"
The xe vm-shutdown command executes a clean shutdown on the VM. Should a VM machine be hung up, the vm-shutdown parameter combined with a –force parameter will force a shutdown. The –force is the virtual equivalent to a power off and should be avoided except in thoses cases where the system is hung.
To bring the VM back up, execute the following command:
[root@xen xen]# xe vm-start vm-name="vm3-rh4-4"
If a quick reboot is needed, the xe command also supports a vm-reboot command such as:
[root@xen xen]# xe vm-start vm-name="vm3-rh4-4"
Generally, the VM (vm- parameters) are used most often, since not much maintenance is needed on the hypervisor (host- parameters). However, there are a couple of parameters that are needed on a regular basiss.
host-cpu-list: The host-cpu-list provides an inventory of physical CPU's in the system.
host-licenense-list: Provides information concerning installed licenses including the serial number, account number, and type of license.
host-param-list: Provides the Xen version number and installation date.
By covering several of Xen's common commands and parameters, much of the mystery concerning paravirtualization can be erased. Using Xen is straightforward and provides efficiencies inherent with paravirtualization over other technologies.
About the author: Ronald McCarty is a freelance writer and consultant specializing in systems, network, and information security. He received his bachelor's degree in Computer and Information Systems at the University of Maryland's international campus at Schwaebisch Gmuend, Germany and his master's degree in Management with a specialization in information technology at Capella University. Ron's company, Your Net Guard offers IT consulting and integration services in the Dallas/Forth Worth area. He can be reached at firstname.lastname@example.org.