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 (15 chapters)
Title Page
About the Author
About the Reviewer
Customer Feedback

Creating snapshots

A virtual machine snapshot preserves the current state of a running or stopped instance at a specific point in time. It can later be used to restore the instance from that point. Snapshots can be used as backups or as templates for building new virtual machines that will be copies of the original instance.

To take advantage of snapshots, the backing store must first support it. If you recall from the Managing Disk images with qemu-img recipe in Chapter 1, Getting Started with QEMU and KVM, we created a raw image type for the KVM guest. In this recipe, we are going to use the QEMU Copy-On-Write (QCOW2) image format as the backing store for the KVM instance, because the raw image format does not support snapshots.

Using the QCOW2 image format, we can create a base image containing the guest OS and everything else we need for the virtual machine, and then create several copy-on-write overlay disk images on top of the original base image. These new overlay images can be used...