You are previewing The Book of Xen.
O'Reilly logo
The Book of Xen

Book Description

Xen, the open source virtualization tool, is a system administrator's dream. Xen is a free, high-performance virtual machine monitor that lets you consolidate your hardware and finally put those unused cycles to use—without sacrificing reliability, performance, or scalability.

The Book of Xen explains everything you need to know in order to use Xen effectively, including installation, networking, memory management, and virtualized storage. You'll also learn how to use Xen and standard Linux tools to take snapshot backups, perform QoS operations on network traffic, and limit over-aggressive disk users.

Authors Chris Takemura and Luke S. Crawford show you how to:

  • Provide virtual hosting for dozens of users, each with their own individual needs

  • Install and manage multiple guests, including various flavors of Linux, NetBSD, Solaris, and Windows

  • Choose the right virtual storage options for your needs

  • Migrate your systems seamlessly and create new images

  • Tune and benchmark your systems to make them as fast as possible

  • Troubleshoot Xen's most common problems like network and memory management

  • Expert advice is priceless when it comes to running a complicated open source virtualization technology like Xen. You'll get the advice you need in The Book of Xen .

    Table of Contents

    1. The Book of Xen
      1. FOREWORD
      2. ACKNOWLEDGMENTS
      3. INTRODUCTION
        1. Virtualization: A Brief History
        2. So What's Xen Again? (And Why Should I Use It?)
          1. Xen's Limitations
          2. So, Why Should I Use Xen?
        3. Overview of the Book
        4. But I Am Impatient!
      4. 1. XEN: A HIGH-LEVEL OVERVIEW
        1. Virtualization Principles
        2. Virtualization Techniques: Full Virtualization
        3. Virtualization Techniques: OS Virtualization
        4. Paravirtualization: Xen's Approach
          1. How Paravirtualization Works
        5. Xen's Underpinnings: The Gory Details
          1. Scheduling
          2. Interrupts
          3. Memory
          4. I/O Devices
          5. Networking
          6. Block Devices
        6. Putting It Together
      5. 2. GETTING STARTED
        1. Hardware Compatibility
        2. Installing CentOS
        3. Getting Familiar with Your Xen System
          1. Management with xm
        4. Making a DomU
          1. Anatomy of a Domain Configuration File
        5. Configuring the DomU
        6. You're Finished. Have a Cookie.
      6. 3. PROVISIONING DOMUS
        1. A Basic DomU Configuration
        2. Selecting a Kernel
        3. Quick-and-Dirty Install via tar
          1. Why This Is Not the Best Idea
          2. Stuff to Watch Out For
        4. Using the Package Management System with an Alternate Root
          1. Red Hat, CentOS, and Other RPM-Based Distros
          2. Debootstrap with Debian and Ubuntu
            1. Renaming Network Devices
        5. QEMU Install
        6. virt-install—Red Hat's One-Step DomU Installer
        7. Converting VMware Disk Images
        8. Mass Deployment
          1. Manual Deployment
          2. QEMU and Your Existing Infrastructure
            1. Setting Up SystemImager
          3. Installing pypxeboot
          4. Automated Installs the Red Hat Way
        9. And Then…
      7. 4. STORAGE WITH XEN
        1. Storage: The Basics
        2. Varying Types of Storage
        3. Basic Setup: Files
          1. LVM: Device-Independent Physical Devices
            1. Basic Setup: LVM
        4. Enlarge Your Disk
          1. File-Backed Images
          2. LVM
        5. Copy-on-Write and Snapshots
        6. LVM and Snapshots
        7. Storage and Migration
          1. Network Storage
            1. NFS
        8. Closing Suggestions
      8. 5. NETWORKING
        1. Xen's Network Setup Process
        2. Defining Virtual Interfaces
          1. Naming Virtual Interfaces
          2. Autoconfiguration
          3. Specifying a MAC Address
        3. Manipulating vifs with xm
        4. Securing Xen's Virtual Network
          1. Specifying an IP Address
          2. Firewalling the Dom0
        5. Networking with network-route
        6. Networking with network-bridge
        7. Networking with network-nat
        8. Configuration Variables
        9. Custom Network Scripts
          1. Multiple-Bridge Setups
          2. Bridged and Routing
        10. Further Thoughts
      9. 6. DOMU MANAGEMENT: TOOLS AND FRONTENDS
        1. Tools for the VM Provider
          1. Xen-tools
            1. Installing Xen-tools
            2. Configuring Xen-tools
            3. Xen-tools and RPM-based DomU Images
            4. Xen-tools Postinstall
            5. Extending the Config File Template
            6. xen-list-images
            7. xen-delete-image
          2. libvirt, virsh, and virt-manager
            1. virt-manager
            2. Getting Started with virt-manager
        2. Administering the Virtualized Data Center
        3. Administration for the VM Customer
          1. Xen-shell
      10. 7. HOSTING UNTRUSTED USERS UNDER XEN: LESSONS FROM THE TRENCHES
        1. Advantages for the Users
        2. Shared Resources and Protecting Them from the Users
          1. Tuning CPU Usage
            1. Scheduler Basics
            2. VCPUs and Physical CPUs
            3. Credit Scheduler
          2. Scheduling for Providers
          3. Controlling Network Resources
            1. Monitoring Network Usage
            2. Network Shaping Principles
            3. Shaping Incoming Traffic
            4. Shaping Outgoing Traffic
        3. Storage in a Shared Hosting Environment
          1. Regulating Disk Access with ionice
          2. Backing Up DomUs
        4. Remote Access to the DomU
          1. An Emulated Serial Console
          2. A Menu for the Users
        5. PyGRUB, a Bootloader for DomUs
          1. Making PyGRUB Work
            1. Self-Support with PyGRUB
            2. Setting Up the DomU for PyGRUB
        6. Wrap-Up
      11. 8. BEYOND LINUX: USING XEN WITH OTHER UNIX-LIKE OSS
        1. Solaris
          1. Getting Started with Solaris
          2. Solaris Dom0
          3. Setting Up Xen
          4. Solaris SMF
          5. Creating a Solaris DomU
            1. ZFS Backing Devices
            2. Installing a DomU via PyGRUB
          6. Creating a Solaris DomU Under Linux
          7. OpenSolaris DomU Postinstall Configuration
        2. NetBSD
          1. NetBSD's Historical Xen Support
          2. Installing NetBSD as a Dom0
          3. Installing NetBSD as a DomU
        3. Beyond Paravirtualization: HVM
      12. 9. XEN MIGRATION
        1. Migration for Troglodytes
        2. Migration with xm save and xm restore
        3. Cold Migration
        4. Live Migration
          1. How It Works
          2. Making Xen Migration Work
        5. Migrating Storage
          1. ATA over Ethernet
          2. iSCSI
            1. Setting Up the iSCSI Server
            2. iSCSI Client Setup
        6. Quo Peregrinatur Grex
      13. 10. PROFILING AND BENCHMARKING UNDER XEN
        1. A Benchmarking Overview
          1. UnixBench
          2. Analyzing Network Performance
          3. Measuring Disk Performance with Bonnie++
        2. Application Benchmarks
          1. httperf: A Load Generator for HTTP Servers
          2. Another Application Benchmark: POV-Ray
          3. Tuning Xen for Optimum Benchmarking
        3. Profiling with Xen
          1. Xenoprof
          2. Getting OProfile
            1. Building OProfile
            2. OProfile Quickstart
          3. Profiling Multiple Domains in Concert
            1. Active vs. Passive Profiling
            2. Active Profiling
          4. An OProfile Example
        4. Conclusion
      14. 11. CITRIX XENSERVER: XEN FOR THE ENTERPRISE
        1. Citrix's Xen Products
        2. The Benefits of Using Citrix XenServer
          1. Ten Minutes to Xen
        3. The Disadvantages of Using Citrix XenServer
        4. Getting Started
          1. Prerequisites
          2. Installing Citrix XenServer
        5. Citrix's Xen GUI: XenCenter
        6. Administering VMs with the XenCenter
        7. Installing DomU Images
          1. Installing from the Debian Templates
          2. Templated Linux VM
          3. Windows Install
          4. Creating DomU Images with P2V
          5. Converting Pre-existing Virtual or Physical Machines with XenConvert
          6. XenServer Tools in the DomU
          7. xe: Citrix XenServer's Command-Line Tool
          8. XenServer's Disk Management
          9. Xen Storage Repositories
          10. Emulated CD-ROM Access
          11. XenServer VM Templates
        8. XenServer Resource Pools
        9. Citrix XenServer: A Brief Review
      15. 12. HVM: BEYOND PARAVIRTUALIZATION
        1. Principles of HVM
          1. Device Access with HVM
          2. HVM Device Performance
          3. HVM and SMP
          4. HVM and Migration
        2. Xen HVM vs. KVM
        3. Working with HVM
        4. Creating an HVM Domain
          1. Interacting with an HVM Domain
          2. Getting the Standard Xen Console to Work
        5. HVM Devices
          1. Paravirtualized Drivers
            1. Compiling PV Drivers for HVM Linux
        6. And, for Our Next Trick…
      16. 13. XEN AND WINDOWS
        1. Why Run Windows Under Xen?
        2. Windows on Xen: Prerequisites
        3. Windows on Xen: Installation
          1. Installing Windows Manually
          2. A Discussion of HALs
          3. Installing Windows the Red Hat Way
        4. Windows with the Virtual Framebuffer
        5. Et Voilà!
          1. Windows Activation
          2. Graphics Cards
        6. Paravirtualized Drivers for Windows
          1. Proprietary Windows PVM Drivers
          2. GPL Windows Paravirtualized Drivers
        7. Ongoing Development
      17. 14. TIPS
        1. Compiling Xen
        2. Compile-Time Tuning
          1. Alternate Kernels (Dom0 and DomU)
        3. paravirt_ops Dom0
        4. paravirt_ops DomU
        5. The Xen API: The Way of the Future
        6. Managing Memory with the Balloon Driver
        7. PCI Forwarding
        8. GRUB Configuration
        9. The Serial Console
          1. Enabling Serial Output
          2. The Xen Hypervisor Console
        10. Xen and LILO
        11. The Virtual Framebuffer
        12. Use of the XenStore for Fun and Profit
          1. Automatically Connecting to the VNC Console on Domain Boot
      18. 15. TROUBLESHOOTING
        1. Troubleshooting Phase 1: Error Messages
          1. Errors at Dom0 Boot
          2. DomU Preboot Errors
          3. Creating Domains in Low-Memory Conditions
          4. Configuring Devices in the DomU
          5. Troubleshooting Disks
          6. VM Restarting Too Fast
        2. Troubleshooting Xen's Networking
          1. The DomU Interface Number Increments with Every Reboot
          2. iptables
        3. Memory Issues
        4. Other Messages
          1. A Constant Stream of 4GiB seg fixup Messages
          2. The Importance of Disk Drivers (initrd Problems)
          3. XenStore
        5. Xen's Logs
          1. dmesg and xm dmesg
          2. Logs and What Xen Writes to Them
        6. Applying the Debugger
          1. Xen's Backend Architecture: Making Sense of the Debug Information
          2. Domain Stays in Blocked State
          3. Debugging Hotplug
          4. strace
        7. Python Path Issues
          1. Mysterious Lockups
          2. Kernel Parameters: A Safe Mode
        8. Getting Help
          1. Mailing Lists
          2. The Xen Wiki
          3. The Xen IRC Channel
          4. Bugzilla
          5. Your Distro Vendor
          6. xen-bugtool
        9. Some Last Words of Encouragement
      19. A. XM REFERENCE
        1. xm's Syntax
        2. xm Subcommands
      20. B. THE STRUCTURE OF THE XEN CONFIG FILE
        1. List of Directives
          1. HVM Directives
          2. Device Model Options
      21. About the Authors
      22. COLOPHON