Book Image

KVM Virtualization Cookbook

By : Konstantin Ivanov
Book Image

KVM Virtualization Cookbook

By: Konstantin Ivanov

Overview of this book

Virtualization technologies such as KVM allow for better control over the available server resources, by deploying multiple virtual instances on the same physical host, or clusters of compute resources. With KVM it is possible to run various workloads in isolation with the hypervisor layer providing better tenant isolation and higher degree of security. This book will provide a deep dive into deploying KVM virtual machines using qemu and libvirt and will demonstrate practical examples on how to run, scale, monitor, migrate and backup such instances. You will also discover real production ready recipes on deploying KVM instances with OpenStack and how to programatically manage the life cycle of KVM virtual machines using Python. You will learn numerous tips and techniques which will help you deploy & plan the KVM infrastructure. Next, you will be introduced to the working of libvirt libraries and the iPython development environment. Finally, you will be able to tune your Linux kernel for high throughput and better performance. By the end of this book, you will gain all the knowledge needed to be an expert in working with the KVM virtualization infrastructure.
Table of Contents (9 chapters)

Starting, stopping, and removing KVM instances


In the previous recipe, we saw how to define new KVM virtual machine by either manually writing the XML definition file or using the virt-install tool to define the instance for us.

If you define a new instance from an XML file, by default the instance will not start automatically. In this recipe, we will see how to start an instance that was previously configured.

Getting ready

For this recipe, we are going to need the following:

  • The QEMU binaries, provided after following the Installing and configuring QEMU recipe from Chapter 1, Getting Started with QEMU and KVM.
  • The custom raw Debian image we built in the Installing a custom OS on the image with debootstrap recipe from the previous chapter.
  • The virsh tool provided by completing the Installing and configuring libvirt recipe.
  • The defined instance from the Defining KVM instances recipe in a shut off state.

How to do it...

The following steps outline the process of listing, starting, and stopping KVM...