swsuehr writes "The Book of Xen (Takemura and Crawford, No Starch Press, 2009) provides an excellent resource for learning about Xen virtualization. I frequently need to create test environments for examples that appear in various books and magazine articles (in the interest of full disclosure, I've never written for the publisher of this book). In the days before virtualization that meant finding and piecing together hardware. Like many readers, I've been using virtualization in one form or another for several years, including Xen. This book would've saved hours searching around the web looking for tidbits of information and sifting through what works and doesn't work in setting up Xen environments. The authors have done the sifting for me within the ~250 pages of the book.
"The Book of Xen", "A Practical Guide for the System Administrator"
As stated in the subtitle, The Book of Xen is written with the system administrator in mind; someone who is comfortable with tasks like installing Linux and working with the command line. While it wouldn't be impossible for someone completely new to Linux to accomplish the tasks in the book, a bit of experience would go a long way to both visualize and complete the installation and configuration steps shown in the book. As stated in the introduction, the book is organized "(mostly) alternating between theoretical and practical discussion [because] an admin needs both practical experience and a firm theoretical ground to effectively solve problems..." (xxiii).
The authors do an excellent job of explaining what Xen is and where it fits in the virtualization landscape. This explanation begins with the introduction where the reader gathers a brief history of virtualization along with Xen's place in the landscape. Xen's limitations and reasons for using Xen are also covered right in the introduction, along with an overview of the book.
Chapter 1 begins with a high-level overview of Xen. This discussion is excellent if only to get the readers on equal footing for the discussions to come later in the book. Included in this chapter is a discussion of various techniques for virtualization including Full Virtualization, OS Virtualization, and Paravirtualization. The section on Paravirtualization leads nicely into some of the underlying details of scheduling, interrupts, and memory, and other resource management which are handled by Xen and discussed later in the chapter.
Chapter 2 sends the reader down the path of installing and using Xen. It's a short chapter, coming in at about 9 pages, and the reader is expected to be able to handle an install of CentOS with just a bit of guidance from the authors on specific options to select. This is a key point for those among us who have a preference for a certain Linux distribution. The book isn't tied specifically to a single distro, as the authors note in the introduction, "[w]e've tried to keep this book as distribution- and version-independent as possible, except in the tutorial sections, where we try to be extremely specific and detailed..." (xxiv). The base or host system upon which the examples run is based on CentOS, which the authors acknowledge and highlight in Chapter 2, "[f]or the purposes of this chapter, we'll assume you're installing CentOS 5.x with the server defaults and using its built-in Xen support. If you're using something else, this chapter will probably still be useful, but you might have to improvise a bit" (13). There is discussion of the Xen-tools package in a later chapter which shows its installation under Debian Linux too. So far from being tied to one distro, the book is refreshingly neutral in this regard.
By the end of Chapter 2, the reader has a working Xen host system and a domain 0 or dom0 host upon which to provision virtual machines. Included in Chapter 3 is a discussion of how to provision guest operating systems, known as domU in Xen-speak. The authors devote a good number of pages to making this task clear, and work through examples of basic domU installation and the use of package management systems and Debian's debootstrap to create domUs. Additionally in Chapter 3 the reader learns how to convert VMware disk images to a format usable by Xen.
Chapters 4 and 5 examine details of the Xen backend, including storage and networking. Chapter 4 stands out for its recommendation of blktap and LVM (Logical Volume Manager) as the storage backend as well as an overview of LVM itself, along with the use of networked storage for Xen.
Chapter 6 looks at tools for management of Xen, focusing on Xen-tools, libvirt, and Xen-shell while Chapter 7 gives advice for hosting untrusted users with Xen. Chapter 8 discusses the use of Xen with Unix-like operating systems and includes sections on Solaris and NetBSD.
The ability to migrate the virtual machine from one physical machine to another is one of the advantages of virtualization. As pointed out by the authors, a virtual machine might be migrated to take advantage of newer hardware, to perform maintenance, or any number of other reasons. Chapter 9 is of interest for its discussion of Xen migration. Cold and Live migrations are examined and Footnote 1 on page 126 is interesting for its reference to the Kemari Project and Project Remus which are projects to add hardware redundancy to Xen.
Tools and techniques for the measurement of Xen performance are shown in Chapter 10, which walks the reader through basic usage of well-known tools such as Bonnie++, httperf, UnixBench, and others. More importantly for the Xen admin is the discussion of Xen-aware profilers like Xenoprof which is "a version of OProfile that has been extended to work as a system-wide profiling tool under Xen..." (151).
Chapter 11 covers the Citrix XenServer, which is the enterprise-grade commercial Xen product from Citrix. The authors summarized it best in the review of Chapter 11: "Can Citrix's product replace the open source Xen? As always, the answer is maybe. It offers significant improvements in management and some interesting new capabilities, but that's balanced against the substantial cost and annoying limitations" (174).
Chapter 12 begins the discussion of Hardware Virtual Machines (HVMs), which are virtualization extensions that enable "an unmodified operating system [to run] as a domU" (176). This means the ability to run an unmodified version of Microsoft Windows as a guest OS within a Xen environment. The HVM discussion in Chapter 12 leads nicely into Chapter 13, "Xen and Windows".
The main chapters of the book end with Chapter 14, "Tips", and Chapter 15, "Troubleshooting". Both chapters draw on the experience of the authors and provide value to the book for their recommendations. Though the tool of choice for troubleshooting is the nearest Google search box, it's still helpful to glance over the content in the Troubleshooting chapter if for no other reason than to maybe remember that it's there when you receive the dreaded "Error: DestroyDevice() takes exactly 3 arguments" error.
The Book of Xen is almost certainly a time-saver for anyone looking to implement Xen or virtualization with Linux. The back cover states "The Complete Guide to Virtualization with Xen". The book lives up to that statement and more."