Virtual Machine Manager

Copyright (C) 2009 France Telecom

Documentation

Reference

Drivers

Xen driver overview

The Xen driver allows to manage a server pool made up of host machines running the Xen hypervisor (version 3.2+). The VMM agent driver communicates with every host of the pool through the Xen-API protocol and SSH.

The SSH interface, to some extent, insulates the VMM agent driver from specific choices regarding how Xen virtual machines are created and handled, in particular regarding the type of storage for VM disks (file-backed images, disk partition, LVM etc.).

The Xen driver makes the assumption that all hosts of a Xen-driven server pool share storage and are located on the same subnet so that live migration of VM is possible between any pair of hosts within the pool.

Xen driver installation instructions

The following steps must be performed for each host of a Xen-driven server pool:

  • Configure the Xend configuration file so that the Xen-API server is listening on a given TCP port (note that SSL is not supported by the VMM agent Xen driver). For instance, the following line makes the Xen-API server listen on port 9363 with unconditional access from any remote machine:

    (xen-api-server ((9363 'none')))

  • Configure the Xend configuration file so that connections to the Xend relocation interface from any host within the server pool is allowed (required for live migration of VM):

    (xend-relocation-hosts-allow '')

  • Permit root SSH login and optionally install a SSH public key to allow key-based authentification of SSH connections initiated by the VMM agent
  • Install the host-based Xen driver scripts tarball (e.g. in the /opt directory) and makes sure that the bin subdirectory containing shell scripts is included in the PATH used for remote SSH logins.

Set-up a Virtual Machine image repository for the server pool: see next section.

On the VMM agent side, specify the membership of the Xen-driver server pool in the domain XML configuration file of the agent with properties that match the connection parameters set-up previously.


Xen Virtual Image repository

The VirtualMachineImageStoreMXBean resource is implemented by the Xen driver as a shared directory mounted by every host of a Xen-driven server pool under the same name. The name of this directory needs to be specified as a property of the server pool (default name is /var/xen/images/templates). This directory is typically a shared directory mounted by NFS, iSCSI or on a cluster filesystem.

A Xen virtual image template consists of two files:

  • a simple metadata file called <uuid>.xml where <uuid> is the unique ID of the template
  • the disk image file proper

The metadata XML file syntax is as follows:

<virtualMachineImage name="Rubis Virtual Appliance" uuid="vmiAAFFAAFF">
<description>Rubis Virtual Appliance</description>
<imageFile>vmiAAFFAAFF.img</imageFile>
</virtualMachineImage>

The disk image file must be a raw filesystem image. In order to be compatible with the bundled Xen driver host-based shell scripts, the following requirements must be met:

  • the image should contain a single partition (mount as "/"), LVM volumes are not allowed.
  • the guest Linux OS should mount the /dev/sda1 device as root ("/") and the /dev/sda2 device as /swap.

This repository must populated manually. Virtual image UUIDs assignement is not the responsability if the Xen driver. The only requirement is that virtual image UUID start with "vmi".

 

 

Xen Driver Properties

The following properties can be set on a per-server-pool basis:

Name Default value Description
vmImageStoreDir /var/xen/images/templates directory mounted on every host of the server pool which stores the VM image templates available to the pool.
sshDefaultRootPassword none Root password for every host of the server pool unless supeseded by a host specific password
sshDefaultPrivateKeyFile none File name of the SSH private key to be used for key-based SSH authentification with every host of the pool (unless superseded by host-specific attributes)
xenapiDefaultUser root login name for the XenAPI connection for every host of the server pool
xenapiDefaultPassword none password for the XenAPI connection for every host of the server pool
xenapiDefaulPort 9363 port number of the XenAPI connection for every host of the server pool

 

Xen Driver sample resource configuration

The following resource file creates a single ServerPool driven by the Xen driver and consisting of three hosts:
<?xml version="1.0" encoding="UTF-8"?>

<domain name="ProjectXYZ"> <serverPool name="ServerFarm-dev" driver="xen" properties="xen-farm.props"> <host name="i-server01.foobar.org" /> <host name="i-server02.foobar.org" /> <host name="i-server03.foobar.org" sshRootPassword="YYY"/> </serverPool> </domain>

The xen-farm.props file is as follows

vmImageStoreDir=/var/xen/images/templates
sshDefaultPrivateKeyFile=/home/vmm/.ssh/id_rsa
xenapiDefaultUser = root
xenapiDefaultPassword = XXXX
xenapiDefaulPort = 9363

The Xen driver will use key-based SSH authentification for host machines i-server01 and i-server02. SSH connection to i-server03 will be performed with root password "YYY".

 

Xen driver host-based script interface

Script name Usage Function
createVM createVM -d <diskSizeMB> -t <VM template filename> -m <memoryMB> -c <numCPUs> -u <vmUUID> <vmLabel> Creates a new VM
destroyVM destroyVM <vmLabel> Destroys the specified VM including its disk(s)
shutdownVM shutdown <vmLabel> Shutdowns te specified VM
suspendVM suspendVM <vmLabel> Suspend the VM with the provided name label
resumeVM resumeVM <vmLabel> Resume the VM with the provided name label
startVM startVM <vmLabel> Start the VM with the specified name
migrateVM migrateVM <vmLabel> <targetHostName> Live migrate the VM with the specified label to the specified target host
makeNewVMTemplate makeNewVMTemplate -u <vmTemplateUUID> -n <symbolic template name> -d <template description> <vmLabel> <template directory> Creates a new VM image template by taking a snapshot of VM named <vmName> on the host
getIPfromMAC.sh getIPfromMAC.sh <MAC address> Determines the IP address of the VM default NIC with the supplied MAC address

Xen driver default script suite

The default scripts bundled with the VMM Xen driver handle Xen virtual machines as follows:

  • all virtual machines are paravirtualized using the same paravirtualized Linux kernel and inird files
  • Running Xen virtual machines use file-backed images. Preparing the disk of a VM boils down to a file copy of the template image followed by a resizing of the image disk
  • Migration of Xen VMs requires that key-based SSH login is possible between any pair of hosts within a Xen-driven server pool