Mastering KVM Virtualization

Book description

Dive in to the cutting edge techniques of Linux KVM virtualization, and build the virtualization solutions your datacentre demands

Key Features

  • 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

Book Description

A robust datacenter is essential for any organization – but you don't want to waste resources. With KVM you can virtualize your datacenter, transforming a Linux operating system into a powerful hypervisor that allows you to manage multiple OS with minimal fuss.

This book doesn't just show you how to virtualize with KVM – it shows you how to do it well. Written to make you an expert on KVM, you'll learn to manage the three essential pillars of scalability, performance and security – as well as some useful integrations with cloud services such as OpenStack. From the fundamentals of setting up a standalone KVM virtualization platform, and the best tools to harness it effectively, including virt-manager, and kimchi-project, everything you do is built around making KVM work for you in the real-world, helping you to interact and customize it as you need it. With further guidance on performance optimization for Microsoft Windows and RHEL virtual machines, as well as proven strategies for backup and disaster recovery, you'll can be confident that your virtualized data center is working for your organization – not hampering it. Finally, the book will empower you to unlock the full potential of cloud through KVM. Migrating your physical machines to the cloud can be challenging, but once you've mastered KVM, it's a little easie.

What you will learn

  • Explore the ecosystem of tools that support Linux virtualization
  • Find out why KVM offers you a smarter way to unlock the potential of virtualization
  • Implement KVM virtualization using oVirt
  • Explore the KVM architecture – so you can manage, scale and optimize it with ease
  • Migrate your virtualized datacenter to the cloud for truly resource-efficient computing
  • Find out how to integrate OpenStack with KVM to take full control of the cloud

Who this book is for

Linux administrators – if you want to build incredible, yet manageable virtualization solutions with KVM this is the book to get you there. It will help you apply what you already know to some tricky virtualization tasks.

Table of contents

  1. Mastering KVM Virtualization
    1. Table of Contents
    2. Mastering KVM Virtualization
    3. Credits
    4. About the Authors
    5. About the Reviewers
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the color images of this book
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Understanding Linux Virtualization
      1. What is virtualization?
      2. Why should I use Linux virtualization?
      3. Types of virtualization
        1. Advantages of virtualization
      4. Operating system virtualization/partitioning
        1. Full virtualization
        2. Paravirtualization
      5. Hardware assisted virtualization
      6. Introducing VMM/hypervisor
        1. Type 1 and Type 2 hypervisors
      7. Open source virtualization projects
        1. Xen
        2. Introducing KVM
        3. High-level overview of KVM
      8. What Linux virtualization offers you in the cloud
      9. Summary
    9. 2. KVM Internals
      1. Getting acquainted with libvirt and its implementation
      2. Internal workings of libvirt
      3. Time to think more about QEMU
        1. Qemu – KVM internals
        2. Data structures
        3. Threading models in QEMU
      4. KVM in action
        1. KVM APIs
      5. Anonymous inodes and file structures
        1. Data structures
      6. Execution flow of vCPU
      7. Summary
    10. 3. Setting Up Standalone KVM Virtualization
      1. Getting acquainted with libvirt
        1. Host system requirements
        2. Determining the right system requirements for your environment
          1. Physical CPU
          2. CPU cores
          3. Physical memory
          4. Storage
            1. How much SWAP space is recommended?
          5. Network
        3. Setting up the environment
          1. Installing virtualization packages
          2. Starting the libvirt service
          3. Validate and understand your system's virt capabilities
      2. Hardware configuration examples
      3. Summary
    11. 4. Getting Started with libvirt and Creating Your First Virtual Machines
      1. Introducing virt-manager
        1. The Virtual Networks tab
          1. NATed virtual network
          2. Routed virtual network
          3. Isolated virtual network
          4. Default network
        2. Storage tab
      2. Creating virtual machines using the Virtual Machine Manager
        1. Creating a new virtual machine wizard
        2. The Network installation (HTTP, FTP, or NFS) method
        3. Network Boot (PXE)
        4. Importing an existing disk image
      3. Introducing virt-install
        1. Installing a Windows 7 Guest using the virt-install command
      4. Automated virtual machine deployment
        1. Introducing virt-builder
        2. Introducing oz
          1. The oz configuration file
          2. Creating a virtual machine using oz
      5. Summary
    12. 5. Network and Storage
      1. Virtual networking
      2. Virtual networking using libvirt
        1. Isolated virtual network
        2. Routed virtual network
          1. Editing a virtual network
        3. NATed virtual network
      3. MacVTap
      4. PCI passthrough
      5. It's all about storage!
        1. Working with unmanaged storage
        2. Creating a disk image and attaching it to a guest
        3. Getting image information
        4. Attach a disk using virt-manager
        5. Attach a disk using virsh
        6. Working with managed storage
        7. Storage management console
        8. Creating storage pools
          1. File system directory backed storage pool
          2. LVM Volume Group backed storage pool
          3. iSCSI backed storage pool
        9. Creating an ISO image library
        10. Deleting a storage pool
          1. Deleting storage pool using virt-manager
          2. Deleting storage pool using virsh
        11. Creating storage volumes
        12. Creating volume using virsh command
        13. Deleting a volume using the virsh command
      6. Summary
    13. 6. Virtual Machine Lifecycle Management
      1. QEMU guest agent
      2. Virtual video cards and graphics
        1. Virtual video card
        2. Graphics
        3. VNC graphics server
        4. SPICE graphics server
          1. Adding SPICE graphics server
        5. Methods to access a virtual machine console
      3. VM migration
        1. Offline migration
        2. Live or online migration
        3. Benefits of VM migration
        4. Setting up the environment
      4. Shared storage
        1. Offline migration
        2. What if I start the VM accidently on both the hypervisors?
      5. Enabling lockd
      6. Live or online migration
        1. Future of migration
      7. Summary
    14. 7. Templates and Snapshots
      1. Introducing virtual machine templates
      2. Working with templates
        1. Creating templates
          1. Example 1 – preparing a CentOS 7 template with a complete LAMP stack
            1. What is virt-sysprep?
          2. Example 2 – preparing a Windows 7 template with a MySQL database
      3. Deploying virtual machines from a template
      4. Deploying VMs using the clone provisioning method
      5. Deploying VMs using the thin provisioning method
      6. Snapshots
        1. VM disk image formats
          1. Converting a VM disk format
        2. Working with internal snapshots
          1. Creating the first internal snapshot
          2. Creating an internal snapshot with a custom name and description
          3. Creating multiple snapshots
          4. Reverting to internal snapshots
          5. Deleting internal snapshots
        3. Managing snapshots using virt-manager
        4. Working with external disk snapshots
          1. Creating an external disk snapshot
          2. What is quiesce?
          3. Reverting to external snapshots
          4. Deleting external disk snapshots
        5. Best practices for dealing with snapshots
      7. Summary
    15. 8. Kimchi – An HTML5-Based Management Tool for KVM/libvirt
      1. Libvirt Web API
      2. Introduction to the Kimchi project
        1. Kimchi architecture
      3. Setting up Kimchi server
        1. Starting kimchid service
      4. Managing KVM virtualization infrastructure using kimchi WebUI
      5. Creating virtual machines through Kimchi WebUI
        1. Editing a virtual machine's resource allocation
        2. Accessing a virtual machine's graphical console
        3. Permissions and user access control
          1. Monitoring and managing a host system with the Kimchi WebUI
        4. Host system management using the Kimchi-Ginger plugin
      6. Managing virtual machine through android phones
      7. Summary
    16. 9. Software-Defined Networking for KVM Virtualization
      1. Introducing Software Defined Networking
        1. Limitations of Linux bridges
      2. Introducing Open vSwitch
        1. Comparison between Linux bridge and Open vSwitch
          1. Open vSwitch architecture
        2. Open vSwitch installation and setup
        3. Starting openvswitch.service
        4. Open vSwitch kernel module
        5. Getting started with the Open vSwitch command-line interface
        6. Setting up your first Open vSwitch bridge
        7. Configuring an Open vSwitch bridge manually using the ovs-vsctl command
        8. Configuring an Open vSwitch bridge using network scripts
      3. Integrating KVM VMs and OVS
      4. VLANs with Open vSwitch
        1. Configuring VLANs for KVM virtual machines
        2. Using libvirt integration
        3. Open vSwitch QoS – controlling KVM VM traffic
      5. Applying traffic rate limiting
        1. Controlling outbound (egress) traffic
        2. Applying traffic shaping
      6. Overlay networks
      7. Configuring Open vSwitch tunnels with VxLan
        1. KvmHOST1 host side configuration
        2. kvmHOST2 host configuration
      8. Network port mirroring
        1. Configuring port mirroring
      9. Managing Open vSwitch using the OpenDaylight SDN controller
        1. Installing the OpenDaylight controller (ODL-sys)
          1. Hardware requirements
          2. Installing and configuring ODL
          3. Adding an Open vSwitch (vswitch001) instance to the OpenDaylight controller on system (ODL-sys)
          4. Installing flows on the OVS bridge using OpenDaylight Dashboard
      10. Basic Open vSwitch troubleshooting
      11. Summary
    17. 10. Installing and Configuring the Virtual Datacenter Using oVirt
      1. Introducing oVirt
        1. oVirt architecture
          1. The oVirt engine
          2. The oVirt node
          3. Storage
          4. Networking
      2. Installing the oVirt engine
        1. Preparing the system for oVirt engine installation
        2. Installing oVirt node
      3. Summary
    18. 11. Starting Your First Virtual Machine in oVirt
      1. Getting acquainted with oVirt data center and cluster
        1. Initiating an oVirt data center
      2. Creating storage domains
      3. Creating logical networks
      4. Creating and starting a virtual machine
      5. What next?
      6. Summary
    19. 12. Deploying OpenStack Private Cloud backed by KVM Virtualization
      1. OpenStack architecture
        1. Core OpenStack components
      2. OpenStack deployment
        1. RDO OpenStack
          1. RDO OpenStack deployments methods
          2. Installing Packstack
            1. Prerequisites
            2. Installing the Packstack installer
            3. Running Packstack to install OpenStack
      3. Launching First Instance
      4. Troubleshooting the virtualization layer of OpenStack
      5. Accessing the instance configuration database
      6. QEMU Monitor Protocol
      7. Summary
    20. 13. Performance Tuning and Best Practices in KVM
      1. VirtIO
      2. CPU tuning
        1. The number of vCPUs
        2. CPU configuration
        3. CPU topology
        4. CPU pinning
          1. The numactl command
      3. Working with memory
        1. Memory allocation
        2. Memory tuning
        3. Memory backing
          1. locked
          2. nosharepages
          3. hugepages
      4. Getting acquainted with Kernel Same Page merging
        1. KSM packages and files
      5. Tuning CPU and memory with NUMA
        1. What is NUMA?
        2. NUMA memory allocation policies
          1. numatune
          2. emulatorpin
        3. KSM and NUMA
        4. Automatic NUMA balancing
        5. Understanding numad and numastat
      6. Disk and block I/O tuning
        1. Cache mode
        2. I/O mode
        3. I/O tuning
      7. Networking tuning in KVM
        1. How to turn it on?
      8. KVM guest time-keeping best practices
        1. kvm-clock
      9. Summary
    21. 14. V2V and P2V Migration Tools
      1. Introducing the virt-v2v utility
      2. How does virt-v2v work?
        1. Getting the virt-v2v utility
        2. Preparing for the v2v conversion
        3. Conversion process
      3. VMware guest conversion
        1. Converting a VMware vSphere guest to a standalone KVM host
        2. Converting a VMware vSphere guest to oVirt
        3. Converting a VMware vSphere guest to an OpenStack-Glance repository
      4. Xen guest conversion
      5. Converting standalone KVM guests to an oVirt Virtualization platform and the OpenStack cloud
      6. Troubleshooting virt-v2v related issues
      7. Physical system to virtual conversion
        1. Creating a virt-p2v bootable image
      8. Can we convert any physical computers to virtual using virt-v2v?
        1. Booting a physical system using a virt-p2v bootable disk for conversion
      9. Converting virtual machines from unsupported virtualization platforms
        1. List of input and output methods supported with virt-v2v
      10. Summary
    22. A. Converting a Virtual Machine into a Hypervisor
      1. Introducing nested KVM
      2. How to enable nested KVM?
    23. Index

Product information

  • Title: Mastering KVM Virtualization
  • Author(s): Humble Devassy Chirammal, Prasad Mukhedkar, Anil Vettathu
  • Release date: August 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781784399054