Mastering KVM Virtualization
5/5
()
About this ebook
- Become an expert in Linux virtualization
- Migrate your virtualized datacenter to the cloud
- Find out how to build a large scale virtualization solution that will transform your organization
Linux administrators, DevOps practitioners, and Developers - if you want to build incredible, yet manageable virtualization solutions with KVM this is the book to get you there.
Related to Mastering KVM Virtualization
Related ebooks
KVM Virtualization Cookbook Rating: 0 out of 5 stars0 ratingsMastering Proxmox - Second Edition Rating: 0 out of 5 stars0 ratingsMastering Proxmox Rating: 5 out of 5 stars5/5Mastering VMware Horizon 7 - Second Edition Rating: 0 out of 5 stars0 ratingsLinux Bible Rating: 0 out of 5 stars0 ratingsInfrastructure as Code (IAC) Cookbook Rating: 0 out of 5 stars0 ratingsProxmox Cookbook Rating: 0 out of 5 stars0 ratingsProxmox High Availability Rating: 0 out of 5 stars0 ratingsFreeBSD Mastery: Jails: IT Mastery, #15 Rating: 5 out of 5 stars5/5Ceph Cookbook Rating: 4 out of 5 stars4/5FreeRADIUS Beginner's Guide Rating: 0 out of 5 stars0 ratingsVMware Horizon View High Availability Rating: 0 out of 5 stars0 ratingsLearning OpenStack Networking (Neutron) Rating: 5 out of 5 stars5/5Learning VMware vSphere Rating: 0 out of 5 stars0 ratingsCentOS 8 Essentials: Learn to Install, Administer and Deploy CentOS 8 Systems Rating: 0 out of 5 stars0 ratingsCisco UCS Cookbook Rating: 0 out of 5 stars0 ratingsOpenStack Essentials - Second Edition Rating: 0 out of 5 stars0 ratingsSoftware-Defined Networking (SDN) with OpenStack Rating: 0 out of 5 stars0 ratingsLearning OpenStack Networking (Neutron) - Second Edition Rating: 0 out of 5 stars0 ratingsNative Docker Clustering with Swarm Rating: 0 out of 5 stars0 ratingsMastering PowerCLI Rating: 0 out of 5 stars0 ratingsMastering Windows Server 2016 Rating: 5 out of 5 stars5/5VMware Certified Professional Data Center Virtualization on vSphere 6.7 Study Guide: Exam 2V0-21.19 Rating: 0 out of 5 stars0 ratingsVMware NSX Network Essentials Rating: 0 out of 5 stars0 ratingsvSphere Virtual Machine Management Rating: 0 out of 5 stars0 ratingsMastering Kubernetes Rating: 5 out of 5 stars5/5Mastering VMware vSphere 6.7 Rating: 0 out of 5 stars0 ratingsLinux in Action Rating: 0 out of 5 stars0 ratingsOpenStack in Action Rating: 0 out of 5 stars0 ratingsVMware Virtual SAN Cookbook Rating: 5 out of 5 stars5/5
Internet & Web For You
Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsNo Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsSix Figure Blogging Blueprint Rating: 5 out of 5 stars5/5Beginner's Guide To Starting An Etsy Print-On-Demand Shop Rating: 0 out of 5 stars0 ratingsEverybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5The Gothic Novel Collection Rating: 5 out of 5 stars5/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5How To Start A Podcast Rating: 4 out of 5 stars4/5200+ Ways to Protect Your Privacy: Simple Ways to Prevent Hacks and Protect Your Privacy--On and Offline Rating: 0 out of 5 stars0 ratingsThe Internet Is Not What You Think It Is: A History, a Philosophy, a Warning Rating: 4 out of 5 stars4/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5The Cyber Attack Survival Manual: Tools for Surviving Everything from Identity Theft to the Digital Apocalypse Rating: 0 out of 5 stars0 ratingsThe $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5Introduction to Internet Scams and Fraud: Credit Card Theft, Work-At-Home Scams and Lottery Scams Rating: 4 out of 5 stars4/5
Reviews for Mastering KVM Virtualization
1 rating0 reviews
Book preview
Mastering KVM Virtualization - Humble Devassy Chirammal
Table of Contents
Mastering KVM Virtualization
Credits
About the Authors
About the Reviewers
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book for
Conventions
Reader feedback
Customer support
Downloading the color images of this book
Errata
Piracy
Questions
1. Understanding Linux Virtualization
What is virtualization?
Why should I use Linux virtualization?
Types of virtualization
Advantages of virtualization
Operating system virtualization/partitioning
Full virtualization
Paravirtualization
Hardware assisted virtualization
Introducing VMM/hypervisor
Type 1 and Type 2 hypervisors
Open source virtualization projects
Xen
Introducing KVM
High-level overview of KVM
What Linux virtualization offers you in the cloud
Summary
2. KVM Internals
Getting acquainted with libvirt and its implementation
Internal workings of libvirt
Time to think more about QEMU
Qemu – KVM internals
Data structures
Threading models in QEMU
KVM in action
KVM APIs
Anonymous inodes and file structures
Data structures
Execution flow of vCPU
Summary
3. Setting Up Standalone KVM Virtualization
Getting acquainted with libvirt
Host system requirements
Determining the right system requirements for your environment
Physical CPU
CPU cores
Physical memory
Storage
How much SWAP space is recommended?
Network
Setting up the environment
Installing virtualization packages
Starting the libvirt service
Validate and understand your system's virt capabilities
Hardware configuration examples
Summary
4. Getting Started with libvirt and Creating Your First Virtual Machines
Introducing virt-manager
The Virtual Networks tab
NATed virtual network
Routed virtual network
Isolated virtual network
Default network
Storage tab
Creating virtual machines using the Virtual Machine Manager
Creating a new virtual machine wizard
The Network installation (HTTP, FTP, or NFS) method
Network Boot (PXE)
Importing an existing disk image
Introducing virt-install
Installing a Windows 7 Guest using the virt-install command
Automated virtual machine deployment
Introducing virt-builder
Introducing oz
The oz configuration file
Creating a virtual machine using oz
Summary
5. Network and Storage
Virtual networking
Virtual networking using libvirt
Isolated virtual network
Routed virtual network
Editing a virtual network
NATed virtual network
MacVTap
PCI passthrough
It's all about storage!
Working with unmanaged storage
Creating a disk image and attaching it to a guest
Getting image information
Attach a disk using virt-manager
Attach a disk using virsh
Working with managed storage
Storage management console
Creating storage pools
File system directory backed storage pool
LVM Volume Group backed storage pool
iSCSI backed storage pool
Creating an ISO image library
Deleting a storage pool
Deleting storage pool using virt-manager
Deleting storage pool using virsh
Creating storage volumes
Creating volume using virsh command
Deleting a volume using the virsh command
Summary
6. Virtual Machine Lifecycle Management
QEMU guest agent
Virtual video cards and graphics
Virtual video card
Graphics
VNC graphics server
SPICE graphics server
Adding SPICE graphics server
Methods to access a virtual machine console
VM migration
Offline migration
Live or online migration
Benefits of VM migration
Setting up the environment
Shared storage
Offline migration
What if I start the VM accidently on both the hypervisors?
Enabling lockd
Live or online migration
Future of migration
Summary
7. Templates and Snapshots
Introducing virtual machine templates
Working with templates
Creating templates
Example 1 – preparing a CentOS 7 template with a complete LAMP stack
What is virt-sysprep?
Example 2 – preparing a Windows 7 template with a MySQL database
Deploying virtual machines from a template
Deploying VMs using the clone provisioning method
Deploying VMs using the thin provisioning method
Snapshots
VM disk image formats
Converting a VM disk format
Working with internal snapshots
Creating the first internal snapshot
Creating an internal snapshot with a custom name and description
Creating multiple snapshots
Reverting to internal snapshots
Deleting internal snapshots
Managing snapshots using virt-manager
Working with external disk snapshots
Creating an external disk snapshot
What is quiesce?
Reverting to external snapshots
Deleting external disk snapshots
Best practices for dealing with snapshots
Summary
8. Kimchi – An HTML5-Based Management Tool for KVM/libvirt
Libvirt Web API
Introduction to the Kimchi project
Kimchi architecture
Setting up Kimchi server
Starting kimchid service
Managing KVM virtualization infrastructure using kimchi WebUI
Creating virtual machines through Kimchi WebUI
Editing a virtual machine's resource allocation
Accessing a virtual machine's graphical console
Permissions and user access control
Monitoring and managing a host system with the Kimchi WebUI
Host system management using the Kimchi-Ginger plugin
Managing virtual machine through android phones
Summary
9. Software-Defined Networking for KVM Virtualization
Introducing Software Defined Networking
Limitations of Linux bridges
Introducing Open vSwitch
Comparison between Linux bridge and Open vSwitch
Open vSwitch architecture
Open vSwitch installation and setup
Starting openvswitch.service
Open vSwitch kernel module
Getting started with the Open vSwitch command-line interface
Setting up your first Open vSwitch bridge
Configuring an Open vSwitch bridge manually using the ovs-vsctl command
Configuring an Open vSwitch bridge using network scripts
Integrating KVM VMs and OVS
VLANs with Open vSwitch
Configuring VLANs for KVM virtual machines
Using libvirt integration
Open vSwitch QoS – controlling KVM VM traffic
Applying traffic rate limiting
Controlling outbound (egress) traffic
Applying traffic shaping
Overlay networks
Configuring Open vSwitch tunnels with VxLan
KvmHOST1 host side configuration
kvmHOST2 host configuration
Network port mirroring
Configuring port mirroring
Managing Open vSwitch using the OpenDaylight SDN controller
Installing the OpenDaylight controller (ODL-sys)
Hardware requirements
Installing and configuring ODL
Adding an Open vSwitch (vswitch001) instance to the OpenDaylight controller on system (ODL-sys)
Installing flows on the OVS bridge using OpenDaylight Dashboard
Basic Open vSwitch troubleshooting
Summary
10. Installing and Configuring the Virtual Datacenter Using oVirt
Introducing oVirt
oVirt architecture
The oVirt engine
The oVirt node
Storage
Networking
Installing the oVirt engine
Preparing the system for oVirt engine installation
Installing oVirt node
Summary
11. Starting Your First Virtual Machine in oVirt
Getting acquainted with oVirt data center and cluster
Initiating an oVirt data center
Creating storage domains
Creating logical networks
Creating and starting a virtual machine
What next?
Summary
12. Deploying OpenStack Private Cloud backed by KVM Virtualization
OpenStack architecture
Core OpenStack components
OpenStack deployment
RDO OpenStack
RDO OpenStack deployments methods
Installing Packstack
Prerequisites
Installing the Packstack installer
Running Packstack to install OpenStack
Launching First Instance
Troubleshooting the virtualization layer of OpenStack
Accessing the instance configuration database
QEMU Monitor Protocol
Summary
13. Performance Tuning and Best Practices in KVM
VirtIO
CPU tuning
The number of vCPUs
CPU configuration
CPU topology
CPU pinning
The numactl command
Working with memory
Memory allocation
Memory tuning
Memory backing
locked
nosharepages
hugepages
Getting acquainted with Kernel Same Page merging
KSM packages and files
Tuning CPU and memory with NUMA
What is NUMA?
NUMA memory allocation policies
numatune
emulatorpin
KSM and NUMA
Automatic NUMA balancing
Understanding numad and numastat
Disk and block I/O tuning
Cache mode
I/O mode
I/O tuning
Networking tuning in KVM
How to turn it on?
KVM guest time-keeping best practices
kvm-clock
Summary
14. V2V and P2V Migration Tools
Introducing the virt-v2v utility
How does virt-v2v work?
Getting the virt-v2v utility
Preparing for the v2v conversion
Conversion process
VMware guest conversion
Converting a VMware vSphere guest to a standalone KVM host
Converting a VMware vSphere guest to oVirt
Converting a VMware vSphere guest to an OpenStack-Glance repository
Xen guest conversion
Converting standalone KVM guests to an oVirt Virtualization platform and the OpenStack cloud
Troubleshooting virt-v2v related issues
Physical system to virtual conversion
Creating a virt-p2v bootable image
Can we convert any physical computers to virtual using virt-v2v?
Booting a physical system using a virt-p2v bootable disk for conversion
Converting virtual machines from unsupported virtualization platforms
List of input and output methods supported with virt-v2v
Summary
A. Converting a Virtual Machine into a Hypervisor
Introducing nested KVM
How to enable nested KVM?
Index
Mastering KVM Virtualization
Mastering KVM Virtualization
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2016
Production reference: 1110816
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-905-4
www.packtpub.com
Credits
Authors
Humble Devassy Chirammal
Prasad Mukhedkar
Anil Vettathu
Reviewers
Aric Pedersen
Ranjith Rajaram
Amit Shah
Commissioning Editor
Kunal Parikh
Acquisition Editor
Shaon Basu
Content Development Editor
Shweta Pant
Technical Editor
Saurabh Malhotra
Copy Editors
Sneha Singh
Stephen Copestake
Project Coordinator
Kinjal Bari
Proofreader
Safis Editing
Indexer
Hemangini Bari
Graphics
Disha Haria
Kirk D'Penha
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade
About the Authors
Humble Devassy Chirammal works as a senior software engineer at Red Hat in the Storage Engineering team. He has more than 10 years of IT experience and his area of expertise is in knowing the full stack of an ecosystem and architecting the solutions based on the demand. These days, he primarily concentrates on GlusterFS and emerging technologies, such as IaaS, PaaS solutions in Cloud, and Containers. He has worked on intrusion detection systems, clusters, and virtualization. He is an Open Source advocate. He actively organizes meetups on Virtualization, CentOS, Openshift, and GlusterFS. His Twitter handle is @hchiramm and his website is http://www.humblec.com/.
I would like to dedicate this book in the loving memory of my parents, C.O.Devassy and Elsy Devassy, whose steady, balanced, and loving upbringing has given me the strength and determination to be the person I am today. I would like to thank my wife, Anitha, for standing beside me throughout my career and for the effort she put in taking care of our son Heaven while I was writing this book. Also, I would like to thank my brothers Sible and Fr. Able Chirammal, without whose constant support this book would not have been possible.
Finally, a special thanks to Ulrich Obergfell for being an inspiration, which helped me enrich my knowledge in virtualization.
Prasad Mukhedkar is a senior technical support engineer at Red Hat. His area of expertise is designing, building, and supporting IT infrastructure for workloads, especially large virtualization environments and cloud IaaS using open source technologies. He is skilled in KVM virtualization with continuous working experience from its very early stages, possesses extensive hands-on and technical knowledge of Red Hat Enterprise Virtualization. These days, he concentrates primarily on OpenStack and Cloudforms platforms. His other area of interest includes Linux performance tuning, designing highly scalable open source identity management solutions, and enterprise IT security. He is a huge fan of the Linux GNU Screen
utility.
Anil Vettathu started his association with Linux in college and began his career as a Linux System Administrator soon after. He is a generalist and is interested in Open Source technologies. He has hands on experience in designing and implementing large scale virtualization environments using open source technologies and has extensive knowledge in libvirt and KVM. These days he primarily works on Red Hat Enterprise Virtualization, containers and real time performance tuning. Currently, he is working as a Technical Account Manager for Red Hat. His website is http://anilv.in.
I'd like to thank my beloved wife, Chandni, for her unconditional support. She took the pain of looking after our two naughtiest kids, while I enjoyed writing this book. I'd like also like to thank my parents, Dr Annieamma & Dr George Vettathu, for their guidance and to push me hard to study something new in life. Finally, I would like to thank my sister Dr. Wilma for her guidance and my brother Vimal.
About the Reviewers
Aric Pedersen is the author of cPanel User Guide and Tutorial and Web Host Manager Administration Guide, both written for Packt Publishing. He has also served as a reviewer for CUPS Administrative Guide, Linux E-mail, and Linux Shell Scripting Cookbook, published by Packt Publishing.
He has over 11 years of experience working as a systems administrator. He currently works for http://www.hostdime.com/, the world-class web host and global data center provider, and also for https://netenberg.com/, the makers of Fantastico, the world's most popular web script installer for cPanel servers.
I would like to thank Dennis and Nicky, who have helped me in innumerable ways with their friendship over the past several years.
I'd also like to thank my mother and the rest of my family, Allen, Ken, Steve, and Michael, because without them, nothing I've done would have been possible.
Ranjith Rajaram works as a Senior Principle Technical Support Engineer at a leading open source Enterprise Linux company. He started his career by providing support to web hosting companies and managing servers remotely. He has also provided technical support to their end customers. Early in his career, he has worked on Linux, Unix, and FreeBSD platforms.
For the past 12 years, he has been continuously learning something new. This is what he likes and admires about technical support. As a mark of respect to all his fellow technical support engineers, he has included developing software is humane but supporting them is divine
in his e-mail signature.
At his current organization, he is involved in implementing, installing, and troubleshooting Linux environment networks. Apart from this, he is also an active contributor to the Linux container space, especially using Docker-formatted containers.
As a reviewer this is his second book. His earlier book was Learning RHEL Networking from Packt Publishing.
Amit Shah has been working on FOSS since 2001, and QEMU/KVM virtualization since 2007. He currently works as a senior software engineer in Red Hat. He has reviewed KVM Internals and Performance Tuning chapters.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
A big thank you to the KVM, QEMU, libvirt & oVirt community for wonderful opensource projects.
We would also thank our reviewers and readers for supporting us.
Preface
Mastering KVM Virtualization is a culmination of all the knowledge that we have gained by troubleshooting, configuring, and fixing the bug on KVM virtualization. We have authored this book for system administrators, DevOps practitioners, and developers who have a good hands-on knowledge of Linux and would like to sharpen their open source virtualization skills. The chapters in this book are written with a focus on practical examples that should help you deploy a robust virtualization environment, suiting your organization's needs. We expect that, once you finish the book, you should have a good understanding of KVM virtualization internals, the technologies around it, and the tools to build and manage diverse virtualization environments. You should also be able to contribute to the awesome KVM community.
What this book covers
Chapter 1, Understanding Linux Virtualization, talks about the prevailing technologies used in Linux virtualization and their advantages over others. It starts with basic concepts of Linux virtualization and advantages of Linux-based virtualization platforms and then moves on to hypervisor/VMM. This chapter ends with how Linux is being used in private and public cloud infrastructures.
Chapter 2, KVM Internals, covers the important data structures and functions which define the internal implementation of libvirt, qemu, and KVM. You will also go through the life cycle of vCPU execution and how qemu and KVM perform together to run a guest operating system in the host CPU.
Chapter 3, Setting Up Standalone KVM Virtualization, tells you how to set up your Linux server to use KVM (Kernel-based Virtual Machine) and libvirt. KVM is for virtualization and libvirt is for managing the virtualization environment. You will also learn how to determine the right system requirements (CPU, memory, storage, and networking) to create your own virtual environment.
Chapter 4, Getting Started with libvirt and Creating Your First Virtual Machines, will tell you more about libvirt and its supported tools, such as virt-manager and virsh. You will dig more into the default configurations available in libvirt. You will install a new virtual machine using virt-manager as well virt-install and also learn about advanced virtual machine deployment tools, such as virt-builder and oz.
Chapter 5, Network and Storage, is one of the most important chapters that teaches you about virtual networking and storage, which determine the QoS of your virtual machine deployments. In virtual networking, you will learn in detail about bridging, different bridging concepts, and the methods you can adopt for a fault tolerant network layer for virtual machines. You will understand how to segregate the network with the use of tagged vLan bridges. In storage, you will learn how to create storage pools for our virtual machines from storage backends such as fiber channel (FC), ISCSI, NFS, local storage, and so on. You will also learn how to determine the right storage backend for your virtual machines.
Chapter 6, Virtual Machine Lifecycle Management, discusses the tasks of managing virtual machines. You will learn about the different statuses of virtual machines and methods to access a virtual machine that includes spice and VNC. You will understand the use of guest agents. You will also learn how to perform offline and live migration of virtual machines.
Chapter 7, Templates and Snapshots, tells us how to create templates of Windows and Linux for rapid VMs provisioning. The chapter will also teach us how to create external and internal snapshots and when to use which snapshot. Snapshot management, including merge and deletion is also covered with snapshot best practice.
Chapter 8, Kimchi, An HTML5-Based Management Tool for KVM/libvirt, explains how to manage KVM virtualization infrastructure remotely, using libvirt-based web management tools. You will learn how to create new virtual machines, remotely adjust an existing VM's resource allocation, implement user access controls, and so on over the Internet using Kimchi WebUI. It also introduces VM-King, an Android application that lets you manage KVM virtual machines remotely from your Android mobile or tablet.
Chapter 9, Software-Defined Networking for KVM Virtualization, covers the use of SDN approach in KVM virtualization using Open vSwitch and supporting tools that include OpenDayLight SDN controller. You will learn about Open vSwitch installation and setup, creating vLans for KVM virtual machines, applying granular traffic and policy control to KVM VMs, creating overlay networks, and port mirroring and SPAN. You will also learn how to manage Open vSwitch using OpenDayLight SDN controller.
Chapter 10, Installing and Configuring the Virtual Datacenter Using oVirt, oVirt is a virtual datacenter manager and is considered as the open source replacement of VMware vCenter. It manages virtual machines, hosts, storage, and virtualized networks. It provides a powerful web management interface. In this chapter, we will cover oVirt architecture, oVirt engine installation, and oVirt node installation.
Chapter 11, Starting Your First Virtual Machine in oVirt, tells us how to initiate an oVirt datacenter in order to start your first virtual machine. This initialization process will walk you through creating a datacenter, adding a host to datacenter, adding storage domains, and its backend. You will learn about configuring networking.
Chapter 12, Deploying OpenStack Private Cloud backed by KVM Virtualization, covers the most popular open source software platform to create and manage public and private IaaS cloud. We will explain the different components of OpenStack. You will set up an OpenStack environment and will start your first instance on it.
Chapter 13, Performance Tuning and Best Practices in KVM, tells us how performance tuning can be done on a KVM setup. It will also discuss the best practices that can be applied in a KVM setup to improve the performance.
Chapter 14, V2V and P2V Migration Tools, will tell you how to migrate your existing virtual machines that are running on proprietary hypervisors to a truly open source KVM hypervisor using virt-v2v tool. You will also learn how to migrate physical machines to virtual machines and run them on the cloud.
Appendix, Converting a Virtual Machine into a Hypervisor, this will tell you how you can turn a VM into a hypervisor by using specific method.
What you need for this book
This book is heavily focused on practical examples; due to the nature of the content, we recommend that you have a test machine installed with Fedora 22 or later to perform the tasks laid out in the book. This test machine should have a minimum of 6 GB memory with an Intel or AMD processor that supports virtualization. You should be able to do most of the examples using nested virtual machines.
Who this book for
This book is for system administrators, DevOps practitioners and developers who have a good hands-on knowledge of Linux and would like to sharpen their skills of open source virtualization.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: These ioctls() fundamentally map to the system KVM level, VM level, and vCPU level .
A block of code is set as follows:
switch (run->exit_reason) {
case KVM_EXIT_IO:
DPRINTF(handle_io\n
);
/* Called outside BQL */
kvm_handle_io(run->io.port, attrs,
(uint8_t *)run + run->io.data_offset,
run->io.direction,
run->io.size,
run->io.count);
ret = 0;
break;
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
include/linux/kvm_host.h :
struct kvm {
struct mm_struct *mm; /* userspace tied to this vm */
struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
struct kvm_io_bus *buses[KVM_NR_BUSES];
struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
}
Any command-line input or output is written as follows:
#git clone git://git.qemu-project.org/qemu.git
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: If you want to connect to the remote hypervisor, check Connect to remote host and fill the details.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <feedback@packtpub.com>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/Mastering_KVM_Virtualization_ColorImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>, and we will do our best to address the problem.
Chapter 1. Understanding Linux Virtualization
This chapter provides the reader with an insight into the prevailing technologies in Linux virtualization and their advantage over others. There are a total of 14 chapters in this book, which are lined up to cover all the important aspects of KVM virtualization, starting from KVM internals and advanced topics such as software defined networking, performance tuning, and optimization, to physical to virtual migration.
In this chapter, we will cover the following topics:
Linux virtualization and its basic concepts
Why you should use Linux virtualization
Hypervisor/VMM
What Linux virtualization offers you in the cloud
Public and private clouds
Tip
Before you start, check out the homepage of the book http://bit.ly/mkvmvirt to see the new updates, tips and version changes.
What is virtualization?
In philosophy, virtual means something that is not real
. In computer science, virtual means a hardware environment that is not real
. Here, we duplicate the functions of physical hardware and present them to an operating system. The technology that is used to create this environment can be called virtualization technology, in short, virtualization. The physical system that runs the virtualization software (hypervisor or Virtual Machine Monitor) is called a host and the virtual machines installed on top of the hypervisor are called guests.
Why should I use Linux virtualization?
Virtualization first appeared in Linux in the form of User-mode Linux (UML) and it started the revolution required to bring Linux into the virtualization race. Today, there is a wide array of virtualization options available in Linux to convert a single computer into multiple ones. Popular Linux virtualization solutions include KVM, Xen, QEMU, and VirtualBox. In this book, we will be focusing on KVM virtualization.
Openness, flexibility, and performance are some of the major factors that attract users to Linux virtualization. Just like any other open source software, virtualization software in Linux is developed in a collaborative manner; this indirectly brings users the advantages of the open source model. For example, compared to closed source, open source receives wider input from the community and indirectly helps reduce research and development costs, improves efficiency, and performance and productivity. The open source model always encourages innovation. The following are some of the other features that open source provides:
User-driven solutions for real problems
Support from the community and a user base who help fellow users to solve problems
Provides choice of infrastructure
Control of data and security, as the code is freely available to read, understand, and modify when required
Avoid lock-in flexibility to migrate the entire load with comparable product and stay free from vendor lock-in
Types of virtualization
Simply put, virtualization is the process of virtualizing something such as hardware, network, storage, application, access, and so on. Thus, virtualization can happen to any of the components.
Note
Refer to the Advantages of virtualization section for more details on different possibilities in virtualization.
For example:
SDN or Software-Defined Networking, https://en.wikipedia.org/wiki/Software-defined_networking. These techniques are examples of network virtualization, https://en.wikipedia.org/wiki/Network_virtualization.
Software Defined Storage (SDS), https://en.wikipedia.org/wiki/Software-defined_storage. This is part of storage virtualization, https://en.wikipedia.org/wiki/Storage_virtualization.
The application streaming, remote desktop service, and desktop virtualization techniques fall into the category of application virtualization, https://en.wikipedia.org/wiki/Application_virtualization.
However, in the context of our book, we will discuss virtualization mainly in terms of software (hypervisor-based) virtualization. From this angle, virtualization is the process of hiding the underlying physical hardware so that it can be shared and used by multiple operating systems. This is also