How to Use OpenSolaris xVM Live Migration to Balance Workloads Across Servers
The OpenSolaris xVM hypervisor virtualization system executes multiple operating system instances simultaneously on a single machine. Each instance is called a guest or an unprivileged domain (domU). The Live Migration procedure is used to move these guest virtual machine instances across computers. This capability can be used for load balancing among a collection of machines.
Before You Begin
The following prerequisites apply:
- Both the source machine and the target host must be on the same subnet.
- The host and the target must each have the same CPU type (AMD-V or Intel-VT).
- Both systems must be running the same release of the xVM software.
- There must be sufficient CPU and memory resources on the target to host the domain.
- The target OpenSolaris control domain (dom0) should have the same network interface as the source dom0 network interface used by the domU. For example, if the domU to be migrated has a VNIC that is bridged over the e1000g0 interface on the source dom0, then the target dom0 must also have the e1000g0 interface.
Steps
- Enable Live Migration on a target host
By default, xend listens only on the loopback address for requests from the localhost. The target host must be configured to accept the migration of a guest domain. The following example configures the xend SMF service on the target machine to accept guest migration from a system named host1. The caret (^) and dollar sign ($) are pattern-matching characters to ensure that the entire host name matches. The host1 name must match the name the target thinks the machine is called, which could be a host name, but could also be a fully qualified domain name (FQDN).# svccfg -s svc:system/xvm/xend svc:/system/xvm/xend> setprop config/xend-relocation-address = "" svc:/system/xvm/xend> setprop config/xend-relocation-hosts-allow = "^host1\.?.*$ ^localhost$" svc:/system/xvm/xend> end # svcadm refresh svc:system/xvm/xend:default && \ svcadm restart svc:system/xvm/xend:default
- (Optional) Test the connection
host1# telnet target-host 8002
If connection fails, check the /var/log/xen/xend.log file on the target system.
- Configure the guest domain to be migrated
In addition to configuring the target system to accept migrations, you must also configure the domain that will be migrated so that the domain's storage is accessible from both the source and the target systems. The domain's accessible disks must reside on some form of shared storage, such as NFS files or iSCSI volumes. This NFS method is available in the OpenSolaris 2009.06 release.
- Prepare the NFS Storage on the NFS Server
On the NFS server, share the directory:# sharectl set -p nfsmapid_domain=sun.com nfs # svcadm restart svc:/network/nfs/mapid:default # share -F nfs -o "sec=sys,root=host1:host2,rw" /vdisks
On both the host1 source system and host2 target system, also execute the sharectl to set the NFS mapid name to sun.com, and the svcadm command restart the xend service.
- Create a PV Guest on the Source Machine (host1)
Type as one line.# virt-install -p --nographics -n domain -r 1024 -l /isos/os0906/os0906.iso -f /net/hostname_of_nfs_server/vdisks/testpv
The virt-install command then creates the virtual disk on the NFS server and starts the guest installation process.
- Prepare the NFS Storage on the NFS Server
- Migrate the guest domain
host1# virsh migrate domain --live xen:// xenmigr://target-host
Note -
While the use of the virsh command is preferred, you can try the following command if the virsh command does not succeed.host1# xm migrate -l domain target-host
You can observe the migration while it occurs by monitoring the domain status on both machines using virsh list.
Note that the domain definition remains on the system on which it was created. You can start the domain on that system's dom0 with the virsh start domain command.

