Appendix B.  Lab 2

Appendix B.  Lab 2

Appendix B.  Lab 2

Live Migration

Goal:To configure and perform a live migration between two hosts.

Setup at Start:Two workstations installed with Red Hat Enterprise Linux 5 beta 2/ Virtualization Platform, and a Fedora Core 6 Xen guest on one of the two workstations.

In this lab, we will configure and perform a live migration between two hosts.

Introduction: Before we begin

In this lab, we will need two Xen hosts, a Xen guest, and a shared storage. The two Xen hosts will be connected via a UTP cable. One of the Xen hosts will be exporting a shared storage via NFS. Both of the Xen hosts will be configured so that we can perform a live migration. The Xen guest will reside on the shared storage. In the Xen guest, we will be installing a streaming server. We will be making sure that our streaming server still runs without any interruptions in our Xen guest while a live migration is being performed from one Xen host to another. To make it less complicated, we will refer the two Xen hosts as host1 and host2.

Sequence 1: Configuring Xend (Both Xen hosts)

In this sequence, we will configure Xend to start up as a HTTP server as well as a relocation server. By default, Xend does not start a HTTP server. It does start a Unix domain socket management server for xm to communicate with Xend. But in order to support cross-machine live migration, this support has to be enabled.

  1. Make a backup of your xend-config.sxp file:cp -pr /etc/xen/xend-config.sxp /etc/xen/xend-config.sxp.default

  2. Edit /etc/xen/xend-config.sxp and make the following changes:#(xend-unix-server yes)(xend-relocation-server yes)(xend-relocation-port 8002)(xend-relocation-address '')(xend-relocation-hosts-allow '')#(xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')

  3. Restart Xend:service xend restart

Sequence 2: Exporting a shared storage via NFS (Host1)

In this sequence, we will configure NFS and export a shared storage via NFS.

  1. Edit /etc/exports and add in the following line:/xen *(rw,sync,no_root_squash)

  2. Save /etc/exports and restart the NFS server. Make sure that the NFS server starts by default:service nfs startchkconfig nfs on

  3. After starting the NFS server on host1, we can then mount it on host2:mount host1:/xen /xen

  4. Proceed to start Xen guest on host1 (choose fc6-pv1 or fc6-pv2 from Lab 1):xm create -c fc6-pv1

Sequence 3: Installing a streaming server (Xen guest)

In this sequence, we will install a streaming server, gnump3d, for our demonstration purposes. We choose gnump3d because it supports OGG vorbis files and it is easy to install, configure and use.

  1. Download gnump3d-2.9.9.9.tar.bz2 tarball from http://www.gnump3d.org/. Unpack the tarball and in the gnump3d-2.9.9.9/ directory, compile and install the gnump3d application:tar xvjf gnump3d-2.9.9.9.tar.bz2cd gnump3d-2.9.9.9/make install

  2. Create a /home/mp3 directory and copy TruthHappens.ogg from Red Hat's Truth Happens page.mkdir /home/mp3wget -c http://www.redhat.com/v/ogg/TruthHappens.ogg

  3. Start the streaming server by running the following command:gnump3d &

  4. On either one of the two Xen hosts, start running the Movie Player. If it is not installed, then install the totem and iso-codecs rpms before running the Movie Player. Click Applications, then Sound & Video, and finally Movie Player.

  5. Click Movie, then Open Location. Enter http://guest:8888/TruthHappens.ogg.

Sequence 4: Performing live migration

  1. Make sure that the TruthHappens.ogg file is playing on one of the two Xen hosts.

  2. Perform the live migration from host1 to host2 by running the following command:xm migrate –live fc6-pv1 host2

  3. Try to open multiple terminal windows on both Xen hosts with the following command:watch -n1 xm list

  4. Watch how the live migration is performed. Take note how long it took.

Challenge Sequence: Configuring VNC server from within the Xen guest

If time permits, from within the Xen guest, try to configure the VNC server to start up when gdm starts up. Run VNC viewer and connect to the Xen guest. Try to play with the Xen guest when the live migration is being performed. Try to pause and resume, save and restore the Xen guest and see what happens to the VNC viewer. If you try to connect to the VNC viewer via localhost:590x, and do a live migration, you won't be able to connect to the VNC viewer again when it dies. This is a known bug.