Red Hat Enterprise Linux 6 Virtualization Getting Started Guide An introduction to virtualization concepts Dayle Parker Scott Radvan Laura Novich Jacquelynn East
Red Hat Enterprise Linux 6 Virtualization Getting Started Guide An introduction to virtualization concepts Dayle Parker Red Hat Engineering Co ntent Services dayleparker@redhat.co m Laura No vich Red Hat Engineering Co ntent Services lno vich@redhat.co m Jacquelynn East Red Hat Engineering Co ntent Services jeast@redhat.co m Sco tt Radvan Red Hat Engineering Co ntent Services sradvan@redhat.
Legal Notice Co pyright © 20 11-20 14 Red Hat, Inc. This do cument is licensed by Red Hat under the Creative Co mmo ns Attributio n-ShareAlike 3.0 Unpo rted License. If yo u distribute this do cument, o r a mo dified versio n o f it, yo u must pro vide attributio n to Red Hat, Inc. and pro vide a link to the o riginal. If the do cument is mo dified, all Red Hat trademarks must be remo ved.
T able of Cont ent s T able of Contents .Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2. . . . . . . . . . 1. Do c ument Co nventio ns 2 1.1. Typ o g rap hic Co nventio ns 2 1.2. Pull-q uo te Co nventio ns 3 1.3. No tes and Warning s 4 2 . G etting Help and G iving Feed b ac k 4 2 .1. Do Yo u Need Help ? 4 2 .2. We Need Feed b ac k! 5 . .hapt C . . . .er . .1. .. Int .
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Preface 1. Document Convent ions This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. 1.1. T ypographic Convent ions Four typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows.
Preface C haracter T abl e. D ouble-click this highlighted character to place it in the T ext to co py field and then click the C o py button. Now switch back to your document and choose Ed it → Past e from the g ed it menu bar. The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide before, " "so cannot be deassigned\n", __func__); r = -EINVAL; goto out; } kvm_deassign_device(kvm, match); kvm_free_assigned_device(kvm, match); o ut: mutex_unlock(& kvm->lock); return r; } 1.3. Not es and Warnings Finally, we use three visual styles to draw attention to information that might otherwise be overlooked. Note Notes are tips, shortcuts or alternative approaches to the task at hand.
Preface Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and technology. You can find a list of publicly available mailing lists at https://www.redhat.com/mailman/listinfo. Click on the name of any mailing list to subscribe to that list or to access the list archives. 2.2.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Chapter 1. Introduction The Virtualization Getting Started Guide introduces the basics of virtualization and assists with the navigation of other virtualization documentation and products that Red Hat provides. This guide also explains the advantages of virtualization and dispels some common myths that exist regarding virtualization. 1.1.
Chapt er 1 . Int roduct ion Red Hat Enterprise Linux — Virtualization Getting Started Guide: This guide provides an introduction to virtualization concepts, advantages, and tools, and an overview of Red Hat virtualization documentation and products. Red Hat Enterprise Linux — Virtualization Host Configuration and Guest Installation Guide: This guide covers the installation of virtualization software and configuration of guest machines on a virtualization host.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Note All of the guides for these products are available at the Red Hat Customer Portal: https://access.redhat.
Chapt er 2 . What is virt ualiz at ion and migrat ion? Chapter 2. What is virtualization and migration? This chapter discusses terms related to virtualization and migration. 2.1. What is virt ualiz at ion? Virtualization is a broad computing term used for running software, usually multiple operating systems, concurrently and in isolation from other programs on a single system.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide An offline migration suspends the guest virtual machine, and then moves an image of the virtual machine's memory to the destination host. The virtual machine is then resumed on the destination host and the memory used by the virtual machine on the source host is freed. Live mig rat io n Live migration is the process of migrating an active virtual machine from one physical host to another. 2.2.1.
Chapt er 2 . What is virt ualiz at ion and migrat ion? Note For more information on V2V, refer to the Red Hat Enterprise Linux 6 V2V Guide.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Chapter 3. Advantages and misconceptions of virtualization There are many advantages to virtualization and perhaps an equal amount of misconceptions surrounding it. This chapter explores these points. 3.1. Virt ualiz at ion cost s A common misconception is that virtualization is too expensive to justify the change. Virtualization can be expensive to introduce but often it saves money in the long term.
Chapt er 3. Advant ages and misconcept ions of virt ualiz at ion This is no longer the case; modern virtualization technology has greatly improved the speed of virtual machines. Benchmarks show that virtual machines can run typical server applications nearly as efficiently as bare metal systems: Red Hat Enterprise Linux 6.4 and KVM recorded an industry-leading TPC-C benchmark with an IBM D B2 database running in an entirely virtualized x86 environment and delivering 88% of bare metal performance.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide SELin u x SELinux was developed by the US National Security Agency and others to provide Mandatory Access Control (MAC) for Linux. Under control of SELinux, all processes and files are given what is known as a type, and access is limited by fine-grained controls. SELinux limits the abilities of an attacker and works to prevent many common security exploits such as buffer overflow attacks and privilege escalation.
Chapt er 3. Advant ages and misconcept ions of virt ualiz at ion deployment suited to Red Hat Enterprise Virtualization may include databases, trading platforms, or messaging systems that must run continuously without any downtime. So f t ware d evelo p ers p ro d u cin g man ag emen t ap p licat io n s: lib virt Both virt-manager and Red Hat Enterprise Virtualization (RHEV) use libvirt to manage virtual machines.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Chapter 4. Introduction to Red Hat virtualization products This chapter introduces the various virtualization products available in Red Hat Enterprise Linux. 4 .1. KVM and virt ualiz at ion in Red Hat Ent erprise Linux Wh at is K VM? KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on AMD 64 and Intel 64 hardware that is built into the standard Red Hat Enterprise Linux 6 kernel.
Chapt er 4 . Int roduct ion t o Red Hat virt ualiz at ion product s Note For more information on KSM, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide. Q EMU G u est Ag en t The QEMU Guest Agent runs on the guest operating system and allows the host machine to issue commands to the guest operating system. Note For more information on the QEMU Guest Agent, refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide For host systems: https://access.redhat.com/site/articles/rhel-limits For the KVM hypervisor: https://access.redhat.com/site/articles/rhel-kvm-limits For a complete chart of supported operating systems and host and guest combinations refer to https://access.redhat.com/site/supported-hypervisors. 4 .2.
Chapt er 4 . Int roduct ion t o Red Hat virt ualiz at ion product s 4 .3. Virt ualiz ed hardware devices Virtualization on Red Hat Enterprise Linux 6 presents three distinct types of system devices to virtual machines. The three types include: Virtualized and emulated devices Para-virtualized devices Physically shared devices These hardware devices all appear as being physically attached to the virtual machine but the device drivers work in different ways. 4 .3.1.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Red Hat Enterprise Linux 6.1 and above provides an emulated (Intel) HD A sound device, i ntel -hd a.
Chapt er 4 . Int roduct ion t o Red Hat virt ualiz at ion product s KVM provides two emulated PCI ID E interfaces. An emulated ID E driver can be used to attach any combination of up to four virtualized ID E hard disks or virtualized ID E CD -ROM drives to each virtual machine. The emulated ID E driver is also used for virtualized CD -ROM and D VD -ROM drives. T h e emu lat ed f lo p p y d isk d rive d river The emulated floppy disk drive driver is used for creating virtualized floppy drives. 4 .3.2.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Windows Server 2008 Windows 7 Windows Server 2012 Windows 8 (32/64 bit) T h e p ara- virt u aliz ed clo ck Guests using the Time Stamp Counter (TSC) as a clock source may suffer timing issues. KVM works around hosts that do not have a constant Time Stamp Counter by providing guests with a para-virtualized clock.
Chapt er 4 . Int roduct ion t o Red Hat virt ualiz at ion product s U SB p asst h ro u g h The KVM hypervisor supports attaching USB devices on the host system to virtual machines. USB device assignment allows guests to have exclusive access to USB devices for a range of tasks. It allows USB devices to appear and behave as if they were physically attached to the virtual machine. Note For more information on USB passthrough, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide To allow safe migration of virtual machines between hosts with different sets of CPU features, q emu kvm does not expose all features from the host CPU to guest operating systems by default. Instead, CPU features are exposed based on the chosen CPU model. If a virtual machine has a given CPU feature enabled, it is not possible to migrate it to a host that does not support exposing that feature to guests.
Chapt er 4 . Int roduct ion t o Red Hat virt ualiz at ion product s virtio-scsi is the recommended para-virtualized storage device for guests using large numbers of disks, or advanced storage features such as TRIM. virt io - b lk virtio-blk is a para-virtualized storage device suitable for exposing image files to guests. virtio-blk can provide the best disk I/O performance for virtual machines, but has fewer features than virtio-scsi.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Logical volumes can be used for disk images and managed using the system's LVM tools. LVM offers higher performance than file systems because of its simpler block storage model. LVM thin provisioning offers snapshots and efficient space usage for LVM volumes, and can be used as an alternative to migrating to qcow2.
Chapt er 5. Virt ualiz at ion T ools Chapter 5. Virtualization Tools This chapter provides an introduction to the many tools available to assist with virtualization. 5.1. vi rsh virsh is a command line interface (CLI) tool for managing the hypervisor and guest virtual machines. The vi rsh command line tool is built on the lib virt management API and operates as an alternative to the q emu-kvm command and the graphical virt - man ag er application.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide 5.4 . g uestfi sh guestfish is a shell and command line tool for examining and modifying virtual machine disk images. This tool uses libguestfs and exposes all functionality provided by the g uestfs API. Warning Using g uestfi sh on running virtual machines can cause disk-image corruption. Use the g uestfi sh command with the --ro (read-only) option if the disk image is being used by a running virtual machine.
Chapt er 5. Virt ualiz at ion T ools vi rt-ed i t A command line tool used to edit files that exist on a specified virtual machine. This tool is installed as part of the libguestfs-tools package. Warning Using vi rt-ed i t on live virtual machines can cause disk corruption in the virtual machine. Although the vi rt-ed i t command will try to prevent users from editing files on live virtual machines, it is not guaranteed to catch all instances. D o not use vi rt-ed i t on a live virtual machine.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Warning Using vi rt-rescue on running virtual machines can cause disk corruption in the virtual machine. vi rt-rescue attempts to prevent its own use on running virtual machines, but cannot catch all cases. Using the command with the --ro (read-only) option will not cause disk corruption, but may give strange or inconsistent results. Avoid using vi rt-rescue on a running virtual machine.
Chapt er 5. Virt ualiz at ion T ools vi rt-to p A command line utility similar to to p, which shows statistics related to virtualized domains. This tool ships in its own package: virt-top. vi rt-v2v A graphical tool to convert virtual machines from Xen and VMware hypervisors to run on KVM. This tool ships in its own package: virt-v2v. vi rt-vi ewer A minimal tool for displaying the graphical console of a virtual machine via the VNC and SPICE protocols. This tool ships in its own package: virt-viewer.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide Revision History R evisio n 1.0- 15 Version for 6.6 GA release. Fri O ct 10 2014 D ayle Parker R evisio n 1.0- 12 T u e O ct 07 2014 Sco t t R ad van Apply SME feedback on guestfish manipulation of images from BZ #1043235. R evisio n 1.0- 11 T h u rs Au g 28 2014 Made minor clarity and accuracy fixes forBZ #1043235. Jo d i B id d le R evisio n 1.0- 10 Fri Au g 8 2014 D ayle Parker Build for beta release.
Revision Hist ory Added GlusterFS description for BZ #979271. Removed Hypervisor D eployment Guide from documentation list. R evisio n 0.3- 32 Mo n Sep t 2 2013 D ayle Parker Corrected terminology in Para-virtualized devices section for BZ #983371. Edited Hyper-V Enlightenment description for BZ #923342. R evisio n 0.3- 31 Fri Au g u st 30 2013 Included Hyper-V Enlightenment description for BZ #923342. D ayle Parker R evisio n 0.
Red Hat Ent erprise Linux 6 Virt ualiz at ion G et t ing St art ed G uide R evisio n 0.3- 8 T h u rs O ct 4 2012 D ayle Parker Added tech preview note about virtio-scsi in Ch.4 from SME review. Added QEMU Guest Agent description. Moved configuration-specific part of 4.3.4. Guest CPU Models to Virtualization Host Configuration and Guest Installation Guide for BZ #842970. R evisio n 0.3- 7 Wed O ct 3 2012 D ayle Parker Applied peer feedback to Virtualization in Red Hat Enterprise Linux introduction.
Revision Hist ory R evisio n 0.2- 6 4 Mo n Ap ril 2 2012 Corrections to Chapter 2 (BZ #800401). Lau ra N o vich R evisio n 0.2- 6 1 Fri March 30 2012 D ayle Parker Made corrections in Chapter 3: Advantages (BZ #800409). Adjusted terms to " virtual machine" and " virtualized guest" where appropriate; corrected outdated link in 4.1; corrected terms in Emulated network devices (from drivers) in (BZ #798063). R evisio n 0.2- 52 Wed Jan u ary 11 2012 BZ #772859 clarified acronym.