Managing VMs with the Virtual Machine Manager
Although server management is historically problematic, virtualization management simplifies some problems but amplifies others. The days of a single operating system on a server are gone, replaced by many operating systems within their virtual machine (VM) containers. This property, called virtual machine density, is advantageous, because less server hardware is needed as more and more VMs occupy smaller numbers of servers. This results in less hardware, lower power, but increased management complexity.
Luckily, solutions exist to ease the problems that server virtualization creates, and open source is leading the way. One such solution, called the Virtual Machine Manager from Red Hat, greatly simplifies the ability to manage VMs (running on the key open source hypervisors) as well as providing introspective capabilities to those VMs to measure their performance and resource utilization.
Hypervisor and VM management
Virtualization exposes new challenges in managing VMs, their resources, and the underlying resources of the physical host. Instead of a single mapping of operating system to physical host, multiple operating systems now share a physical host's resources as VMs. Each VM is represented by a container that holds one or more virtual disks and other metadata to describe the configuration and constraints of the VM. Each VM shares the resources of the physical host, which requires not just configuration but an understanding of the utilization of those resources (to ensure a proper density of VMs that optimally use the host and neither tax the available resources nor waste them).
The virt-manager approach to virtualization management
Virtual Machine Manager (
virt-manager), is a lightweight
application suite that presents a command-line or graphical user interface
(GUI) for managing VMs. In addition to providing management capabilities
virt-manager provides an embedded virtual network
computing (VNC) client viewer for a full graphical console of the guest
As an application suite,
virt-manager covers a common set of
virtualization management tasks. These tools are listed in Table 1 and
represent VM construction, cloning, imaging, and viewing. The
virsh utility is not part of the
package but is invaluable in itself.
Table 1. Table 1. Applications for virtualization management (including command-line tools)
|VM desktop management tool|
|VM provisioning tool|
|VM image cloning tool|
|VM construction from an XML descriptor|
|VM graphical console|
|Interactive terminal for
virt-manager uses the
library to manage the available hypervisors.
an application programming interface (API), which is integrated with a
large number of open source hypervisors, to enable control and monitoring.
libvirt makes available a daemon called
libvirtd, which assists in this process (as shown in a simple
Figure 1. A simple representation of the virt-manager stack with QEMU
The Virtual Machine Manager was developed by Red Hat in the Python language to control the life cycle of VMs, including provisioning, virtual network management, and statistics gathering and reporting as well as providing simple graphical access to the VMs themselves.
To install the
virt-manager package, use the package manager
for your particular distribution. For Ubuntu, use
$ sudo apt-get install virt-manager
apt command results in around 22MB of disk space being
used for the
virt-manager application suite. As part of the
libvirt daemon should be running. To
verify, use the following command:
$ ps ax | grep libvirtd
That command should show that the
libvirtd process is running,
-d option instructing
libvirtd to run
as a daemon. Recall that
libvirtd is the daemon that permits
connectivity from the
virt-manager application to the
hypervisors and through them the VMs that they host.
To verify that the
virt-manager package was installed, and to
identify the location of the
virt-manager binary, use the
$ which virt-manager
The location of
virt-manager is also the home of other
applications in the suite (
virt-image, and so on).
As a final step, use QEMU as your hypervisor, because you can run it on any hardware. As an emulator, it runs a bit slower but does not require the virtualization extensions of new hardware.
$ sudo apt-get install qemu
virt-manager to create and monitor a couple of VMs.
Using virt-manager to create and manage VMs
The steps in this section create two VMs.
- Install a Linux®-based operating system called SliTaz,
which is a community-developed Linux operating system distribution.
It's also lightweight, which is advantageous when running QEMU and
emulating the hardware environment. You can download this VM as:
$ wget http://mirror.slitaz.org/iso/4.0/slitaz-4.0.iso
- To begin the VM construction process, start
virt-managerwith root privileges using
$ sudo virt-manager
virt-managerwindow opens through which you connect to the local QEMU hypervisor (by right-clicking localhost (QEMU), and then clicking Connect). If more hypervisors were available, they would be listed here and available to connect to through the
Figure 2. Virtual Machine Manager window
- When connected to the local QEMU hypervisor, click the Create Virtual Machine icon, which starts the VM Construction Wizard.
- Call this VM
slitaz1, and request your operating system installation from a local ISO (previously downloaded above).
Figure 3. Create a VM
- After clicking Forward, define the installation media
for your VM and give a hint to the operating system. In this case,
specify your ISO file, select Linux from the OS type
list, and then select Ubuntu 10.04 LTS (Lucid Linux)
from the Version list.
Figure 4. Define the installation media
- Define the VM's execution environment. Give this VM 1GB of memory and
a single CPU. These selections can be tricky, as memory should be
appropriately sized for your VM (1GB is overkill for this particular
instance). CPUs can help—and in some cases hurt—the
operating system. If the operating system makes efficient use of
multiple cores, these can be distributed to the VMs.
Figure 5. Define the execution environment
- Define the storage environment for the VM. In this example, request
virt-managercreate your virtual disk (instead of providing one yourself) and size it dynamically up to 1GB. Note that the disk option can affect installation and execution speed. If you specify the disk as dynamic, it begins as a small host file and expands as it is consumed by the VM. This dynamic process takes a small amount of time to manage. The alternative, called raw, is a disk image that is fully sized in the host operating system (hypervisor). The trade-off here is that more host disk space is required, but the VM should operate faster, because the dynamic sizing process isn't required.
Figure 6. Define the storage environment
- As a final step,
virt-managerprovides a summary of the VM so far and allows you to define the networking options (choose the default: network address translation [NAT]). Note that it provides additional options and information, as well, such as where the virtual disk is physically located. You can also define the type of underlying processor you expect. In this case, AMD i686 is selected as the architecture, but x86-64 is also available.
Figure 7. Final check of the VM
- When you click Finish, the process of booting the VM
starts. It begins with a boot of the CD-ROM (where you provided your
installation image), which allows the VM to install the Linux
distribution. When the installation is complete, a reboot (which
automatically disconnects the CD-ROM) provides the operating VM. Note
that this window simply provides a view into the VM and allows you to
interact with it. You can close this window, but the VM continues to
operate in the background (and is visible in the
Figure 8. VM running the lightweight SliTaz Linux distribution
- To create a new VM, simply clone your existing, previously installed
VM. Specify to
virt-managerthat you want to clone the VM, and then clone the entire disk (so that they're not shared). Note that you can alter some details of the cloned VM, such as the networking configuration.
Figure 9. Clone a VM within virt-manager
- After you click Clone, a new VM is created based on
the first and is accessible to run concurrently in its own QEMU
environment. Cloning VMs is a great way to grab a snapshot in time of
the operating system and application environment or to create a local
virtualized cluster of machines after they've been configured with a
given application (such as Apache Hadoop). In Figure 10, you can see
both VMs executing, along with a profile of their CPU usage within the
Figure 10. Cloned VMs running concurrently through virt-manager
This example illustrated a simple method for creating VMs, configuring
them, and executing them without a detailed understanding of the
underlying hypervisor and the plethora of options that it exposes (for
storage and networking management, for example). Although this example
used emulation provided by QEMU, the Linux Kernel Virtual Machine (KVM)
hypervisor can be used to attain near-bare-metal performance (using
hardware support, such as Intel® Virtual Technology [VT]). The
ability not only to construct but pause and restart in addition to cloning
VMs is also made accessible through the
virt-manager is one prominent user of the
libvirt virtualization API, there is a growing ecosystem of
tools that use this interface for virtualization management. The
virt-manager package provides a convenient GUI for creating
and managing VMs over multiple hypervisors and hosts. If you prefer the
command line, a number of tools give you the power and control that only
the command line can provide.
virt-install tool provides the capability to provision new
virt-manager provided a small number of
configuration options for VM construction,
provides an extensive set of configuration options covering installation
methods, storage configuration, network configuration, graphics
configuration, virtualization options, and a huge list of virtualized
virt-image tool is similar to the
virt-install tool but allows you to define the details of the
VM construction process in XML. The XML descriptor file specifies the
general metadata for the VM, its domain attributes (CPUs, memory, and so
on), and storage configuration.
virt-clone tool provides a way to clone existing VM
images. By clone, I mean a copy of the existing VM, with updated
parameters to ensure that the new VM is unique to avoid conflicts (such as
media access control [MAC] addressing).
virt-viewer tool provides a graphical console for a given
VM using the VNC protocol. The
virt-viewer can attach to VMs
running on the local host or on remote hosts.
Finally, the most powerful tool for managing guest domains is the
virtualization shell, or
virsh can be
used to list VM guests, start and stop them, and create VMs. In short, you
virsh for full administration of virtualization
across hypervisors, exposing features not available in other tools.
Other virtualization management solutions
virt-manager and its associated tools provide a
useful environment for managing VMs in a desktop environment, there may be
cases where you'd prefer a more feature-rich platform virtualization
solution. Red Hat also offers a solution called
libvirt to manage VMs and
the back-end hypervisors. The
oVirt solution supports several
back-end hypervisors and can even manage enterprise-level storage
protocols such as Fibre Channel, iSCSI, and Network File System (NFS). The
oVirt solution also exposes enterprise-level features such as
high availability and live migration within a homogeneous infrastructure.
virt-manager is not just another tool: It's a step toward open
clouds with open APIs and an open cloud stack (desktop, server, data
virt-manager and related tools provide both a
simple and a powerful environment for managing virtualization on a
desktop. Whether you prefer the power and scriptability of the command
line or the simplicity of the GUI,
virt-manager and its
related tools have you covered.
- The Virtual Machine
Manager website is the source for all information regarding
virt-managerapplication suite. In addition to a source repo and mailing list, you can learn more through the wiki and FAQ and also about the development plans of the desktop UI. Red Hat publishes a wish list and roadmap, so you can see what's ahead.
- Red Hat maintains a great set of documentation on the management of virtualization. At the Red Hat documentation site, you can find details on Virtualization Administration, How to Get Started, and details on Host Configuration and Guest Installation.
virt-managermakes extensive use of
libvirtas the means of communicating with the hypervisor and VMs. You can learn more about
libvirtin "Anatomy of the libvirt virtualization library" (M. Tim Jones, developerWorks, January 2010).
- Linux man pages are a great place to learn about the tools
available to you. You can find HTML versions of man pages for the
various tools discussed here, such as
- For larger-scale virtualization management across a data
center, consider Red Hat's
oVirtproject is an ecosystem of projects for comprehensive virtualization management.
- Evaluate IBM products in the way that suits you best: Download a product trial, try a product online, or use a product in a cloud environment.