Live migration of virtual machines with KVM

Movers

Management Tools for KVM

Instead of virsh, you will want to use more sophisticated management tools for a production setup, such as oVirt, the open source project based on the Red Hat Enterprise Virtualization Manager (RHEV-M).

In production environments, the management instance of oVirt or RHEV-M should reside on a separate computer with at least 4GB of memory and 20GB of disk space. You also need one or several virtualization hosts, in which both the VMs and a software component named VDSM (Virtual Desktop Server Manager) run; the latter communicates with the central server.

The easiest way is to install on CentOS or Red Hat Enterprise Linux, but the oVirt website also has some tips for installing on Ubuntu and Debian. In the case of CentOS and RHEL, first add the package sources:

yum localinstall http://resources.ovirt.org/pub/yum-repo/ovirt-release35.rpm

then install the software using yum -y install ovirt-engine. Next, you can configure the software using engine-setup; you can accept the defaults in most cases.

Also for oVirt, you need to think about the firewall configuration and open numerous ports; the best place to find out which ones is from the oVirt FAQ [2]. Alternatively, oVirt offers to handle firewall management during the installation, but only on the management server.

Once OVirt is running, you can reach the web interface on https://oVirt-Server-ovirt-engine . Log in to the administration portal to complete the configuration of the data center. In addition to the virtual machine hosts, you also need a storage domain (e.g., based on NFS). If you use a Linux machine, you need to configure special options when exporting the filesystem for collaboration with oVirt to work:

/virtstore 192.168.100.0/24(rw,anonuid=36,anongid=36,all_squash)

If the installation of a VM host fails, check the firewall settings and make sure that the oVirt repository is entered on the host. If the oVirt Manager manages to install the required VDSM software on the host, it then switches the status to "active." Along with the storage domain, you now have a functioning data center.

To install a virtual machine, you need a template; the easiest approach is to take one from the existing Glance repository. To do this, first click on Data Centers | Default in the left column and select the Storage tab at the top. Right-click on the ovirt-image-repository domain; you can now import the available images as templates and easily migrate VMs between two hosts at the push of a button. Alternatively, oVirt offers a number of ways to migrate VMs automatically, for example, when a node is put into maintenance mode. For load balancing, you can set up a migration policy. Figure 2 shows what a successful migration looks like in the oVirt event log.

Figure 2: The VM migration from node1 to node2 took 10 seconds with oVirt.

oVirt is a comprehensive software tool that requires some training time, just like RHEV-M. For smaller setups, you have several more-or-less sophisticated alternatives, which the KVM project lists on its own page [3]. One highlight here is Proxmox VE; openQRM  [4] takes a further step in the direction of cloud management.

One interesting and much appreciated, but not widely known, alternative is Ganeti, a project by Google Labs. Although it only offers a command-line interface, it can be controlled with just a few commands. The only obstacle is the non-trivial installation, which is described in the documentation on Ubuntu and Debian machines. I did manage to get Ganeti up and running on CentOS in the lab without major problems.

The potentially biggest hurdle is the inconsistent use of hostnames. Your best bet is to have a functioning DNS, in which the names of the participating computers are configured. Alternatively, you can enter the names in the hosts file, but then you need to pay attention to consistency. In addition to the IP addresses and names for each node, you need another IP/name combination, which is used for the cluster.

Shared storage for Ganeti is provided by the distributed replicated storage device (DRBD), which you need to configure as it is described in the Ganeti documentation. Alternatively, Ganeti also supports GlusterFS and Ceph/RADOS, but I did not test this setup. As of version 2.7, Ganeti can include external shared storage, which allows, for example, the use of NFS.

After installing the software, you initialize the cluster with a call to gnt-cluster init and specify that you are using the KVM hypervisor; alternatively, Ganeti also works with Xen. Once the cluster is running as required, the following call starts the migration of a virtual machine (Figure 3):

gnt-instance migration vm1
Figure 3: Migration of a virtual machine in a Ganeti cluster.

If a migration goes wrong against all expectations, the management tool also offers a cleanup option to eliminate remnants of the old VM. If you would prefer something more convenient than the command line, take a look at Synnefo [5], a graphical front end that was financed by the Greek government and the EU. Ganeti itself offers high availability and failover and is intended for a setup with up to 150 physical hosts.

Conclusions

Virtualization only unfolds its full potential with the ability to handle live migration of virtual machines. It is the basis for achieving high-availability setups and load distribution. With the KVM hypervisor on Linux, such applications can be implemented today without problem, specifically including the matching storage and network requirements. Various management tools like oVirt or Ganeti facilitate management and let you migrate VMs without manual intervention, for example, in load balancing scenarios.

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Managing Virtual Infrastructures

    Version 3.1 of the oVirt management platform for virtual infrastructures has recently become available. On Fedora 17, the new release is easy to install and deploy.

  • Open Source VDI solution with RHEV and oVirt
    Red Hat introduces a management system for KVM-based virtualization based on Red Hat Enterprise Virtualization and open source project oVirt. Now, solutions for desktop virtualization can be implemented without using proprietary software.
  • Alternative virtualization solutions when OpenStack is too much
    OpenStack is considered the industry standard for building private clouds, but the solution is still far too complex and too difficult to maintain and operate for many applications. What causes OpenStack projects to fail, and what alternatives do administrators have?
  • Fedora 18 for Admins

    Fedora is a trend-setting distribution that sets the pace for future developments of Red Hat Enterprise Linux. Administrators, regardless of whether they use Fedora, are well advised to look at the newest innovations of the Fedora distribution.

  • Professional virtualization with RHV4
    New and updated features in Red Hat Virtualization (RHV) 4, along with seamless provisioning of services between traditional and cloud workloads, could help RHV make up ground on VMware and Hyper-V.
comments powered by Disqus