Running Xen: A Hands-On Guide to the Art of Virtualization

Book Description

“This accessible and immediately useful book expertly provides the Xen community with everything it needs to know to download, build, deploy and manage Xen implementations.”

—Ian Pratt, Xen Project Leader VP Advanced Technology, Citrix Systems

The Real–World, 100% Practical Guide to Xen Virtualization in Production Environments

Using free, open source Xen virtualization software, you can save money, gain new flexibility, improve utilization, and simplify everything from disaster recovery to software testing. Running Xen brings together all the knowledge you need to create and manage high–performance Xen virtual machines in any environment. Drawing on the unparalleled experience of a world–class Xen team, it covers everything from installation to administration—sharing field-tested insights, best practices, and case studies you can find nowhere else.

The authors begin with a primer on virtualization: its concepts, uses, and advantages. Next, they tour Xen’s capabilities, explore the Xen LiveCD, introduce the Xen hypervisor, and walk you through configuring your own hard–disk–based Xen installation. After you’re running, they guide you through each leading method for creating “guests” and migrating existing systems to run as Xen guests. Then they offer comprehensive coverage of managing and securing Xen guests, devices, networks, and distributed resources. Whether you’re an administrator, data center manager, developer, system integrator, or ISP, Running Xen will help you achieve your goals with Xen–reliably, efficiently, with outstanding performance, and at a surprisingly low cost.

•Understanding the Xen hypervisor: what it does, and how it works

•Using pre-built system images, including compressed file systems

•Managing domains with the xm console

•Populating and storing guest images

•Planning, designing, and configuring networks in Xen

•Utilizing Xen security: special purpose VMs, virtual network segments, remote access, firewalls, network monitors, sHype access control, Xen Security Modules (XSM), and more

•Managing guest resources: memory, CPU, and I/O

•Employing Xen in the enterprise: tools, products, and techniques

Table of Contents

  1. Copyright
    1. Dedication
  2. Foreword
  3. Preface
  4. Acknowledgments
  5. About the Authors
  6. 1. Xen—Background and Virtualization Basics
    1. Common Uses and Benefits of Virtualization
    2. Types of Virtualization
      1. Emulation
      2. Full Virtualization
      3. Paravirtualization
      4. Operating System Level Virtualization
      5. Other Types of Virtualization
      6. Overview of Virtualization Types
    3. Virtualization Heritage
      1. The IBM Mainframe
      2. Virtualization on Commodity Hardware
      3. Virtualization Extensions for x86
      4. Xen Origins and Time Line
    4. Other Virtualization Systems for Commodity Hardware
      1. Emulation
      2. Full Virtualization
      3. Paravirtualization
      4. Operating System Virtualization
      5. Popular Virtualization Products
    5. Summary
    6. References and Further Reading
  7. 2. A Quick Tour with the Xen LiveCD
    1. Running the LiveCD
    2. Step 1: Downloading the LiveCD Image and Creating the CD
    3. Step 2: Choosing a Domain0 Image from the GRUB Menu
    4. Step 3: Logging In and the Desktop
    5. Step 4: Creating Guests
    6. Step 5: Deleting a Guest
    7. Step 6: Interacting with Your Guests
    8. Step 7: Testing Your Networking
    9. Too Many Guests
    10. Summary
    11. References and Further Reading
  8. 3. The Xen Hypervisor
    1. Xen Hypervisor
    2. A Privileged Position
      1. Protection Rings
    3. Domain0
    4. Xen Boot Options
    5. Choosing an OS for Domain0
    6. xend
      1. Controlling xend
      2. xend Logs
      3. xend Configuration
    7. XenStore
    8. Summary
    9. References and Further Reading
  9. 4. Hardware Requirements and Installation of Xen Domain0
    1. Xen Domain0 Processor Requirements
      1. Intel VT
      2. AMD-V
      3. HVM
    2. Hardware Device Support and Recommendations
      1. Disks and Controllers
      2. Networking Devices
      3. Graphics Devices
      4. Power Management
      5. Help for Unsupported Hardware
    3. Memory Requirements
    4. Choosing and Obtaining a Version of Xen
      1. Open Source Distributions
      2. Commercially Supported Options
        1. Citrix XenServer Product Group and XenSource
        2. Virtual Iron Software, Inc.
        3. Enterprise Class Linux Support
    5. Methods of Installing Domain0 Hosts
      1. Common Prerequisite: The Grand Unified Boot Loader (GRUB)
    6. Linux Distributions
      1. OpenSUSE
      2. CentOS
      3. Ubuntu
      4. Xen from Binary Packages
      5. Gentoo
    7. XenExpress
    8. Non-Linux Domain0 Installations
    9. Building from Source
    10. Summary
    11. References and Further Reading
  10. 5. Using Prebuilt Guest Images
    1. Introduction to DomU Guests
      1. Guest Images
      2. Operating System Kernels
      3. Configuration Files
    2. Working with Prebuilt Guest Images
      1. Types of Guest Images
      2. Downloading Prebuilt Guest Images
        3. Other Sites
      3. Mounting and Booting Prebuilt Images
        1. Boot Methods
        2. pygrub
        3. Using an External Xen Compatible Kernel
        4. Disk Images
      4. Downloading Compressed File System Images
        1. GParted
        2. fdisk
        3. mkfs
        4. mkswap
    3. Converting Images from Other Virtualization Platforms
    4. Summary
    5. References and Further Reading
  11. 6. Managing Unprivileged Domains
    1. Introduction to the xm Utility
      1. Prerequisites for Running the xm Utility
      2. Generic Format of an xm Command
    2. The xm list Subcommand
      1. Basic List Information
      2. Listing Information about a Specific Guest
      3. long Option
      4. Label Option
    3. The xm create Subcommand
      1. Prerequisites for xm create
      2. Simple Examples of xm create
    4. Guest Configuration Files
      1. Python Format
      2. Common Configuration Options
      3. S-Expression (SXP) Format
      4. Path to Configuration Files
    5. Diagnosing Problems with Guest Creation
      1. Dry Run
      2. Console Output
      3. Sample Problems
        1. Problem 1: String Value Not in Quotes in Configuration File
        2. Problem 2: Kernel Image Does Not Exist
        3. Problem 3: Duplicate Guest Name
        4. Problem 4: Insufficient Memory
        5. Problem 5: Insufficient Loopback Devices
        6. Problem 6: Unable to Run Networking Script
        7. Problem 7: Running the Wrong Kernel in Domain0
        8. Problem 8: Loading a Kernel Without Modules
        9. Problem 9: Running the xm Command from a Non-Root Account
    6. Automatically Starting DomUs
    7. Shutting Down Guest Domains
      1. xm shutdown
      2. xm reboot
      3. xm destroy
    8. Pausing Domains
      1. xm pause
      2. xm unpause
    9. Interacting with a Guest Nongraphically
      1. xm console
      2. SSH
    10. Interacting with a Guest Graphically
      1. X Forwarding with SSH
      2. Configuration of SSH Server and Client
        1. Usage of SSH X Forwarding
      3. VNC
        1. Basic Usage
      4. Virtual Frame Buffer and Integrated VNC/SDL Libraries
      5. Freenx
      6. Remote Desktop
    11. Summary
    12. References and Further Reading
  12. 7. Populating Guest Images
    1. Hardware Virtual Machine (HVM) Guest Population
      1. Populating a Guest Image from a Disc or Disc Image (Windows XP Example)
        1. Automated Population with virt-install
      2. Paravirtualized (PV) Guest Population
        1. OpenSUSE: YaST Virtual Machine Management
        2. CentOS/Fedora: virt-manager
        3. Debian/Ubuntu: debootstrap
        4. Gentoo: quickpkg and domi Scripts
          1. quickpkg
          2. Gentoo Domi Scripts
        5. Xen Express
    2. Guest Image Customization
      1. Customizing Hostnames
        1. Customizing Users
        2. Customizing Packages and Services
        3. Customizing the File System Table (/etc/fstab)
    3. Converting Existing Installations
    4. Summary
    5. References and Further Reading
  13. 8. Storing Guest Images
    1. Logical Volumes
      1. Basic LVM Usage
      2. Resizing Images
        1. Increasing the Size of a Volume
        2. Reducing the Size of a Volume
      3. Image Snapshots Using Copy on Write
    2. Network Image Storage Options
      1. iSCSI
        1. Server Setup in iSCSI
        2. Client Setup in iSCSI
      2. ATA over Ethernet (AoE)
        1. Server Setup in AoE
        2. Client Setup in AoE
      3. NFS
        1. Server Setup in NFS
        2. Client Setup in NFS
        3. Using NFS as Root File System
      4. Comparing Network Storage Options
    3. Guest Image Files
      1. Preparing Compressed tar Image Files
      2. Preparing Disk Image Files
        1. Allocating Virtual Devices with dd
        2. Setting Up and Controlling Virtual Devices with losetup
        3. Creating Partitions on the Virtual Disks with fdisk
        4. Making Virtual Disk Partitions Available with kpartx
      3. Preparing Guest Partition Image Files
      4. Mounting Disks and Partition Images
        1. Disk Images
        2. Partition Images
    4. Summary
    5. References and Further Reading
  14. 9. Device Virtualization and Management
    1. Device Virtualization
      1. Paravirtualization of Devices
      2. Full Virtualization of Devices
      3. No Virtualization
    2. Backends and Frontends
      1. Backend Information in XenStore
      2. Frontend Information in XenStore
    3. Granting Control of a PCI Device
      1. Identifying a PCI Device
      2. Hiding a PCI Device from Domain0 at Boot
      3. Manually Unbinding/Binding a PCI Device at Runtime
      4. Granting a PCI Device to Another Domain
    4. Exclusive Device Access Versus Trusted Driver Domains
      1. Exclusive Device Access
      2. Trusted Driver Domains
      3. Problems Using Trusted Driver Domains
    5. Device Emulation with QEMU-DM
    6. Future Directions
      1. More Devices
      2. Smart Devices
    7. Summary
    8. References and Further Reading
  15. 10. Network Configuration
    1. Network Virtualization Overview
    2. Designing a Virtual Network Topology
    3. Bridging, Routing, and Network Address Translation
    4. Frontend and Backend Network Drivers and Naming
    5. Overview of Network Configuration in Xen
      1. High-Level Steps
      2. Xend Configuration File
      3. Guest Domain’s Configuration File
        1. vif
        2. nics
        3. dhcp
        4. netmask and gateway
    6. Details of Bridging Mode
      1. Bridging Configuration Example
      2. Testing Results
    7. Details of Routing Mode
      1. Routing Configuration Example
      2. Testing Results
    8. Details of NAT Mode
      1. NAT Configuration Example
      2. Testing Results
    9. Configuring Purely Virtual Network Segments
      1. Configuring dummy0
      2. Testing dummy0
      3. Configuring Dummy Bridge
      4. Testing Dummy Bridge
    10. Assigning MAC Addresses to Virtual Network Interfaces
      1. MAC Addresses
      2. Specifying or Generating a MAC Address for a Guest Domain
    11. Assigning IP Addresses
      1. Using an External DHCP Server to Obtain an IP for a Guest Domain
      2. Manually Assigning an IP to a Guest Domain
      3. Using an Internal DHCP Server to Obtain an IP for a Guest Domain
    12. Handling Multiple Network Interfaces in a Domain
      1. Handling Multiple Network Interfaces in a driver domain
      2. Handling Multiple Network Interfaces in a Guest Domain
        1. Configure Multiple vifs to a Guest Domain
        2. Configure a Running Guest Domain with the Command xm
    13. vnet—Domain Virtual Network
      1. Installing vnet
      2. Running vnet
        1. Load the vnet Module
        2. Configure vnet
        3. Create vnet
    14. Summary
    15. References and Further Reading
  16. 11. Securing a Xen System
    1. Structuring Your System for Security
      1. Special Purpose Virtual Machines
      2. Creating Virtual Network Segments
    2. Securing the Privileged Domain
      1. Removing Software and Services
      2. Limiting Remote Access
      3. Limiting the Local Users
      4. Move Device Drivers into DriverDomains
    3. Firewall and Network Monitors
      1. Running a Firewall with iptables
        1. iptables Overview
        2. iptables Configuration
        3. An iptables Example
      2. Snort
        1. Obtaining Snort
        2. Snort and Network Intrusion Detection Mode
    4. Mandatory Access Control with sHype and Xen Security Modules
      1. sHype
        1. Adding sHype to Xen
        2. Configuring an sHype Policy
      2. Xen Security Modules (XSM)
    5. DomU Security
      1. Running VMs Only When Needed
      2. Backing Up Virtual Machine Images
        1. Dangers of VM Backup and Restore
    6. Summary
    7. References and Further Reading
  17. 12. Managing Guest Resources
    1. Accessing Information about Guests and the Hypervisor
      1. xm info
      2. xm dmesg
      3. xm log
      4. xm top
      5. xm uptime
    2. Allocating Guest Memory
      1. Shadow Page Tables
      2. Balloon Driver
      3. Improving Stability with Swap Space
      4. Managing the Allocation of Guest Memory
        1. xm mem-set
        2. xm mem-max
    3. Managing Guest Virtual CPUs
      1. Comparing Virtual, Logical, and Physical Processors
      2. HVM VCPU Management
      3. VCPU Subcommands
        1. xm vcpu-list
        2. xm vcpu-set
        3. xm vcpu-pin
      4. When to Manually Administer VCPUs
    4. Tuning the Hypervisor Scheduler
      1. Weight and Cap
      2. Protection from Misbehaving Guests
      3. Using the Credit Scheduler Command
    5. Choosing a Guest IO Scheduler
      1. Noop Scheduler
      2. Deadline Scheduler
      3. Anticipatory Scheduler (as)
      4. Complete Fair Queuing Scheduler (cfq)
      5. Using IO Schedulers
    6. Summary
    7. References and Further Reading
  18. 13. Guest Save, Restore, and Live Migration
    1. Representing the State of a Virtual Machine
    2. Basic Guest Domain Save and Restore
      1. xm save
      2. xm restore
      3. Possible Save and Restore Errors
    3. Types of Guest Relocation
      1. Cold Static Relocation
      2. Warm Static (Regular) Migration
      3. Live Migration
    4. Preparing for xm migrate
      1. Configuring xend
      2. Proximity of Sources and Destinations on the Network
      3. Network-Accessible Storage
      4. Guest Domain Configuration
      5. Version and Physical Resource Requirements
    5. Experience with xm migrate
      1. xm migrate
      2. Using xm migrate for Warm Static Migration
      3. Using xm migrate for Live Migration
      4. Possible Migration Errors
    6. Summary
    7. References and Further Reading
  19. 14. An Overview of Xen Enterprise Management Tools
    1. Programmatic Interfaces to the Xen Hypervisor
      1. Libvirt
      2. Xen-CIM
      3. Xen API
      4. Legacy Interfaces to Xend
    2. Citrix XenServer Enterprise, Standard, and XenExpress Editions
    3. Virtual Iron
    4. IBM Virtualization Manager
    5. Enomalism
    6. virt-manager
    7. XenMan
    8. Managing Multiple Systems
    9. Summary
    10. References and Further Reading
  20. A. Resources
    1. Xen Community
    2. XenWiki
    3. Xen Mailing Lists and Bug Reporting
    4. Xen Summits
    5. Xen Source Code
    6. Academic Papers and Conferences
    7. Distribution-Specific Resources
  21. B. The xm Command
  22. C. Xend Configuration Parameters
  23. D. Guest Configuration Parameters
  24. E. Xen Performance Evaluation
    1. Xen Performance Measurements
      1. Repeatability of the Xen Team’s Results
      2. Xen and Virtual Web Hosting
      3. Comparing XenoLinux to Native Linux on Older PC Hardware
      4. Xen on x86 Versus IBM zServer
    2. Performance Isolation in Xen
    3. Performance of Xen Virtual Network and Real Network
    4. Summary

Product Information

  • Title: Running Xen: A Hands-On Guide to the Art of Virtualization
  • Author(s): Jeanna Matthews, Brendan Johnson, Patrick F. Wilbur, Jeremy Bongio, Wenjin Hu, Todd Deshane, Eli M. Dow
  • Release date: April 2008
  • Publisher(s): Prentice Hall
  • ISBN: 9780132074674