red hat enterprise linux-7-virtualization deployment and administration guide-en-us

582
Laura Novich Dayle Parker Scott Radvan Tahlia Richardson Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide Installing, configuring, and managing virtual machines on a Red Hat Enterprise Linux physical machine

Upload: victorpetrini

Post on 12-Feb-2016

255 views

Category:

Documents


24 download

DESCRIPTION

Red Hat Enterprise Linux-7-Virtualization Deployment and Administration Guide

TRANSCRIPT

  • Laura Novich Dayle Parker Scott RadvanTahlia Richardson

    Red Hat Enterprise Linux 7Virtualization Deployment andAdministration Guide

    Installing, configuring, and managing virtual machines on a Red HatEnterprise Linux physical machine

  • Red Hat Enterprise Linux 7 Virtualizat ion Deployment and Administrat ionGuide

    Installing, configuring, and managing virtual machines on a Red HatEnterprise Linux physical machine

    Laura NovichRed Hat Customer Content [email protected] ParkerRed Hat Customer Content [email protected] RadvanRed Hat Customer Content [email protected] RichardsonRed Hat Customer Content [email protected]

  • Legal NoticeCopyright 2015 Red Hat, Inc.This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0Unported License. If you distribute this document, o r a modified version o f it, you must provideattribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all RedHat trademarks must be removed.Red Hat, as the licensor o f this document, waives the right to enforce, and agrees not to assert,Section 4d o f CC-BY-SA to the fullest extent permitted by applicable law.Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the InfinityLogo, and RHCE are trademarks o f Red Hat, Inc., registered in the United States and o thercountries.Linux is the registered trademark o f Linus Torvalds in the United States and o ther countries.Java is a registered trademark o f Oracle and/or its affiliates.XFS is a trademark o f Silicon Graphics International Corp. or its subsidiaries in the UnitedStates and/or o ther countries.MySQL is a registered trademark o f MySQL AB in the United States, the European Union andother countries.Node.js is an o fficial trademark o f Joyent. Red Hat Software Collections is not fo rmallyrelated to or endorsed by the o fficial Joyent Node.js open source or commercial pro ject.The OpenStack Word Mark and OpenStack Logo are either registered trademarks/servicemarks or trademarks/service marks o f the OpenStack Foundation, in the United States and o thercountries and are used with the OpenStack Foundation's permission. We are not affiliated with,endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.All o ther trademarks are the property o f their respective owners.

    AbstractThis guide covers how to configure a Red Hat Enterprise Linux 7 host physical machine andhow to install and configure guest virtual machines using the KVM hypervisor. Other topicsinclude PCI device configuration, SR-IOV, networking, storage, device and guest virtual machinemanagement, as well as troubleshooting, compatibility and restrictions. To expand yourexpertise, you might also be interested in the Red Hat Enterprise Virtualization (RH318) trainingcourse.

  • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    Table of ContentsPart I. Deployment

    Chapt er 1 . Syst em requirement s1.1. Ho st system req uirements1.2. KVM hyp erviso r req uirements1.3. KVM g uest virtual machine co mp atib il i ty1.4. Sup p o rted g uest CPU mo d els

    Chapt er 2 . Inst alling t he virt ualizat ion packages2.1. Co nfig uring a virtualizatio n ho st d uring a new Red Hat Enterp rise Linux 7 installatio n2.2. Install ing virtualizatio n p ackag es o n an existing Red Hat Enterp rise Linux system2.3. Reg istering the hyp erviso r and virtual machine

    Chapt er 3. Inst alling a virt ual machine3.1. Guest virtual machine p rereq uis ites and co nsid eratio ns3.2. Creating g uests with virt-install3.3. Creating g uests with virt-manag er3.4. Co mp ariso n o f virt-install and virt-manag er installatio n o p tio ns

    Chapt er 4 . Virt ualiz ing Red Hat Ent erprise Linux on Ot her Plat forms4.1. On VMware ESX4.2. On Hyp er-V

    Chapt er 5. Inst alling a fully- virt ualized Windows guest5.1. Using virt-install to create a g uest5.2. Tip s fo r mo re effic iency with Wind o ws g uest virtual machines

    Chapt er 6 . KVM Para- virt ualized (virt io) Drivers6 .1. Install ing the KVM Wind o ws virtio d rivers6 .2. Install ing the d rivers o n an installed Wind o ws g uest virtual machine6 .3. Install ing d rivers d uring the Wind o ws installatio n6 .4. Using KVM virtio d rivers fo r existing d evices6 .5. Using KVM virtio d rivers fo r new d evices

    Chapt er 7 . Net work configurat ion7.1. Netwo rk Ad d ress Translatio n (NAT) with l ib virt7.2. Disab ling vho st-net7.3. Enab ling vho st-net zero -co p y7.4. Brid g ed netwo rking

    Chapt er 8 . Overcommit t ing wit h KVM8 .1. Intro d uctio n8 .2. Overco mmitting Memo ry8 .3. Overco mmitting virtualized CPUs (vCPUs)

    Chapt er 9 . KVM guest t iming management9 .1. Req uired p arameters fo r Red Hat Enterp rise Linux g uests9 .2. Steal time acco unting

    Chapt er 1 0 . Net work boot ing wit h libvirt10 .1. Prep aring the b o o t server10 .2. Bo o ting a g uest us ing PXE

    Chapt er 1 1 . Enhancing virt ualizat ion wit h t he QEMU guest agent and SPICE agent11.1. QEMU g uest ag ent

    6

    77899

    1 1111516

    2 222222636

    383838

    4 04041

    4 34445546 36 4

    6 96 9707171

    7 6767677

    7 98 08 2

    8 38 38 4

    8 68 6

    T able of Cont ent s

    1

  • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    11.2. Using the QEMU g uest ag ent with l ib virt11.3. SPICE ag ent

    Chapt er 1 2 . Nest ed Virt ualizat ion12.1. Overview12.2. Setup12.3. Restric tio ns and Limitatio ns

    Part II. Administ rat ion

    Chapt er 1 3. Securing t he host physical machine and improving performance13.1. Security Dep lo yment Plan13.2. Client access co ntro l

    Chapt er 1 4 . St orage pools14.1. Disk-b ased sto rag e p o o ls14.2. Partitio n-b ased sto rag e p o o ls14.3. Directo ry-b ased sto rag e p o o ls14.4. LVM-b ased sto rag e p o o ls14.5. iSCSI-b ased sto rag e p o o ls14.6 . NFS-b ased sto rag e p o o ls14.7. Using a NPIV virtual ad ap ter (vHBA) with SCSI d evices

    Chapt er 1 5. St orage Volumes15.1. Intro d uctio n15.2. Creating vo lumes15.3. Clo ning vo lumes15.4. Deleting and remo ving vo lumes15.5. Ad d ing sto rag e d evices to g uests

    Chapt er 1 6 . Using qemu- img16 .1. Checking the d isk imag e16 .2. Co mmitting chang es to an imag e16 .3. Co nverting an existing imag e to ano ther fo rmat16 .4. Creating and fo rmatting new imag es o r d evices16 .5. Disp laying imag e info rmatio n16 .6 . Re-b asing a b acking fi le o f an imag e16 .7. Re-s iz ing the d isk imag e16 .8 . Lis ting , creating , ap p lying , and d eleting a snap sho t16 .9 . Sup p o rted q emu-img fo rmats

    Chapt er 1 7 . KVM live migrat ion17.1. Live mig ratio n req uirements17.2. Live mig ratio n and Red Hat Enterp rise Linux vers io n co mp atib il i ty17.3. Shared sto rag e examp le: NFS fo r a s imp le mig ratio n17.4. Live KVM mig ratio n with virsh17.5. Mig rating with virt-manag er

    Chapt er 1 8 . Guest virt ual machine device configurat ion18 .1. PCI d evices18 .2. USB d evices18 .3. Co nfig uring d evice co ntro llers18 .4. Setting ad d resses fo r d evices18 .5. Rand o m numb er g enerato r d evice18 .6 . Assig ning GPU d evices

    9 39 5

    9 99 99 9

    10 1

    1 0 2

    1 0 310 310 4

    1 0 610 8111118124133146150

    1 56156157158159159

    1 7 0170170170171171171172172173

    1 7 417417617717818 3

    1 9 019 020 820 9213214217

    Virt ualizat ion Deployment and Administ rat ion Guide

    2

  • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    Chapt er 1 9 . SR- IOV19 .1. Ad vantag es o f SR-IOV19 .2. Using SR-IOV19 .3. Tro ub lesho o ting SR-IOV

    Chapt er 2 0 . Virt ual Net working20 .1. Virtual netwo rk switches20 .2. Brid g e Mo d e20 .3. Netwo rk Ad d ress Translatio n20 .4. DNS and DHCP20 .5. Ro uted mo d e20 .6 . Iso lated mo d e20 .7. The d efault co nfig uratio n20 .8 . Examp les o f co mmo n scenario s20 .9 . Manag ing a virtual netwo rk20 .10 . Creating a virtual netwo rk20 .11. Attaching a virtual netwo rk to a g uest20 .12. Directly attaching to p hysical interface20 .13. Dynamically chang ing a ho st p hysical machine o r a netwo rk b rid g e that is attached to a virtualNIC20 .14. Ap p lying netwo rk fi l tering20 .15. Creating Tunnels20 .16 . Setting vLAN tag s20 .17. Ap p lying Qo S to yo ur virtual netwo rk

    Chapt er 2 1 . Remot e management of guest s21.1. Remo te manag ement with SSH21.2. Remo te manag ement o ver TLS and SSL21.3. Transp o rt mo d es21.4. Co nfig uring a VNC Server

    Chapt er 2 2 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager)22.1. Starting virt-manag er22.2. The Virtual Machine Manag er main wind o w22.3. The virtual hard ware d etails wind o w22.4. Virtual Machine g rap hical co nso le22.5. Ad d ing a remo te co nnectio n22.6 . Disp laying g uest d etails22.7. Perfo rmance mo nito ring22.8 . Disp laying CPU usag e fo r g uests22.9 . Disp laying CPU usag e fo r ho sts22.10 . Disp laying Disk I/O22.11. Disp laying Netwo rk I/O

    Chapt er 2 3. Managing guest virt ual machines wit h virsh23.1. Guest virtual machine states23.2. Running the virsh p ro g ram23.3. Interactive mo d e co mmand s23.4. Disp laying the virsh vers io n23.5. Getting help23.6 . Send ing co mmand s with echo23.7. Co nnecting to the hyp erviso r with virsh co nnect23.8 . Disp laying info rmatio n ab o ut g uest virtual machine23.9 . Guest virtual machine b asic co mmand s23.10 . Shutting d o wn, reb o o ting , and fo rc ing a shutd o wn o f a g uest virtual machine

    2 2 1222222228

    2 2 9229230231232232233234235238239246250

    25225328 028 128 2

    2 8 328 328 628 829 2

    2 9 329 329 429 530 230 330 5312314316318321

    32 5325325326326327328328328329333

    T able of Cont ent s

    3

  • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    23.10 . Shutting d o wn, reb o o ting , and fo rc ing a shutd o wn o f a g uest virtual machine23.11. Ed iting a g uest virtual machine's co nfig uratio n fi le23.12. NUMA no d e manag ement23.13. Retrieving g uest virtual machine info rmatio n23.14. Sto rag e p o o l co mmand s23.15. Sto rag e Vo lume Co mmand s23.16 . Disp laying p er-g uest virtual machine info rmatio n23.17. Manag ing virtual netwo rks23.18 . Interface Co mmand s23.19 . Manag ing snap sho ts23.20 . Guest virtual machine CPU mo d el co nfig uratio n23.21. Co nfig uring the g uest virtual machine CPU mo d el23.22. Manag ing reso urces fo r g uest virtual machines23.23. Setting sched ule p arameters23.24. Disk I/O thro ttl ing23.25. Disp lay o r set b lo ck I/O p arameters23.26 . Co nfig uring memo ry Tuning

    Chapt er 2 4 . Guest virt ual machine disk access wit h offline t ools24.1. Intro d uctio n24.2. Termino lo g y24.3. Installatio n24.4. The g uestfish shell24.5. O ther co mmand s24.6 . virt-rescue: The rescue shell24.7. virt-d f: Mo nito ring d isk usag e24.8 . virt-res ize: res iz ing g uest virtual machines o ffl ine24.9 . virt-insp ecto r: insp ecting g uest virtual machines24.10 . virt-win-reg : Read ing and ed iting the Wind o ws Reg istry24.11. Using the API fro m Pro g ramming Lang uag es24.12. virt-sysp rep : resetting virtual machine setting s

    Chapt er 2 5. Graphic User Int erface t ools for guest virt ual machine management25.1. Using virt-viewer co mmand line25.2. remo te-viewer25.3. GNOME Bo xes

    Chapt er 2 6 . Manipulat ing t he domain XML26 .1. General info rmatio n and meta-d ata26 .2. Op erating system b o o ting26 .3. SMBIOS system info rmatio n26 .4. CPU allo catio n26 .5. CPU tuning26 .6 . Memo ry b acking26 .7. Memo ry tuning26 .8 . Memo ry allo catio n26 .9 . NUMA no d e tuning26 .10 . Blo ck I/O tuning26 .11. Reso urce p artitio ning26 .12. CPU mo d els and to p o lo g y26 .13. Events co nfig uratio n26 .14. Po wer Manag ement26 .15. Hyp erviso r features26 .16 . Time keep ing26 .17. Timer element attrib utes

    33335235636 136 236 436 737237737938 538 838 939 039 139 139 1

    39 339 339 439 539 540 140 140 240 440 540 740 9414

    4 1 7417418419

    4 2 5425426430430431433433434435436437437443445446447450

    Virt ualizat ion Deployment and Administ rat ion Guide

    4

  • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    26 .17. Timer element attrib utes26 .18 . Devices26 .19 . Sto rag e p o o ls26 .20 . Sto rag e Vo lumes26 .21. Security lab el26 .22. A Samp le co nfig uratio n fi le

    Part III. Appendices

    Appendix A. T roubleshoot ingA.1. Deb ug g ing and tro ub lesho o ting to o lsA.2. Prep aring fo r d isaster reco veryA.3. Creating virsh d ump fi lesA.4. Cap turing trace d ata o n a co nstant b asis using the Systemtap fl ig ht reco rd erA.5. kvm_statA.6 . Tro ub lesho o ting with serial co nso lesA.7. Virtualizatio n lo g fi lesA.8 . Lo o p d evice erro rsA.9 . Live Mig ratio n Erro rsA.10 . Enab ling Intel VT-x and AMD-V virtualizatio n hard ware extensio ns in BIOSA.11. Generating a new uniq ue MAC ad d ressA.12. KVM netwo rking p erfo rmanceA.13. Wo rkaro und fo r creating external snap sho ts with l ib virtA.14. Miss ing characters o n g uest co nso le with Jap anese keyb o ardA.15. Guest virtual machine fails to shutd o wnA.16 . Disab le SMART d isk mo nito ring fo r g uest virtual machinesA.17. l ib g uestfs tro ub lesho o tingA.18 . Co mmo n lib virt erro rs and tro ub lesho o ting

    Appendix B. Virt ualizat ion rest rict ionsB.1. KVM restric tio nsB.2. Ap p licatio n restric tio nsB.3. O ther restric tio nsB.4. Sto rag e sup p o rtB.5. USB 3 / xHCI Sup p o rt

    Appendix C. Addit ional resourcesC.1. Online reso urcesC.2. Installed d o cumentatio n

    Appendix D. Working wit h IOMMU Groups [1 ]D.1. IOMMU OverviewD.2. A d eep -d ive into IOMMU g ro up sD.3. Ho w to id entify and assig n IOMMU Gro up sD.4. IOMMU strateg ies and case uses

    Appendix E. Net KVM Driver Paramet ersE.1. Co nfig urab le p arameters fo r NetKVM

    Appendix F. Revision Hist ory

    45045150 250 8512514

    51 5

    51 6516517518519521526527527527528529530531531532533533533

    56 256 256 556 556 556 6

    56 756 756 7

    56 856 856 9570572

    57 4574

    57 8

    T able of Cont ent s

    5

  • Part I. Deployment

    Virt ualizat ion Deployment and Administ rat ion Guide

    6

  • Chapter 1. System requirementsVirtualization is available with the KVM hypervisor for Red Hat Enterprise Linux 7 on the Intel 64 andAMD64 architectures. This chapter lists system requirements for running virtual machines, alsoreferred to as VMs.

    For information on installing the virtualization packages, see Chapter 2, Installing the virtualizationpackages.

    1.1. Host system requirements

    Minimum host system requirements

    6 GB free disk space.

    2 GB RAM.

    Recommended system requirements

    One core or thread for each virtualized CPU and one for the host.

    2 GB of RAM, plus additional RAM for virtual machines.

    6 GB disk space for the host, plus the required disk space for the virtual machine(s).

    Most guest operating systems require at least 6 GB of disk space. Additional storage space foreach guest depends on their workload.

    Swap space

    Swap space in Linux is used when the amount of physical memory (RAM) is full. If the systemneeds more memory resources and the RAM is full, inactive pages in memory are moved to theswap space. While swap space can help machines with a small amount of RAM, it should not beconsidered a replacement for more RAM. Swap space is located on hard drives, which have aslower access time than physical memory. The size of your swap partition can be calculated fromthe physical RAM of the host. The Red Hat Customer Portal contains an article on safely andefficiently determining the size of the swap partition:https://access.redhat.com/site/solutions/15244.

    When using raw image files, the total disk space required is equal to or greater than the sum ofthe space required by the image files, the 6 GB of space required by the host operating system,and the swap space for the guest.

    Equat ion 1.1. Calculat ing required space for guest virtual machines using rawimages

    total for raw format = images + hostspace + swap

    For qcow images, you must also calculate the expected maximum storage requirements of theguest (total for qcow format), as qcow and qcow2 images are able to grow asrequired. To allow for this expansion, first multiply the expected maximum storage

    Chapt er 1 . Syst em requirement s

    7

  • requirements of the guest (expected maximum guest storage) by 1.01, and add to thisthe space required by the host (host), and the necessary swap space (swap).

    Equat ion 1.2. Calculat ing required space for guest virtual machines usingqcow images

    total for qcow format = (expected maximum guest storage * 1.01) + host + swap

    Guest virtual machine requirements are further outlined in Chapter 8, Overcommitting with KVM.

    1.2. KVM hypervisor requirementsThe KVM hypervisor requires:

    an Intel processor with the Intel VT-x and Intel 64 virtualization extensions for x86-based systems;or

    an AMD processor with the AMD-V and the AMD64 virtualization extensions.

    Virtualization extensions (Intel VT-x or AMD-V) are required for full virtualization. Run the followingcommands to determine whether your system has the hardware virtualization extensions, and thatthey are enabled.

    Procedure 1.1. Verifying virtualiz at ion extensions

    1. Verify the CPU virtualiz at ion extensions are availab le

    Run the following command to verify the CPU virtualization extensions are available:

    $ grep -E 'svm|vmx' /proc/cpuinfo

    2. Analyz e the output

    The following example output contains a vmx entry, indicating an Intel processor with theIntel VT-x extension:

    flags : fpu tsc msr pae mce cx8 vmx apic mtrr mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cplvmx est tm2 cx16 xtpr lahf_lm

    The following example output contains an svm entry, indicating an AMD processor withthe AMD-V extensions:

    flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflushmmx fxsr sse sse2 ht syscall nx mmxext svm fxsr_opt lm 3dnowext 3dnow pni cx16lahf_lm cmp_legacy svm cr8legacy ts fid vid ttp tm stc

    If the grep -E 'svm|vmx' /proc/cpuinfo command returns any output, the processorcontains the hardware virtualization extensions. In some circumstances, manufacturers

    Virt ualizat ion Deployment and Administ rat ion Guide

    8

  • disable the virtualization extensions in the BIOS. If the extensions do not appear, or fullvirtualization does not work, see Procedure A.4, Enabling virtualization extensions in BIOSfor instructions on enabling the extensions in your BIOS configuration utility.

    3. Ensure the KVM kernel modules are loaded

    As an additional check, verify that the kvm modules are loaded in the kernel with the followingcommand:

    # lsmod | grep kvm

    If the output includes kvm_intel or kvm_amd , the kvm hardware virtualization modules areloaded.

    NoteThe virsh utility (provided by the libvirt-client package) can output a full list of your system'svirtualization capabilities with the following command:

    # virsh capabilities

    1.3. KVM guest virtual machine compat ibilit yRed Hat Enterprise Linux 7 servers have certain support limits.

    The following URLs explain the processor and memory amount limitations for Red Hat EnterpriseLinux:

    For host systems: https://access.redhat.com/articles/rhel-limits

    For the KVM hypervisor: https://access.redhat.com/articles/rhel-kvm-limits

    The following URL lists guest operating systems certified to run on a Red Hat Enterprise Linux KVMhost:

    https://access.redhat.com/articles/973133

    NoteFor additional information on the KVM hypervisor's restrictions and support limits, seeAppendix B, Virtualization restrictions.

    1.4 . Supported guest CPU modelsEvery hypervisor has its own policy for which CPU features the guest will see by default. The set ofCPU features presented to the guest by the hypervisor depends on the CPU model chosen in theguest virtual machine configuration.

    Chapt er 1 . Syst em requirement s

    9

  • 1.4 .1. List ing the guest CPU modelsTo view a full list of the CPU models supported for an architecture type, run the virsh cpu-models command. For example:

    $ virsh cpu-models x86_64486pentiumpentium2pentium3pentiumprocoreduon270core2duoqemu32kvm32cpu64-rhel5cpu64-rhel6kvm64qemu64ConroePenrynNehalemWestmereSandyBridgeHaswellathlonphenomOpteron_G1Opteron_G2Opteron_G3Opteron_G4Opteron_G5

    $ virsh cpu-models ppc64POWER7POWER7_v2.1POWER7_v2.3POWER7+_v2.1POWER8_v1.0

    The full list of supported CPU models and features is contained in the cpu_map.xml file, located in /usr/share/libvirt/:

    # cat /usr/share/libvirt/cpu_map.xml

    A guest's CPU model and features can be changed in the section of the domain XML file. SeeSection 26.12, CPU models and topology for more information.

    The host model can be configured to use a specified feature set as needed. For more information, seeSection 26.12.1, Changing the feature set for a specified CPU .

    Virt ualizat ion Deployment and Administ rat ion Guide

    10

  • Chapter 2. Installing the virtualization packagesTo use virtualization, the virtualization packages must be installed on your computer. Virtualizationpackages can be installed either during the host installation sequence or after host installation usingthe yum command and Subscription Manager.

    The KVM hypervisor uses the default Red Hat Enterprise Linux kernel with the kvm kernel module.

    2.1. Configuring a virtualizat ion host during a new Red Hat EnterpriseLinux 7 installat ionThis section covers installing virtualization tools and virtualization packages as part of a fresh RedHat Enterprise Linux installation.

    NoteThe Red Hat Enterprise Linux 7 Installation Guide covers installing Red Hat Enterprise Linux indetail.

    Procedure 2.1. Installing the virtualiz at ion package group

    1. Launch the Red Hat Enterprise Linux 7 installat ion program

    Start an interactive Red Hat Enterprise Linux 7 installation from the Red Hat Enterprise LinuxInstallation CD-ROM, DVD or PXE.

    2. Cont inue installat ion up to sof tware select ion

    Complete the other steps up to the software selection step. The Installation Summaryscreen prompts the user to complete any steps still requiring attention.

    Chapt er 2 . Inst alling t he virt ualizat ion packages

    11

  • Figure 2.1. The Installat ion Summary screen

    Software Selection defaults to Minimal Install. Open the Software Selection screento select the virtualization packages instead.

    3. Select the server type and package groups

    Red Hat Enterprise Linux 7 has two available options for installing a virtualization host: aminimal virtualization host with only the basic packages installed (Step 3.a), or avirtualization host with packages installed to allow management of guests through agraphical user interface (Step 3.b).

    a.

    Select ing a min imal virtualiz at ion host

    Select the Virtualization Host radio button under Base Environment, andthe Virtualization Platform checkbox under Add-Ons for Selected Environment. This installs a basic virtualization environment which can be run with virsh, or remotely over the network.

    Virt ualizat ion Deployment and Administ rat ion Guide

    12

  • Figure 2.2. Virtualiz at ion Host selected in the sof tware select ion screen

    b.

    Select ing a virtualiz at ion host with a graphical user in terface

    Select the Server with GUI radio button under Base Environment, and thecheckboxes for Virtualization Client, Virtualization Hypervisor, and Virtualization Tools under Add-Ons for Selected Environment. Thisinstalls a virtualization environment along with graphical tools for installing andmanaging guest virtual machines.

    Chapt er 2 . Inst alling t he virt ualizat ion packages

    13

  • Figure 2.3. Server with GUI selected in the sof tware select ion screen

    4. Finaliz e installat ion

    On the Installation Summary screen, complete the steps as necessary and click Begin Installation.

    When the installation is complete, reboot the system.

    ImportantYou require a valid virtualization entitlement to receive updates for the virtualization packages.

    2.1.1. Installing KVM packages with Kickstart filesKickstart files allow for large, automated installations without a user manually installing eachindividual host system.

    To use a Kickstart file to install Red Hat Enterprise Linux with the virtualization packages, append thefollowing package groups in the %packages section of your Kickstart file:

    @virtualization-hypervisor@virtualization-client@virtualization-platform@virtualization-tools

    For more information about installing with Kickstart files, see the Red Hat Enterprise Linux 7Installation Guide.

    Virt ualizat ion Deployment and Administ rat ion Guide

    14

  • 2.2. Installing virtualizat ion packages on an exist ing Red HatEnterprise Linux systemThis section describes the steps for installing the KVM hypervisor on an existing Red Hat EnterpriseLinux 7 system.

    To install the packages, your machine must be registered and subscribed to the Red Hat CustomerPortal. To register via Red Hat Subscription Manager, run the subscription-manager registercommand and follow the prompts. Alternatively, run the Red Hat Subscription Manager applicationfrom Applicat ions System Tools on the desktop to register.

    If you do not have a valid Red Hat subscription, visit the Red Hat online store to obtain one. For moreinformation on registering and subscribing a system to the Red Hat Customer Portal, seehttps://access.redhat.com/solutions/253273.

    2.2.1. Installing the virtualizat ion packages with yumTo use virtualization on Red Hat Enterprise Linux, you require at minimum the qemu-kvm, qemu-img,and libvirt packages. These packages provide the user-level KVM emulator, disk image manager, andvirtualization management tools on the host Red Hat Enterprise Linux system.

    The libvirt package provides the server and host-side libraries for interacting with hypervisors andhost systems, and the libvirtd daemon that handles the library calls, manages virtual machinesand controls the hypervisor.

    To install these packages, run the following command:

    # yum install qemu-kvm qemu-img libvirt

    Several additional virtualization management packages are also available and are recommendedwhen using virtualization:

    Recommended virtualiz at ion packages

    virt-installThis package provides the virt-install command for creating virtual machines from thecommand line.

    libvirt-pythonThe libvirt-python package contains a module that permits applications written in the Pythonprogramming language to use the interface supplied by the libvirt API.

    virt-managervirt-manager, also known as Virtual Machine Manager, provides a graphical tool foradministering virtual machines. It uses the libvirt-client library as the management API.

    libvirt-clientThe libvirt-client package provides the client-side APIs and libraries for accessing libvirtservers. The libvirt-client package includes the virsh command line tool to manage andcontrol virtual machines and hypervisors from the command line or a special virtualizationshell.

    Chapt er 2 . Inst alling t he virt ualizat ion packages

    15

  • Install all of these recommended virtualization packages with the following command:

    # yum install virt-install libvirt-python virt-manager python-virtinst libvirt-client

    2.2.2. Installing virtualizat ion package groupsThe virtualization packages can also be installed from package groups. The following tabledescribes the virtualization package groups and what they provide.

    NoteNote that the qemu-img package is installed as a dependency of the Virtualizationpackage group if it is not already installed on the system. It can also be installed manuallywith the yum install qemu-img command as described previously.

    Table 2.1. Virtualiz at ion Package Groups

    Package Group Descript ion MandatoryPackages

    Opt ional Packages

    Virtualization Hypervisor

    Smallest possiblevirtualization hostinstallation

    libvirt, qemu-kvm qemu-kvm-tools

    Virtualization Client

    Clients for installingand managingvirtualizationinstances

    gnome-boxes, virt-install, virt-manager,virt-viewer

    virt-top, libguestfs-tools, libguestfs-tools-c

    Virtualization Platform

    Provides an interfacefor accessing andcontrolling virtualmachines andcontainers

    libvirt, libvirt-client, virt-who

    fence-virtd-libvirt,fence-virtd-multicast,fence-virtd-serial,libvirt-cim, libvirt-java,libvirt-snmp, perl-Sys-Virt

    Virtualization Tools

    Tools for offline virtualimage management

    libguestfs libguestfs-java,libguestfs-tools,libguestfs-tools-c

    To install a package group, run the yum groupinstall command. Forinstance, to install the Virtualization Tools package group, run:

    # yum groupinstall "Virtualization Tools"

    2.3. Registering the hypervisor and virtual machineRed Hat Enterprise Linux 6 and 7 require that every guest virtual machine is mapped to a specifichypervisor in order to ensure that every guest is allocated the same level of subscription service. Todo this you need to install a subscription agent that automatically detects all guest Virtual Machines(VMs) on each KVM hypervisor that is installed and registered, which in turn will create a mapping filethat sits on the host. This mapping file ensures that all guest VMs receive the following benefits:

    Subscriptions specific to virtual systems are readily available and can be applied to all of the

    Virt ualizat ion Deployment and Administ rat ion Guide

    16

  • associated guest VMs

    All subscription benefits that can be inherited from the hypervisor are readily available and canbe applied to all of the associated guest VMs.

    NoteThe information provided in this chapter is specific to Red Hat Enterprise Linux subscriptionsonly. If you also have a Red Hat Enterprise Virtualization subscription, or a Red Hat Satellitesubscription, you should also consult the virt-who information provided with thosesubscriptions.

    2.3.1. Installing virt -who on the host physical machine

    1. Register the KVM hypervisor

    Register the KVM Hypervisor by running the subscription-manager register [options] command in a terminal as the root user on the host physical machine. Moreoptions are available using the # subscription-manager register --help menu. Incases where you are using a username and password, use the credentials that are known tothe subscription manager. If this is your very first time subscribing and you do not have auser account, contact customer support. For example to register the VM as 'admin' with'secret' as a password, you would send the following command:

    [root@rhel-server ~]# subscription-manager register --username=admin --password=secret --auto-attach --type=hypervisor

    2. Install the virt -who packages

    Install the virt-who packages, by running the following command in a terminal as root on thehost physical machine:

    [root@rhel-server ~]# yum install virt-who

    3. Create a virt -who conf igurat ion f ile

    Add a configuration file in the /etc/virt-who.d/ directory. It does not matter what thename of the file is, but you should give it a name that makes sense and the file must belocated in the /etc/virt-who.d/ directory. Inside that file add the following snippet andremember to save the file before closing it.

    [libvirt]type=libvirt

    4. Start the virt -who service

    Start the virt-who service by running the following command in a terminal as root on the hostphysical machine:

    [root@virt-who ~]# systemctl start virt-who.service[root@virt-who ~]# systemctl enable virt-who.service

    Chapt er 2 . Inst alling t he virt ualizat ion packages

    17

  • 5. Conf irm virt -who service is receiving guest in format ion

    At this point, the virt-who service will start collecting a list of domains from the host. Check the /var/log/rhsm/rhsm.log file on the host physical machine to confirm that the the filecontains a list of the guest VMs. For example:

    2015-05-28 12:33:31,424 DEBUG: Libvirt domains found: [{'guestId': '58d59128-cfbb-4f2c-93de-230307db2ce0', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5}]

    Procedure 2.2. Managing the subscript ion on the customer portal

    1. Subscrib ing the hypervisor

    As the virtual machines will be receiving the same subscription benefits as the hypervisor, it isimportant that the hypervisor has a valid subscription and that the subscription is availablefor the VMs to use.

    a. Login to the customer portal

    Login to the Red Hat customer portal https://access.redhat.com/ and click the Subscriptions button at the top of the page.

    b. Click the Systems link

    In the Subscriber Inventory section (towards the bottom of the page), click Systems link.

    c. Select the hypervisor

    On the Systems page, there is a table of all subscribed systems. Click on the name ofthe hypervisor (localhost.localdomain for example). In the details page that opens,click Attach a subscription and select all the subscriptions listed. Click Attach Selected . This will attach the host's physical subscription to the hypervisor so thatthe guests can benefit from the subscription.

    2. Subscrib ing the guest virtual machines - f irst t ime use

    This step is for those who have a new subscription and have never subscribed a guest virtualmachine before. If you are adding virtual machines, skip this step. To consume thesubscription assigned to the hypervisor profile on the machine running the virt-who service,auto subscribe by running the following command in a terminal, on the guest virtual machineas root.

    [root@virt-who ~]# subscription-manager attach --auto

    3. Subscrib ing addit ional guest virtual machines

    If you just subscribed a for the first time, skip this step. If you are adding additional virtualmachines, it should be noted that running this command will not necessarily re-attach thesame pools to the hypervisor. This is because removing all subscriptions then allowing autoattach to resolve what is necessary for a given guest virtual machine may result in differentsubscriptions consumed than before. This may not have any effect on your system, but it issomething you should be aware about. If you used a manual attachment procedure to attachthe virtual machine, which is not described below, you will need to re-attach those virtualmachines manually as the auto-attach will not work. Use the following command as root in a

    Virt ualizat ion Deployment and Administ rat ion Guide

    18

  • terminal to first remove the subscriptions for the old guests and then use the auto-attach toattach subscriptions to all the guests. Run these commands on the guest virtual machine.

    [root@virt-who ~]# subscription-manager remove --all[root@virt-who ~]# subscription-manager attach --auto

    4. Conf irm subscript ions are at tached

    Confirm that the subscription is attached to the hypervisor by running the following commandas root in a terminal on the guest virtual machine:

    [root@virt-who ~]# subscription-manager list --consumed

    Output similar to the following will be displayed. Pay attention to the Subscription Details. Itshould say 'Subscription is current'.

    [root@virt-who ~]# subscription-manager list --consumed+-------------------------------------------+ Consumed Subscriptions+-------------------------------------------+Subscription Name: Awesome OS with unlimited virtual guestsProvides: Awesome OS Server BitsSKU: awesomeos-virt-unlimitedContract: 0Account: 12331131231Serial: 7171985151317840309 Pool ID: 2c91808451873d3501518742f556143d Provides Management: No Active: True Quantity Used: 1 Service Level: Service Type:Status Details: Subscription is current Subscription Type: Starts: 01/01/2015 Ends: 12/31/2015 System Type: Virtual

    Indicates if your subscription is current. If your subscription is not current, an errormessage appears. One example is Guest has not been reported on any host and isusing a temporary unmapped guest subscription. In this case the guest needs to besubscribed. In other cases, use the information as indicated in Section 2.3.4.2, I havesubscription status errors, what do I do? .

    5. Register addit ional guests

    When you install new guest VMs on the hypervisor, you must register the new VM and use thesubscription attached to the hypervisor, by running the following commands in a terminal asroot on the guest virtual machine:

    [root@server1 ~]# subscription-manager register[root@server1 ~]# subscription-manager attach --auto[root@server1 ~]# subscription-manager list --consumed

    Chapt er 2 . Inst alling t he virt ualizat ion packages

    19

  • 2.3.2. Registering a new guest virtual machineIn cases where a new guest virtual machine is to be created on a host that is already registered andrunning, the virt-who service must also be running. This ensures that the virt-who service maps theguest to a hypervisor, so the system is properly registered as a virtual system. To register the virtualmachine, run the following command as root in a terminal:

    [root@virt-server ~]# subscription-manager register --username=admin --password=secret --auto-attach

    2.3.3. Removing a guest virtual machine ent ryIf the guest virtual machine is running, unregister the system, by running the following command in aterminal window as root:

    [root@virt-guest ~]# subscription-manager unregister

    If the system has been deleted, however, the virtual service cannot tell whether the service is deletedor paused. In that case, you must manually remove the system from the server side, using thefollowing steps:

    1. Login to the Subscript ion Manager

    The Subscription Manager is located on the Red Hat Customer Portal. Login to the CustomerPortal using your username and password, by clicking the login icon at the top of the screen.

    2. Click the Subscript ions tab

    Click the Subscriptions tab.

    3. Click the Systems link

    Scroll down the page and click the Systems link.

    4. Delete the system

    To delete the system profile, locate the specified system's profile in the table, select the checkbox beside its name and click Delete.

    2.3.4 . T roubleshoot ing virt -who

    2.3.4 .1 . Why is t he hyperviso r st at us red?Scenario: On the server side, you deploy a guest on a hypervisor that does not have a subscription.24 hours later, the hypervisor displays its status as red. To remedy this situation you must get asubscription for that hypervisor. Or, permanently migrate the guest to a hypervisor with asubscription.

    2.3.4 .2 . I have subscript io n st at us erro rs, what do I do ?Scenario: Any of the following error messages display:

    System not properly subscribed

    Status unknown

    Virt ualizat ion Deployment and Administ rat ion Guide

    20

  • Late binding of a guest to a hypervisor through virt-who (host/guest mapping)

    To find the reason for the error open the virt-who log file, named rhsm.log , located in the /var/log/rhsm/ directory.

    Chapt er 2 . Inst alling t he virt ualizat ion packages

    21

  • Chapter 3. Installing a virtual machineAfter you have installed the virtualization packages on your Red Hat Enterprise Linux 7 host system,you can create guest operating systems. You can create guest virtual machines using the New buttonin virt -manager or use the virt-install command line interface to install virtual machines by alist of parameters or with a script. Both methods are covered by this chapter.

    Detailed installation instructions are available in the following chapters for specific versions of RedHat Enterprise Linux and Microsoft Windows.

    3.1. Guest virtual machine prerequisit es and considerat ionsVarious factors should be considered before creating any guest virtual machines. Not only shouldthe role of a virtual machine be considered before deployment, but regular ongoing monitoring andassessment based on variable factors (load, amount of clients) should be performed. Some factorsinclude:

    PerformanceGuest virtual machines should be deployed and configured based on their intended tasks.Some guest systems (for instance, guests running a database server) may require specialperformance considerations. Guests may require more assigned CPUs or memory based ontheir role and projected system load.

    Input /Output requirements and types of Input /OutputSome guest virtual machines may have a particularly high I/O requirement or may requirefurther considerations or projections based on the type of I/O (for instance, typical diskblock size access, or the amount of clients).

    StorageSome guest virtual machines may require higher priority access to storage or faster disktypes, or may require exclusive access to areas of storage. The amount of storage used byguests should also be regularly monitored and taken into account when deploying andmaintaining storage. Make sure to read all the considerations outlined in Chapter 13,Securing the host physical machine and improving performance. It is also important tounderstand that your physical storage may limit your options in your virtual storage.

    Networking and network in f rast ructureDepending upon your environment, some guest virtual machines could require fasternetwork links than other guests. Bandwidth or latency are often factors when deploying andmaintaining guests, especially as requirements or load changes.

    Request requirementsSCSI requests can only be issued to guest virtual machines on virtio drives if the virtiodrives are backed by whole disks, and the disk device parameter is set to lun, as shown inthe following example:

    /usr/libexec/qemu-kvm

    3.2. Creat ing guests with virt -install

    Virt ualizat ion Deployment and Administ rat ion Guide

    22

  • 3.2. Creat ing guests with virt -installYou can use the virt-install command to create virtual machines from the command line. virt-install is used either interactively (with a graphical application such as virt -viewer) or as part ofa script to automate the creation of virtual machines. Using virt-install with kickstart files allowsfor unattended installation of virtual machines.

    Note that you need root privileges in order for virt-install commands to complete successfully.

    The virt-install tool provides a number of options that can be passed on the command line.Most virt-install options are not required. Minimum requirements are --name, --ram, gueststorage (--disk, --filesystem or --nodisks), and an install option. To see a complete list ofoptions, run the following command:

    # virt-install --help

    The virt-install man page also documents each command option, important variables, andexamples.

    Prior to running virt-install , qemu-img is a related command which can be used to configurestorage options. See refer to Chapter 16, Using qemu-img for instructions on using qemu-img .

    3.2.1. Network installat ion with virt -installThe following examples use a network bridge (named br0 in these examples), which must be createdseparately, prior to running virt-install. See Section 7.4.1, Configuring bridged networking on a RedHat Enterprise Linux 7 host for details on creating a network bridge.

    Example 3.1. Using virt - install to install a Red Hat Enterprise Linux 6 virtual machine

    This example creates a Red Hat Enterprise Linux 6 guest:

    # virt-install \ --name=guest1-rhel6-64 \ --disk path=/var/lib/libvirt/images/guest1-rhel6-64.dsk,size=8,sparse=false,cache=none \ --graphics spice \ --vcpus=2 --ram=2048 \ --location=http://example1.com/installation_tree/RHEL6.4-Server-x86_64/os \ --network bridge=br0 \ --os-type=linux \ --os-variant=rhel6

    The options used in this example are as follows:

    --name

    The name of the virtual machine.

    --disk

    Specifies storage configuration details for the virtual machine.

    --graphics

    An important option which allows graphical installation of a virtual machine. It specifies the

    Chapt er 3. Inst alling a virt ual machine

    23

  • An important option which allows graphical installation of a virtual machine. It specifies thetype of graphical tool to use for interactive installation, or can be set to none for a fullyautomated installation by script.

    --vcpus

    The number of vCPUs to allocate to the guest.

    --ram

    The amount of memory (RAM) to allocate to the guest, in MiB.

    --location

    The location of the installation media. The above example uses an http:// networkinstallation, but several other protocols can be used.

    --network bridge

    Specifies the network bridge to use for installation, which must be configured beforerunning virt-install . See Section 7.4.1, Configuring bridged networking on a Red HatEnterprise Linux 7 host for details on creating a network bridge.

    --os-type

    The guest operating system type.

    --os-variant

    Another important option in virt-install, used to further optimize the guest configuration.Using this option can reduce installation time and improve performance.

    Running the osinfo-query os command returns a complete list of operating systemvariants identified by a short ID to use with the --os-variant option. For example, --os-variant=rhel7.0 configures a Red Hat Enterprise Linux 7.0 virtual machine.

    In Red Hat Enterprise Linux 7, the virtio-scsi controller is available for use in guests. If both the hostand guest support virtio-scsi, you can use it as follows:

    Example 3.2. Using virt - install to install a guest virtual machine with the virt io -scsicontro ller

    The items in bold are required on top of a standard installation in order to use the virtio-scsicontroller.

    # virt-install \ --name=guest1-rhel7 \ --controller type=scsi,model=virtio-scsi \ --disk path=/var/lib/libvirt/images/guest1-rhel7.dsk,size=8,sparse=false,cache=none,bus=scsi \ --graphics spice \ --vcpus=2 --ram=2048 \ --location=http://example1.com/installation_tree/RHEL7.1-Server-x86_64/os \ --network bridge=br0 \ --os-type=linux \ --os-variant=rhel7

    Virt ualizat ion Deployment and Administ rat ion Guide

    24

  • NoteEnsure that you select the correct --os-type for your operating system when running thiscommand. This option prevents the installation disk from disconnecting when rebootingduring the installation procedure. The --os-variant option further optimizes theconfiguration for a specific guest operating system.

    3.2.2. PXE installat ion with virt -installvirt-install PXE installations require both the --network=bridge:bridge_name parameter,where bridge_name is the name of the bridge, and the --pxe parameter.

    By default, if no network is found, the guest virtual machine will attempt to boot from alternativebootable devices. If there is no other bootable device found, the guest virtual machine will pause.You can use the qemu-kvm boot parameter reboot-timeout to allow the guest to retry booting ifno bootable device is found, like so:

    # qemu-kvm -boot reboot-timeout=1000

    Example 3.3. Fully-virtualiz ed PXE installat ion with virt - install

    # virt-install --hvm --connect qemu:///system \--network=bridge:br0 --pxe --graphics spice \--name=rhel6-machine --ram=756 --vcpus=4 \--os-type=linux --os-variant=rhel6 \--disk path=/var/lib/libvirt/images/rhel6-machine.img,size=10

    Note that the command above cannot be executed in a text-only environment. A fully-virtualized (--hvm) guest can only be installed in a text-only environment if the --location and --extra-args "console=console_type" are provided instead of the --graphics spice parameter.

    3.2.3. Kickstart installat ion with virt -installThe following example shows using a kickstart file with virt-install:

    Example 3.4 . Kickstart installat ion with virt - install

    # virt-install -n rhel7ks-guest -r 1024 --file=/var/lib/libvirt/images/rhel7ks-guest.img --file-size=10 \ --location /var/lib/libvirt/images/rhel-server-7.1-x86_64-dvd.iso --nographics \ --extra-args="ks=http://192.168.122.1/ks.cfg ip=dhcp \console=tty0 console=ttyS0,115200n8 --os-variant=rhel7.0

    3.2.4 . Guest installat ion with virt -install and text -based AnacondaThe following example shows using virt-install with text-based Anaconda installation:

    Chapt er 3. Inst alling a virt ual machine

    25

  • Example 3.5. Guest installat ion with virt - install and text -based Anaconda

    # virt-install -n rhel6anaconda-guest -r 1024 --disk=path=/path/to/rhel6anaconda-guest.img,size=10 \--location /mnt/RHEL6DVD --nographics \--extra-args=console=tty0 console=ttyS0,115200n8 \--disk=path=/path/to/rhel6-dvd.iso,device=cdrom

    3.3. Creat ing guests with virt -managervirt-manager, also known as Virtual Machine Manager, is a graphical tool for creating andmanaging guest virtual machines.

    This section covers how to install a Red Hat Enterprise Linux 7 guest virtual machine on a Red HatEnterprise Linux 7 host using virt -manager.

    These procedures assume that the KVM hypervisor and all other required packages are installed andthe host is configured for virtualization. For more information on installing the virtualizationpackages, refer to Chapter 2, Installing the virtualization packages.

    3.3.1. virt -manager installat ion overviewThe New VM wizard breaks down the virtual machine creation process into five steps:

    1. Choosing the hypervisor and installation type

    2. Locating and configuring the installation media

    3. Configuring memory and CPU options

    4. Configuring the virtual machine's storage

    5. Configuring virtual machine name, networking, architecture, and other hardware settings

    Ensure that virt-manager can access the installation media (whether locally or over the network)before you continue.

    3.3.2. Creat ing a Red Hat Enterprise Linux 7 guest with virt -managerThis procedure covers creating a Red Hat Enterprise Linux 7 guest virtual machine with a locallystored installation DVD or DVD image. Red Hat Enterprise Linux 7 DVD images are available from theRed Hat Customer Portal.

    Procedure 3.1. Creat ing a Red Hat Enterprise Linux 7 guest virtual machine with virt -manager using local installat ion media

    1. Opt ional: Preparat ion

    Prepare the storage environment for the virtual machine. For more information on preparingstorage, refer to Chapter 14, Storage pools.

    Virt ualizat ion Deployment and Administ rat ion Guide

    26

  • ImportantVarious storage types may be used for storing guest virtual machines. However, for avirtual machine to be able to use migration features, the virtual machine must becreated on networked storage.

    Red Hat Enterprise Linux 7 requires at least 1 GB of storage space. However, Red Hatrecommends at least 5 GB of storage space for a Red Hat Enterprise Linux 7 installation andfor the procedures in this guide.

    2. Open virt -manager and start the wiz ard

    Open virt-manager by executing the virt-manager command as root or opening Applications System Tools Virtual Machine Manager. Alternatively, run the virt-manager command as root.

    Chapt er 3. Inst alling a virt ual machine

    27

  • Figure 3.1. The Virtual Machine Manager window

    Optionally, open a remote hypervisor by selecting the hypervisor and clicking the Connectbutton.

    Click on the Create a new virtual machine button to start the new virtualized guestwizard.

    Figure 3.2. The Create a new virtual machine but ton

    The New VM window opens.

    3. Specify installat ion type

    Select an installation type:

    Local install media ( ISO image or CDROM)This method uses a CD-ROM, DVD, or image of an installation disk (for example, .iso ).

    Network Install (HTTP, FTP, or NFS)This method involves the use of a mirrored Red Hat Enterprise Linux or Fedorainstallation tree to install a guest. The installation tree must be accessible througheither HTTP, FTP, or NFS.

    If you select Network Install , provide the installation URL, and the Kickstart URLand Kernel options (if required) and continue to Step 5.

    Network Boot (PXE)This method uses a Preboot eXecution Environment (PXE) server to install the guestvirtual machine. Setting up a PXE server is covered in the Deployment Guide. Toinstall via network boot, the guest must have a routable IP address or sharednetwork device.

    If you select Network Boot, continue to Step 5. After all steps are completed, aDHCP request is sent and if a valid PXE server is found the guest virtual machine'sinstallation processes will start.

    Import exist ing d isk imageThis method allows you to create a new guest virtual machine and import a diskimage (containing a pre-installed, bootable operating system) to it.

    Virt ualizat ion Deployment and Administ rat ion Guide

    28

  • Figure 3.3. Virtual machine installat ion method

    Click Forward to continue.

    4. Select the local installat ion media

    If you selected Local install media (ISO image or CDROM), specify your desiredlocal installation media.

    Chapt er 3. Inst alling a virt ual machine

    29

  • Figure 3.4 . Local ISO image installat ion

    A. If you wish to install from a CD-ROM or DVD, select the Use CDROM or DVD radiobutton, and select the appropriate disk drive from the drop-down list of drives available.

    B. If you wish to install from an ISO image, select Use ISO image, and then click the Browse... button to open the Locate media volume window.

    Select the installation image you wish to use, and click Choose Volume.

    If no images are displayed in the Locate media volume window, click on the Browse Local button to browse the host machine for the installation image or DVD drivecontaining the installation disk. Select the installation image or DVD drive containing theinstallation disk and click Open; the volume is selected for use and you are returned to theCreate a new virtual machine wizard.

    ImportantFor ISO image files and guest storage images, the recommended location to use is /var/lib/libvirt/images/. Any other location may require additionalconfiguration by SELinux. Refer to the Red Hat Enterprise Linux VirtualizationSecurity Guide or the Red Hat Enterprise Linux SELinux User's and Administrator'sGuide for more details on configuring SELinux.

    Virt ualizat ion Deployment and Administ rat ion Guide

    30

  • Next, configure the OS type and Version of the installation. Ensure that you select theappropriate operating system type for your virtual machine. This can be specified manuallyor by selecting the Automatically detect operating system based on install media check box.

    Click Forward to continue.

    5.

    Conf igure memory (RAM) and virtual CPUs

    Specify the number of CPUs and amount of memory (RAM) to allocate to the virtual machine.The wizard shows the number of CPUs and amount of memory you can allocate; these valuesaffect the host's and guest's performance.

    Virtual machines require sufficient physical memory (RAM) to run efficiently and effectively.Red Hat supports a minimum of 512MB of RAM for a virtual machine. Red Hat recommends atleast 1024MB of RAM for each logical core.

    Assign sufficient virtual CPUs for the virtual machine. If the virtual machine runs a multi-threaded application, assign the number of virtual CPUs the guest virtual machine will requireto run efficiently.

    You cannot assign more virtual CPUs than there are physical processors (or hyper-threads)available on the host system. The number of virtual CPUs available is noted in the Up to X available field.

    Figure 3.5. Conf iguring Memory and CPU

    Chapt er 3. Inst alling a virt ual machine

    31

  • After you have configured the memory and CPU settings, click Forward to continue.

    NoteMemory and virtual CPUs can be overcommitted. For more information onovercommitting, refer to Chapter 8, Overcommitting with KVM.

    6. Conf igure storage

    Enable and assign sufficient space for your virtual machine and any applications it requires.Assign at least 5 GB for a desktop installation or at least 1 GB for a minimal installation.

    Figure 3.6 . Conf iguring virtual storage

    NoteLive and offline migrations require virtual machines to be installed on shared networkstorage. For information on setting up shared storage for virtual machines, refer toSection 17.3, Shared storage example: NFS for a simple migration .

    a. With the default local storage

    Select the Create a disk image on the computer's hard drive radiobutton to create a file-based image in the default storage pool, the

    Virt ualizat ion Deployment and Administ rat ion Guide

    32

  • /var/lib/libvirt/images/ directory. Enter the size of the disk image to becreated. If the Allocate entire disk now check box is selected, a disk image ofthe size specified will be created immediately. If not, the disk image will grow as itbecomes filled.

    NoteAlthough the storage pool is a virtual container it is limited by two factors:maximum size allowed to it by qemu-kvm and the size of the disk on the hostphysical machine. Storage pools may not exceed the size of the disk on thehost physical machine. The maximum sizes are as follows:

    virtio-blk = 2^63 bytes or 8 Exabytes(using raw files or disk)Ext4 = ~ 16 TB (using 4 KB block size)XFS = ~8 Exabytesqcow2 and host file systems keep their own metadata and scalabilityshould be evaluated/tuned when trying very large image sizes. Using rawdisks means fewer layers that could affect scalability or max size.

    Click Forward to create a disk image on the local hard drive. Alternatively, select Select managed or other existing storage, then select Browse toconfigure managed storage.

    b. With a storage pool

    If you select Select managed or other existing storage to use a storagepool, click Browse to open the Locate or create storage volume window.

    Figure 3.7. The Locate or create storage volume window

    Chapt er 3. Inst alling a virt ual machine

    33

  • i. Select a storage pool from the Storage Pools list.

    ii. Optional: Click on the New Volume button to create a new storage volume.The Add a Storage Volume screen will appear. Enter the name of the newstorage volume.

    Choose a format option from the Format dropdown menu. Format optionsinclude raw, qcow2, and qed. Adjust other fields as desired. Note that theqcow2 version used here is version 3. To change the qcow version refer toSection 26.20.2, Setting target elements

    Figure 3.8. The Add a Storage Volume window

    Select the new volume and click Choose volume. Next, click Finish to return to the New VM wizard. Click Forward to continue.

    7. Name and f inal conf igurat ion

    Name the virtual machine. Virtual machine names can contain letters, numbers and thefollowing characters: underscores (_), periods (. ), and hyphens (-). Virtual machine namesmust be unique for migration and cannot consist only of numbers.

    Verify the settings of the virtual machine and click Finish when you are satisfied; this willcreate the virtual machine with default networking settings, virtualization type, andarchitecture.

    Virt ualizat ion Deployment and Administ rat ion Guide

    34

  • Figure 3.9 . Verifying the conf igurat ion

    Or, to further configure the virtual machine's hardware, check the Customiz econf igurat ion before install check box to change the guest's storage or network devices,to use the para-virtualized (virtio) drivers or to add additional devices. This opens anotherwizard that will allow you to add, remove, and configure the virtual machine's hardwaresettings.

    NoteRed Hat Enterprise Linux 4 or Red Hat Enterprise Linux 5 guest virtual machinescannot be installed using graphical mode. As such, you must select "Cirrus" instead of"QXL" as a video card.

    After configuring the virtual machine's hardware, click Apply. virt-manager will then createthe virtual machine with your specified hardware settings.

    Chapt er 3. Inst alling a virt ual machine

    35

  • Click on the Advanced options down arrow to inspect and modify advanced options. Fora standard Red Hat Enterprise Linux 7 installation, none of these options requiremodification.

    Click Finish to continue into the Red Hat Enterprise Linux installation sequence. For moreinformation on installing Red Hat Enterprise Linux 7, refer to the Red Hat Enterprise Linux 7Installation Guide.

    A Red Hat Enterprise Linux 7 guest virtual machine is now created from an ISO installation diskimage.

    3.4 . Comparison of virt -install and virt -manager installat ion opt ionsThis table provides a quick reference to compare equivalent virt-install and virt -managerinstallation options for when installing a virtual machine.

    Most virt-install options are not required. Minimum requirements are --name, --ram, gueststorage (--disk, --filesystem or --nodisks), and an install option. These options are furtherspecified with arguments; to see a complete list of command options and related arguments, run thefollowing command:

    # virt-install --help

    In virt -manager, at minimum, a name, installation method, memory (RAM), vCPUs, storage arerequired.

    Table 3.1. virt - install and virt -manager conf igurat ion comparison for guestinstallat ions

    Conf igurat ion on virtualmachine

    virt-install opt ion virt -manager installat ionwiz ard label and stepnumber

    Virtual machine name --name, -n Name (step 5)RAM to allocate (MiB) --ram, -r Memory (RAM) (step 3)Storage - specify storagemedia

    --disk Enable storage for this virtualmachine Create a disk imageon the computer's hard drive,or Select managed or otherexisting storage (step 4)

    Storage - export a hostdirectory to the guest

    --filesystem Enable storage for this virtualmachine Select managed orother existing storage (step 4)

    Storage - configure no localdisk storage on the guest

    --nodisks Deselect the Enable storage forthis virtual machine checkbox(step 4)

    Installation media location(local install)

    --file Local install media Locateyour install media (steps 1-2)

    Installation via distribution tree(network install)

    --location Network install URL (steps 1-2)

    Install guest with PXE --pxe Network boot (step 1)Number of vCPUs --vcpus CPUs (step 3)Host network --network Advanced options dropdown

    menu (step 5)

    Virt ualizat ion Deployment and Administ rat ion Guide

    36

  • Operating system --os-type OS type (step 2)Operating systemvariant/version

    --os-variant Version (step 2)

    Graphical display method --graphics, --nographics * virt-manager provides GUIinstallation only

    Conf igurat ion on virtualmachine

    virt-install opt ion virt -manager installat ionwiz ard label and stepnumber

    Chapt er 3. Inst alling a virt ual machine

    37

  • Chapter 4. Virtualizing Red Hat Enterprise Linux on OtherPlatformsThis chapter contains reference material for customers running Red Hat Enterprise Linux 7 as avirtualized operating system on other virtualization hosts.

    4.1. On VMware ESXRed Hat Enterprise Linux 7 provides the following drivers:

    vmw_balloon - a para-virtualized memory ballooning driver used when running Red HatEnterprise Linux on VMware hosts. For further information about this driver, refer tohttp://kb.VMware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=1002586.

    vmmouse_drv - a para-virtualized mouse driver used when running Red Hat Enterprise Linux onVMware hosts. For further information about this driver, refer tohttp://kb.VMware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=5739104.

    vmware_drv - a para-virtualized video driver used when running Red Hat Enterprise Linux onVMware hosts. For further information about this driver, refer tohttp://kb.VMware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=1033557.

    vmxnet3 - a para-virtualized network adapter used when running Red Hat Enterprise Linux onVMware hosts. For further information about this driver, refer tohttp://kb.VMware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1001805.

    vmw_pvscsi - a para-virtualized SCSI adapter used when running Red Hat Enterprise Linux onVMware hosts. For further information about this driver, refer tohttp://kb.VMware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1010398.

    4.2. On Hyper-VRed Hat Enterprise Linux 7 ships with Microsoft's Linux Integration Services, a set of drivers thatenable synthetic device support in supported virtualized operating systems. Red Hat Enterprise Linux7 provides the following drivers:

    hv_vmbus - a main para-virtualized driver for communicating with the Hyper-V host

    hv_netvsc - a para-virtualized network driver

    hv_storvsc - a para-virtualized storage (SCSI) driver

    hyperv_fb - a para-virtualized framebuffer device

    hyperv_keyboard - a para-virtualized keyboard driver

    hid_hyperv - a para-virtualized mouse driver

    hv_balloon -a memory hotplug and ballooning driver

    hv_utils - a guest integration services driver

    Virt ualizat ion Deployment and Administ rat ion Guide

    38

  • For more information about the drivers provided refer to Microsoft's website and the Linux andFreeBSD Virtual Machines on Hyper-V article in particular. More information on the Hyper-V featureset, is located in Feature Descriptions for Linux and FreeBSD virtual machines on Hyper-V.

    Another article which may be helpful is: Enabling Linux Support on Windows Server 2012 R2 Hyper-V. Access to this article may require a Microsoft account.

    NoteThe Hyper-V manager supports shrinking a GUID Partition Table (GPT) partitioned disk ifthere is free space after the last partition, by allowing the user to drop the unused last part ofthe disk. However, this operation will silently delete the secondary GPT header on the disk,which may trigger error messages when guest examines the partition table (for example, whenprinting the partition table with parted ). This is a known limit of Hyper-V. As a workaround, itis possible to manually restore the secondary GPT header with the gdisk expert command"e" , after shrinking the GPT disk. This also occurs when using Hyper-V's Expand option, butcan also be fixed with the parted tool. Information about these commands can be viewed inthe parted(8) and gdisk(8) man pages.

    For more information, see the following article: Best Practices for running Linux on Hyper-V.

    Chapt er 4 . Virt ualiz ing Red Hat Ent erprise Linux on Ot her Plat forms

    39

  • Chapter 5. Installing a fully-virtualized Windows guestThis chapter describes how to create a fully-virtualized Windows guest using the command-line(virt-install ), launch the operating system's installer inside the guest, and access the installerthrough virt-viewer.

    ImportantRed Hat Enterprise Linux 7 Windows guests are only supported under specific subscriptionprograms such as Advanced Mission Critical (AMC). If you are unsure whether yoursubscription model includes support for Windows guests, please contact customer support.

    To install a Windows operating system on the guest, use the virt-viewer tool. This tool allows youto display the graphical console of a virtual machine (via the VNC protocol). In doing so, virt-viewer allows you to install a fully-virtualized guest's operating system with that operating system'sinstaller (for example, the Windows 8 installer).

    Installing a Windows operating system involves two major steps:

    1. Creating the guest virtual machine, using either virt-install or virt-manager.

    2. Installing the Windows operating system on the guest virtual machine, using virt-viewer.

    Refer to Chapter 3, Installing a virtual machine for details about creating a guest virtual machine with virt-install or virt-manager.

    Note that this chapter does not describe how to install a Windows operating system on a fully-virtualized guest. Rather, it only covers how to create the guest and launch the installer within theguest. For information on how to install a Windows o