40
Dayle Parker Laura Novich Jiri Herrmann Jacquelynn East Scott Radvan Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction to virtualization concepts

Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

  • Upload
    others

  • View
    35

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Dayle Parker Laura Novich Jiri HerrmannJacquelynn East Scott Radvan

Red Hat Enterprise Linux 7Virtualization Getting Started Guide

An introduct ion to virtualizat ion concepts

Page 2: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction
Page 3: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Red Hat Enterprise Linux 7 Virtualizat ion Gett ing Started Guide

An introduct ion to virtualizat ion concepts

Dayle ParkerRed Hat Customer Content [email protected]

Laura NovichRed Hat Customer Content [email protected]

Jiri HerrmannRed Hat Customer Content [email protected]

Jacquelynn EastRed Hat Customer Content [email protected]

Scott RadvanRed Hat Customer Content Services

Page 4: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Legal Notice

Copyright © 2011-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.

AbstractThe Red Hat Enterprise Linux Virtualization Getting Started Guide describes the basics o fvirtualization and the virtualization products and techno logies that are available with Red HatEnterprise Linux.

Page 5: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

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

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

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

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

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

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

Table of Contents

Chapt er 1 . What is virt ualizat ion and migrat ion?1.1. What is virtualizatio n?1.2. What is mig ratio n?

Chapt er 2 . Advant ages and misconcept ions of virt ualizat ion2.1. Virtualizatio n co sts2.2. Virtualizatio n learning curve2.3. Perfo rmance2.4. Disaster reco very2.5. Security2.6 . Virtualizatio n fo r servers and ind ivid uals

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s3.1. KVM and virtualizatio n in Red Hat Enterp rise Linux3.2. l ib virt and l ib virt to o ls3.3. Virtualized hard ware d evices3.4. Sto rag e

Chapt er 4 . Virt ualizat ion T ools4.1. virsh4.2. virt-manag er4.3. virt-install4.4. g uestfish4.5. GNOME Bo xes4.6 . O ther useful to o ls

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 75.1. Basic req uirements and setup5.2. Dep lo ying a virtual machine with Virtual Machine Manag er

Appendix A. Revision Hist ory

222

4444556

779

1016

1 9191919202020

2 52526

36

T able of Cont ent s

1

Page 6: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Chapter 1. What is virtualization and migration?

This chapter discusses terms related to virtualization and migration.

1.1. What is virtualizat 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. Most existing implementationsof virtualization use a hypervisor - a software layer or subsystem that controls hardware and allowsmultiple operating systems, called guests - to run on the same physical system, called a host. Thereare several methods for virtualizing operating systems.

Virtualiz at ion methods

Full virtualiz at ion

Full virtualization uses the hardware capabilities of the processor to allow guests to usefeatures of the host's physical system. This creates a new virtual system, called a virtualmachine, which allows guest operating systems to run without modifications. The guestoperating system and any applications on the guest virtual machine are unaware of theirvirtualized environment and run as if they were on a physical machine. The KVM (Kernel-based Virtual Machine) hypervisor in Red Hat Enterprise Linux uses full virtualization,provided by the hardware-assisted virtualization method.

Para-virtualiz at ion

Para-virtualization employs a collection of software and data structures that are presentedto the virtualized guest, requiring software modifications in the guest to use the para-virtualized environment. Para-virtualization can encompass the entire kernel, as is the casefor Xen para-virtualized guests, or drivers that virtualize I/O devices.

Sof tware virtualiz at ion (or emulat ion)

Software virtualization uses slower binary translation and other emulation techniques torun unmodified operating systems. Software virtualization is unsupported by Red HatEnterprise Linux.

Note

For more information and detailed instructions on guest installation, refer to the Red HatEnterprise Linux 7 Virtualization Deployment and Administration Guide.

1.2. What is migrat ion?

Migration describes the process of moving a guest virtual machine from one host to another. This ispossible because the virtual machines are running in a virtualized environment instead of directly onthe hardware. There are two ways to migrate a virtual machine: live and offline.

Migrat ion types

Of f line migrat ion

An offline migration suspends or shuts down the guest virtual machine, and then moves an

Virt ualizat ion Get t ing St art ed Guide

2

Page 7: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

image of the virtual machine's memory to the destination host. The virtual machine is thenresumed on the destination host and the memory used by the virtual machine on the sourcehost is freed.

Live migrat ion

Live migration is the process of migrating an active virtual machine from one physical hostto another. Note that this is not possible between all Red Hat Enterprise Linux releases -consult the Virtualization Deployment and Administration Guide for details.

It is important to understand that the migration process moves the virtual machine's memory, and thedisk volume associated with the virtual machine is also migrated. This process is done using liveblock migration — information about this can be found in the Red Hat Enterprise Linux 7 VirtualizationDeployment and Administration Guide.

1.2.1. Benefits of migrat ing virtual machines

Migration is useful for:

Load balancing

When a host machine is overloaded, one or many of its virtual machines could be migratedto other hosts using live migration.

Upgrading or making changes to the host

When the need arises to upgrade, add, or remove hardware devices on one host, virtualmachines can be safely relocated to other hosts. This means that guests do not experienceany downtime due to changes that are made to any of the hosts.

Energy saving

Virtual machines can be redistributed to other hosts and the unloaded host systems can bepowered off to save energy and cut costs in low usage periods.

Geographic migrat ion

Virtual machines can be moved to another physical location for lower latency or for otherspecial circumstances.

Chapt er 1 . What is virt ualizat ion and migrat ion?

3

Page 8: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Chapter 2. Advantages and misconceptions of virtualization

There are many advantages to virtualization and perhaps an equal amount of misconceptionssurrounding it. This chapter explores these points.

2.1. Virtualizat ion costs

A common misconception is that virtualization is too expensive to justify the change. Virtualizationcan be expensive to introduce but often it saves money in the long term. It is important to perform aReturn on Investment (ROI) analysis to determine the best use of virtualization in your environment.Consider the following benefits:

Less power

Using virtualization negates much of the need for multiple physical platforms. This equatesto less power being drawn for machine operation and cooling, resulting in reduced energycosts. The initial cost of purchasing multiple physical platforms, combined with themachines' power consumption and required cooling, is drastically cut by usingvirtualization.

Less maintenance

Provided adequate planning is performed before migrating physical systems to virtualizedones, less time is spent maintaining them. This means less money being spent on parts andlabor.

Extended life for installed sof tware

Older versions of software may not run on newer, bare-metal machines directly. However, byrunning the older software virtually on a larger, faster system, the life of the software may beextended while taking advantage of the performance from the newer system.

Predictable costs

A Red Hat Enterprise Linux subscription provides support for virtualization at a fixed rate,making it easy to predict costs.

Less space

Consolidating servers onto fewer machines means less physical space is required. Thismeans the space normally occupied by server hardware can be used for other purposes.

2.2. Virtualizat ion learning curve

A misconception exists that virtualization is difficult to learn. In truth, virtualization is no more difficultor easy to learn than any new process. The skills required for managing and supporting a physicalenvironment are easily transferable to a virtual one. Virtual environments function similarly to theirphysical counterparts, ensuring the learning curve remains a slight one.

2.3. Performance

On older virtualization versions that supported only a single CPU, virtual machines experiencednoticeable performance limitations. This created a long-lasting misconception that virtualizationsolutions are slow.

Virt ualizat ion Get t ing St art ed Guide

4

Page 9: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

This is no longer the case; modern virtualization technology has greatly improved the speed ofvirtual machines. Benchmarks show that virtual machines can run typical server applications nearlyas efficiently as bare-metal systems:

The industry standard SAP Sales and Distribution (SD) Standard Application Benchmark foundRed Hat Enterprise Linux 6.2 and KVM to demonstrate a virtualization efficiency of 85% whencomparing a bare-metal system running on identical hardware.

Red Hat Enterprise Linux 6.1 and KVM achieved record-setting virtualization performance in theSPECvirt_sc2010 benchmark recorded by the Standard Performance Evaluation Corporation(SPEC), setting the best virtual performance mark of any published SPECvirt result. TheSPECvirt_sc2010 metric measures the end-to-end performance of system components invirtualized data center servers.

Note

For more details on these virtualization benchmarks, visit:

Red Hat Knowledgebase, SAP-SD Benchmark running in a VM – Leadership Performance usingRHEL 6 / KVM at https://access.redhat.com/knowledge/articles/216943The Standard Performance Evaluation Corporation (SPEC) at http://www.spec.orgRed Hat Achieves New Top Virtualization Performance Benchmark with HP athttp://investors.redhat.com/releasedetail.cfm?ReleaseID=617594

2.4 . Disaster recovery

Disaster recovery is quicker and easier when the systems are virtualized. On a physical system, ifsomething serious goes wrong, a complete re-install of the operating system is usually required,resulting in hours of recovery time. However, if the systems are virtualized this is much faster due tomigration ability. If the requirements for live migration are followed, virtual machines can be restartedon another host, and the longest possible delay would be in restoring guest data. Also, becauseeach of the virtualized systems are completely separate from each other, one system's downtime willnot affect any others.

2.5. Securit y

A virtual machine uses SELinux and sVirt to improve security in virtualization. This section includesan overview of the security options available.

2.5.1. Virtualizat ion security features

SELinux

SELinux was developed by the US National Security Agency and others to provide MandatoryAccess Control (MAC) for Linux. Under control of SELinux, all processes and files are given what isknown as a type, and access is limited by fine-grained controls. SELinux limits the abilities of anattacker and works to prevent many common security exploits such as buffer overflow attacks andprivilege escalation.

SELinux strengthens the security model of Red Hat Enterprise Linux hosts and virtualized Red HatEnterprise Linux guests. SELinux is configured and tested to work, by default, with all virtualizationtools shipped with Red Hat Enterprise Linux 7.

Chapt er 2 . Advant ages and misconcept ions of virt ualizat ion

5

Page 10: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

sVirt

sVirt is a technology included in Red Hat Enterprise Linux 7 that integrates SELinux andvirtualization. It applies Mandatory Access Control (MAC) to improve security when using virtualmachines, and improves security and hardens the system against bugs in the hypervisor that mightbe used as an attack vector for the host or to another virtual machine.

Note

For more information on security in virtualization, refer to the Red Hat Enterprise Linux 7Virtualization Security Guide.

2.6. Virtualizat ion for servers and individuals

Virtualization is not just for servers; it can be useful for individuals as well. Desktop virtualizationoffers centralized management, an improved desktop solution, and better disaster recovery. By usingconnection software, it is possible to connect to a desktop remotely.

When used on servers, virtualization can benefit not only larger networks, but also any deploymentwith more than a single server. It provides live migration, high availability, fault tolerance, andstreamlined backups.

2.6.1. Virtualizat ion deployment scenarios

These are examples of common deployment scenarios for virtualization, and the tools that can beused to facilitate these scenarios.

Small deployments of up to 3 physical hosts and 10 guests: virt -manager

A tool such as virt-manager can be useful to a small business running several servers thatdo not have strict uptime requirements or service-level agreements (SLAs). In thisenvironment, a single administrator may be responsible for the entire infrastructure, andmaintaining procedural flexibility is important if a component needs to be changed. Thisenvironment may contain applications such as web servers, file and print servers, andapplication servers.

Large deployments or mission-crit ical applicat ions: Red Hat EnterpriseVirtualiz at ion (RHEV)

A full virtualization platform such as Red Hat Enterprise Virtualization (RHEV) might suit anenterprise running larger deployments or mission-critical applications. In this environment,the physical infrastructure is large enough to require an IT department and the businessrequirements demand a defined response to new needs. Some examples of a largedeployment suited to Red Hat Enterprise Virtualization may include databases, tradingplatforms, or messaging systems that must run continuously without any downtime.

Sof tware developers producing management applicat ions: libvirt

Both virt-manager and Red Hat Enterprise Virtualization (RHEV) use libvirt to managevirtual machines. libvirt is a virtualization application programming interface (API) thatallows software developers to produce and adapt management applications.

Virt ualizat ion Get t ing St art ed Guide

6

Page 11: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Chapter 3. Introduction to Red Hat virtualization products

This chapter introduces the various virtualization products available in Red Hat Enterprise Linux.

3.1. KVM and virtualizat ion in Red Hat Enterprise Linux

What is KVM?

KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on AMD64 andIntel 64 hardware that is built into the standard Red Hat Enterprise Linux 7 kernel and canrun multiple guest operating systems. The KVM hypervisor in Red Hat Enterprise Linux ismanaged with the l ibvirt API and tools built for l ibvirt (such as virt-manager and virsh). Virtual machines are executed and run as multi-threaded Linux processescontrolled by these tools.

Overcommit t ing

The KVM hypervisor supports overcommitting of system resources. Overcommitting meansallocating more virtualized CPUs or memory than the available resources on the system.Memory overcommitting allows hosts to utilize memory and virtual memory to increase guestdensities.

Important

Overcommitting involves possible risks to system stability. For more information onovercommitting with KVM, and the precautions that should be taken, refer to the RedHat Enterprise Linux 7 Virtualization Deployment and Administration Guide.

Thin provisioning

Thin provisioning allows the allocation of flexible storage and optimizes the available spacefor every guest virtual machine. It gives the appearance that there is more physical storageon the guest than is actually available. This is not the same as overcommitting as this onlypertains to storage and not CPUs or memory allocations.

Important

Like overcommiting, thin provisioning involves possible risks to system stability. Formore information on thin provisioning with KVM, and the precautions that should betaken, refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and AdministrationGuide.

KSM

Kernel Same-page Merging (KSM), used by the KVM hypervisor, allows KVM guests to shareidentical memory pages. These shared pages are usually common libraries or otheridentical, high-use data. KSM allows for greater guest density of identical or similar guestoperating systems by avoiding memory duplication.

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s

7

Page 12: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Note

For more information on KSM, refer to the Red Hat Enterprise Linux 7 VirtualizationDeployment and Administration Guide.

QEMU Guest Agent

The QEMU Guest Agent runs on the guest operating system and allows the host machine toissue commands to the guest operating system.

Note

For more information on the QEMU Guest Agent, refer to the Red Hat Enterprise Linux 7Virtualization Deployment and Administration Guide.

Disk I/O throt t ling

When several virtual machines are running simultaneously, they can interfere with systemperformance by using excessive disk I/O. Disk I/O throttling in KVM provides the ability to seta limit on disk I/O requests sent from virtual machines to the host machine. This can preventa virtual machine from over utilizing shared resources, and impacting the performance ofother virtual machines.

Note

For instructions on using disk I/O throttling, refer to the Red Hat Enterprise Linux 7Virtualization Tuning and Optimization Guide.

Automat ic NUMA balancing

Automatic NUMA balancing improves the performance of applications running on non-uniform memory access (NUMA) hardware systems, without any manual tuning required forRed Hat Enterprise Linux 7 guests. Automatic NUMA balancing moves tasks, which can bethreads or processes, closer to the memory they are accessing.

Note

For more information on automatic NUMA balancing, refer to the Red Hat EnterpriseLinux 7 Virtualization Tuning and Optimization Guide.

Virtual CPU hot add

Virtual CPU (vCPU) hot add capability provides the ability to increase processing power asneeded on running virtual machines, without downtime. The vCPUs assigned to a virtualmachine can be added to a running guest in order to either meet the workload's demands,or to maintain the Service Level Agreement (SLA) associated with the workload.

Virt ualizat ion Get t ing St art ed Guide

8

Page 13: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Note

For more information on virtual CPU hot add, refer to the Red Hat Enterprise Linux 7Virtualization Deployment and Administration Guide.

KVM guest virtual machine compat ib ility

Red Hat Enterprise Linux 7 servers have certain support limits.

The following URLs explain the processor and memory amount limitations for Red HatEnterprise Linux:

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.

Note

To verify whether your processor supports the virtualization extensions and forinformation on enabling the virtualization extensions if they are disabled, refer to theRed Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide.

Nested Virtualiz at ion

As of version 7.2, Red Hat Enterprise Linux offers the nested virtualization feature as aTechnology Preview.

Nested virtualization makes it possible to use KVM guests as hosts, and thus enables theuser to create one or more KVM guests within each KVM guest. This for example allowsdebugging hypervisors on a virtual machine or testing larger virtual deployments on alimited amount of physical machines.

3.2. libvirt and libvirt tools

The libvirt package is a hypervisor-independent virtualization API that is able to interact with thevirtualization capabilities of a range of operating systems.

The libvirt package provides:

A standard, generic, and stable virtualization layer to securely manage virtual machines on ahost.

A standard interface for managing local systems and networked hosts.

All of the APIs required to provision, create, modify, monitor, control, migrate, and stop virtualmachines, but only if the hypervisor supports these operations. Although multiple hosts may beaccessed with l ibvirt simultaneously, the APIs are limited to single node operations.

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s

9

Page 14: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

l ibvirt focuses on managing single hosts and provides APIs to enumerate, monitor and use theresources available on the managed node, including CPUs, memory, storage, networking and Non-Uniform Memory Access (NUMA) partitions. The management tools can be located on separatephysical machines from the host using secure protocols.

Red Hat Enterprise Linux 7 supports l ibvirt and includes l ibvirt -based tools as its default methodfor virtualization management (as in Red Hat Enterprise Virtualization Management).

The libvirt package is available as free software under the GNU Lesser General Public License. Thelibvirt project aims to provide a long term stable C API to virtualization management tools, running ontop of varying hypervisor technologies. The libvirt package supports Xen on Red Hat EnterpriseLinux 5, and it supports KVM on Red Hat Enterprise Linux 5, Red Hat Enterprise Linux 6, and Red HatEnterprise Linux 7.

virsh

The virsh command-line tool is built on the l ibvirt management API and operates as analternative to the graphical virt-manager application. The virsh command can be usedin read-only mode by unprivileged users or, with root access, full administrationfunctionality. The virsh command is ideal for scripting virtualization administration andprovides many functions such as installing, listing, starting, and stopping virtual machines.

virt -manager

virt-manager is a graphical desktop tool for managing virtual machines. It allows accessto graphical guest consoles and can be used to perform virtualization administration,virtual machine creation, migration, and configuration tasks. The ability to view virtualmachines, host statistics, device information and performance graphs is also provided. Thelocal hypervisor and remote hypervisors can be managed through a single interface.

Note

For more information on virsh and virt -manager, refer to the Red Hat Enterprise Linux 7Virtualization Deployment and Administration Guide.

3.3. Virtualized hardware devices

Virtualization on Red Hat Enterprise Linux 7 allows virtual machines to use the host's physicalhardware as three distinct types of devices:

Virtualized and emulated devices

Para-virtualized devices

Physically shared devices

These hardware devices all appear as being physically attached to the virtual machine but thedevice drivers work in different ways.

3.3.1. Virtualized and emulated devices

KVM implements many core devices for virtual machines in software. These emulated hardwaredevices are crucial for virtualizing operating systems.

Emulated devices are virtual devices which exist entirely in software.

Virt ualizat ion Get t ing St art ed Guide

10

Page 15: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Emulated drivers may use either a physical device or a virtual software device. Emulated drivers are atranslation layer between the virtual machine and the Linux kernel (which manages the sourcedevice). The device level instructions are completely translated by the KVM hypervisor. Any device, ofthe same type (storage, network, keyboard, and mouse) and recognized by the Linux kernel, may beused as the backing source device for the emulated drivers.

Virtual CPUs (vCPUs)

A host system can have up to 160 virtual CPUs (vCPUs) that can be presented to guests fortheir use, regardless of the number of host CPUs.

Emulated graphics devices

Two emulated graphics devices are provided. These devices can be connected to with theSPICE (Simple Protocol for Independent Computing Environments) protocol or with VNC:

A Cirrus CLGD 5446 PCI VGA card (using the cirrus device)

A standard VGA graphics card with Bochs VESA extensions (hardware level, includingall non-standard modes)

Emulated system components

The following core system components are emulated to provide basic system functions:

Intel i440FX host PCI bridge

PIIX3 PCI to ISA bridge

PS/2 mouse and keyboard

EvTouch USB graphics tablet

PCI UHCI USB controller and a virtualized USB hub

Emulated serial ports

EHCI controller, virtualized USB storage and a USB mouse

USB 3.0 xHCI host controller (Technology Preview in Red Hat Enterprise Linux 7.2)

Emulated sound devices

Red Hat Enterprise Linux 6.1 and later provides an emulated (Intel) HDA sound device, intel-hda. This device is supported on the following guest operating systems:

Red Hat Enterprise Linux 7, for the x86_64 architecture

Red Hat Enterprise Linux 6, for i386 and x86_64 architectures

Red Hat Enterprise Linux 5, for i386 and x86_64 architectures

Red Hat Enterprise Linux 4, for i386 and x86_64 architectures

The following emulated sound device is also available, but is not recommended due tocompatibility issues with certain guest operating systems:

ac97, an emulated Intel 82801AA AC97 Audio compatible sound card

Emulated watchdog devices

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s

11

Page 16: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Red Hat Enterprise Linux 6.0 and above provides two emulated watchdog devices. Awatchdog can be used to automatically reboot a virtual machine when it becomesoverloaded or unresponsive.

The watchdog package must be installed on the guest.

The two devices available are:

i6300esb, an emulated Intel 6300 ESB PCI watchdog device. It is supported in guestoperating system Red Hat Enterprise Linux versions 6.0 and above, and is therecommended device to use.

ib700 , an emulated iBase 700 ISA watchdog device. The ib700 watchdog device isonly supported in guests using Red Hat Enterprise Linux 6.2 and above.

Both watchdog devices are supported in i386 and x86_64 architectures for guest operatingsystems Red Hat Enterprise Linux 6.2 and above.

Emulated network devices

There are two emulated network devices available:

The e1000 device emulates an Intel E1000 network adapter (Intel 82540EM, 82573L,82544GC).

The rtl8139 device emulates a Realtek 8139 network adapter.

Emulated storage drivers

Storage devices and storage pools can use these emulated drivers to attach storagedevices to virtual machines. The guest uses an emulated storage driver to access thestorage pool.

Note that like all virtual devices, the storage drivers are not storage devices. The drivers areused to attach a backing storage device, file or storage pool volume to a virtual machine.The backing storage device can be any supported type of storage device, file, or storagepool volume.

The emulated IDE driver

KVM provides two emulated PCI IDE interfaces. An emulated IDE driver can beused to attach any combination of up to four virtualized IDE hard disks orvirtualized IDE CD-ROM drives to each virtual machine. The emulated IDE driveris also used for virtualized CD-ROM and DVD-ROM drives.

The emulated f loppy d isk drive driver

The emulated floppy disk drive driver is used for creating virtualized floppy drives.

The emulated AHCI contro ller

The emulated Advanced Host Controller Interface (AHCI) bus is an alternative toIDE. It is available as a Technology Preview in Red Hat Enterprise Linux 7.2.

Note

For more information on KVM storage features, refer to Section 3.4,“Storage” .

Virt ualizat ion Get t ing St art ed Guide

12

Page 17: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

3.3.2. Para-virtualized devices

Para-virtualization provides a fast and efficient means of communication for guests to use deviceson the host machine. KVM provides para-virtualized devices to virtual machines using the Virtio APIas a layer between the hypervisor and guest.

Some para-virtualized devices decrease I/O latency and increase I/O throughput to near bare-metallevels, while other para-virtualized devices add functionality to virtual machines that is not otherwiseavailable. It is recommended to use para-virtualized devices instead of emulated devices for virtualmachines running I/O intensive applications.

All virtio devices have two parts: the host device and the guest driver. Para-virtualized device driversallow the guest operating system access to physical devices on the host system.

To use this device, the para-virtualized device drivers must be installed on the guest operatingsystem. By default, the para-virtualized device drivers are included in Red Hat Enterprise Linux 4.7and later, Red Hat Enterprise Linux 5.4 and later and Red Hat Enterprise Linux 6.0 and later.

Note

For more information on using the para-virtualized devices and drivers, refer to the Red HatEnterprise Linux 7 Virtualization Deployment and Administration Guide.

The para-virtualiz ed network device (virt io -net )

The para-virtualized network device is a virtual network device that provides networkaccess to virtual machines with increased I/O performance and lower latency.

The para-virtualiz ed b lock device (virt io -b lk)

The para-virtualized block device is a high-performance virtual storage device thatprovides storage to virtual machines with increased I/O performance and lower latency. Thepara-virtualized block device is supported by the hypervisor and is attached to the virtualmachine (except for floppy disk drives, which must be emulated).

The para-virtualiz ed contro ller device (virt io -scsi)

The para-virtualized SCSI controller device provides a more flexible and scalablealternative to virtio-blk. A virtio-scsi guest is capable of inheriting the feature set of the targetdevice, and can handle hundreds of devices compared to virtio-blk, which can only handle28 devices.

virtio-scsi is fully supported for the following guest operating systems:

Red Hat Enterprise Linux 7

Red Hat Enterprise Linux 6.4 and above

The para-virtualiz ed clock

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 providingguests with a para-virtualized clock. Additionally, the para-virtualized clock assists withtime adjustments needed after a guest runs S3 or suspend to RAM operations.

The para-virtualiz ed serial device (virt io -serial)

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s

13

Page 18: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

The para-virtualized serial device is a bytestream-oriented, character stream device, andprovides a simple communication interface between the host's user space and the guest'suser space.

The balloon device (virt io -balloon)

The balloon device can designate part of a virtual machine's RAM as not being used (aprocess known as balloon inflation), so that the memory can be freed for the host (or forother virtual machines on that host) to use. When the virtual machine needs the memoryagain, the balloon can be deflated and the host can distribute the RAM back to the virtualmachine.

The para-virtualiz ed random number generator (virt io - rng)

The para-virtualized random number generator enables virtual machines to collect entropy,or randomness, directly from the host to use for encrypted data and security. Virtualmachines can often be starved of entropy because typical inputs (such as hardware usage)are unavailable. Sourcing entropy can be time-consuming; virtio-rng makes this processfaster by injecting entropy directly into guest virtual machines from the host.

The para-virtualiz ed graphics card (QXL)

The para-virtualized graphics card works with the QXL driver to provide an efficient way todisplay a virtual machine's graphics from a remote host. The QXL driver is required to useSPICE.

3.3.3. Physical host devices

Certain hardware platforms allow virtual machines to directly access various hardware devices andcomponents. This process in virtualization is known as device assignment. Device assignment is alsoknown as passthrough.

VFIO device assignment

Virtual Function I/O (VFIO) is a new kernel driver in Red Hat Enterprise Linux 7 that providesvirtual machines with high performance access to physical hardware.

VFIO attaches PCI devices on the host system directly to virtual machines, allowing guestsexclusive access to PCI devices for a range of tasks. This allows PCI devices to appear andbehave as if they were physically attached to the guest virtual machine.

VFIO improves on previous PCI device assignment architecture by moving deviceassignment out of the KVM hypervisor, and enforcing device isolation at the kernel level.VFIO offers better security and is compatible with secure boot. It is the default deviceassignment mechanism in Red Hat Enterprise Linux 7.

VFIO increases the number of assigned devices to 32 in Red Hat Enterprise Linux 7, from amaximum 8 devices in Red Hat Enterprise Linux 6. VFIO also supports assignment ofNVIDIA GPUs.

Note

For more information on VFIO device assignment, refer to the Red Hat EnterpriseLinux 7 Virtualization Deployment and Administration Guide.

USB, PCI, and SCSI passthrough

Virt ualizat ion Get t ing St art ed Guide

14

Page 19: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

The KVM hypervisor supports attaching USB, PCI, and SCSI devices on the host system tovirtual machines. USB, PCI, and SCSI device assignment allows the devices to appear andbehave as if they were physically attached to the virtual machine. Thus, it allows guests tohave exclusive access to these devices for a variety of tasks.

Note

For more information on USB, PCI, and SCSI passthrough, refer to the Red HatEnterprise Linux 7 Virtualization Deployment and Administration Guide.

SR- IOV

SR-IOV (Single Root I/O Virtualization) is a PCI Express (PCI-e) standard that extends asingle physical PCI function to share its PCI resources as separate, virtual functions (VFs).Each function is capable of being used by a different virtual machine via PCI deviceassignment.

An SR-IOV capable PCI-e device provides a Single Root function (for example, a singleEthernet port) and presents multiple, separate virtual devices as unique PCI devicefunctions. Each virtual device may have its own unique PCI configuration space, memory-mapped registers, and individual MSI-based interrupts.

Note

For more information on SR-IOV, refer to the Red Hat Enterprise Linux 7 VirtualizationDeployment and Administration Guide.

NPIV

N_Port ID Virtualization (NPIV) is a functionality available with some Fibre Channeldevices. NPIV shares a single physical N_Port as multiple N_Port IDs. NPIV providessimilar functionality for Fibre Channel Host Bus Adapters (HBAs) that SR-IOV provides forPCIe interfaces. With NPIV, virtual machines can be provided with a virtual Fibre Channelinitiator to Storage Area Networks (SANs).

NPIV can provide high density virtualized environments with enterprise-level storagesolutions.

3.3.4 . Guest CPU models

CPU models define which host CPU features are exposed to the guest operating system. qemu-kvmand l ibvirt contain definitions for several current processor models, allowing users to enable CPUfeatures that are available only in newer CPU models. The set of CPU features that can be exposed toguests depends on support in the host CPU, the kernel, and qemu-kvm code.

To allow safe migration of virtual machines between hosts with different sets of CPU features, qemu-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 CPUfeature enabled, it is not possible to migrate it to a host that does not support exposing that feature toguests.

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s

15

Page 20: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Note

For more information on guest CPU models, refer to the Red Hat Enterprise Linux 7 VirtualizationDeployment and Administration Guide.

3.4 . Storage

Storage for virtual machines is abstracted from the physical storage allocated to the virtual machine.It is attached to the virtual machine using the para-virtualized or emulated block device drivers.

3.4 .1. Storage pools

A storage pool is a file, directory, or storage device managed by l ibvirt for the purpose of providingstorage to virtual machines. Storage pools are divided into storage volumes that store virtualmachine images or are attached to virtual machines as additional storage. Multiple guests can sharethe same storage pool, allowing for better allocation of storage resources. Refer to the Red HatEnterprise Linux 7 Virtualization Deployment and Administration Guide for more information.

Local storage pools

Local storage pools are directly attached to the host server. They include local directories,directly attached disks, physical partitions, and LVM volume groups on local devices. Localstorage pools are useful for development, testing and small deployments that do not requiremigration or large numbers of virtual machines. Local storage pools may not be suitable formany production environments as they do not support live migration.

Networked (shared) storage pools

Networked storage pools include storage devices shared over a network using standardprotocols. Networked storage is required when migrating virtual machines between hostswith virt -manager, but is optional when migrating with virsh. Networked storage poolsare managed by l ibvirt .

3.4 .2. Storage volumes

Storage pools are further divided into storage volumes. Storage volumes are an abstraction ofphysical partitions, LVM logical volumes, file-based disk images and other storage types handled byl ibvirt . Storage volumes are presented to virtual machines as local storage devices regardless of theunderlying hardware.

3.4 .3. Emulated storage devices

Virtual machines can be presented with a range of storage devices that are emulated by the host.Each type of storage device is appropriate for specific use cases, allowing for maximum flexibilityand compatibility with guest operating systems.

virt io -scsi

virtio-scsi is the recommended para-virtualized device for guests using large numbers ofdisks or advanced storage features such as TRIM. Guest driver installation may benecessary on guests using operating systems other than Red Hat Enterprise Linux 7.

virt io -b lk

Virt ualizat ion Get t ing St art ed Guide

16

Page 21: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

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 fewerfeatures than virtio-scsi.

IDE

IDE is recommended for legacy guests that do not support virtio drivers. IDE performance islower than virtio-scsi or virtio-blk, but it is widely compatible with different systems.

CD-ROM

ATAPI CD-ROMs and virtio-scsi CD-ROMs are available for allowing the guests to use ISOfiles or the host CD-ROM drive. virtio-scsi CD-ROMs can be used with guests that have thevirtio-scsi driver installed. ATAPI CD-ROMs offer wider compatibility but lower performance.

USB mass storage devices and f loppy d isks

USB mass storage devices and floppy disks are available when removable media arerequired. USB mass storage devices are preferable to floppy disks due to their largercapacity.

AHCI

The emulated Advanced Host Controller Interface (AHCI) bus is an alternative to IDE whichprovides increased features and performance, including communication with Serial ATA(SATA) devices.

AHCI is available as a Technology Preview in Red Hat Enterprise Linux 7.2.

3.4 .4 . Host storage

Disk images can be stored on a range of local and remote storage technologies connected to thehost.

Image f iles

Image files are stored on a host file system. The image files can be stored on a local filesystem, such as ext4 or xfs, or a network file system, such as NFS.

Tools such as l ibguest fs can manage, back up, and monitor files. Disk image formats onKVM include:

raw

Raw image files contain the contents of the disk with no additional metadata.

Raw files can either be pre-allocated or sparse, if the host file system allows it.Sparse files allocate host disk space on demand, and are therefore a form of thinprovisioning. Pre-allocated files are fully provisioned but have higherperformance than sparse files.

Raw files are desirable when disk I/O performance is critical and transferring theimage file over a network is rarely necessary.

qcow2

qcow2 image files offer a number of advanced disk image features includingbacking files, snapshots, compression, and encryption. They can be used toinstantiate virtual machines from template images.

Chapt er 3. Int roduct ion t o Red Hat virt ualizat ion product s

17

Page 22: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

qcow2 files are typically more efficient to transfer over a network, because onlysectors written by the virtual machine are allocated in the image.

Red Hat Enterprise Linux 7.0 and newer supports the qcow2 version 3 image fileformat.

LVM volumes

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, andcan be used as an alternative to migrating to qcow2.

Host devices

Host devices such as physical CD-ROMs and raw disks or LUNs can be presented to theguest. This allows SAN or iSCSI LUNs as well as local CD-ROM media to be used by theguest with good performance.

Host devices can be used when storage management is done on a SAN instead of onhosts.

Dist ributed storage systems

Gluster volumes can be used as disk images. This allows high-performance clusteredstorage over the network.

Red Hat Enterprise Linux 7 includes native support for disk images on GlusterFS. Thisenables a KVM host to boot virtual machine images from GlusterFS volumes, and to useimages from a GlusterFS volume as data disks for virtual machines. When compared toGlusterFS FUSE, the native support in KVM delivers higher performance.

Note

For more information on storage and virtualization, refer to the Red Hat Enterprise Linux 7Virtualization Deployment and Administration Guide.

Virt ualizat ion Get t ing St art ed Guide

18

Page 23: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Chapter 4. Virtualization Tools

This chapter provides an introduction to the many tools available to assist with virtualization.

4.1. virsh

virsh is a command-line interface (CLI) tool for managing the hypervisor and guest virtual machines.The virsh command-line tool is built on the l ibvirt management API and operates as an alternativeto the qemu-kvm command and the graphical virt -manager application. The virsh command canbe used in read-only mode by unprivileged users or, with root access, full administrativefunctionality. The virsh command is ideal for scripting virtualization administration. In addition the virsh tool is a main management interface for virsh guest domains and can be used to create,pause, and shut down domains, as well as list current domains. This tool is installed as part of thelibvirt-client package.

Note

Refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for moreinformation about managing virtual machines with virsh.

4.2. virt-manager

virt-manager is a lightweight graphical tool for managing virtual machines. It provides the ability tocontrol the life cycle of existing machines, provision new machines, manage virtual networks, accessthe graphical console of virtual machines, and view performance statistics. This tool is provided byits own package called virt-manager.

Note

Refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for moreinformation about managing virtual machines with virt-manager.

4.3. virt-install

virt-install is a command-line tool to provision new virtual machines. It supports both text-based andgraphical installations, using serial console, SPICE, or VNC client/server pair graphics. Installationmedia can be local, or exist remotely on an NFS, HTTP, or FTP server. The tool can also beconfigured to run unattended and use the kickstart method to prepare the guest, allowing for easyautomation of installation. This tool is included in the virt-install package.

Note

Refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for moreinformation about using virt-install .

Chapt er 4 . Virt ualizat ion T ools

19

Page 24: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

4.4 . guestfish

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 guestfs API.

Warning

Using guestfish on running virtual machines can cause disk-image corruption. Use the guestfish command with the --ro (read-only) option if the disk image is being used by arunning virtual machine.

Note

Refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for moreinformation about guestfish.

4.5. GNOME Boxes

Boxes is a lightweight graphical desktop virtualization tool used to view and access virtual machinesand remote systems. Boxes provides a way to test different operating systems and applications fromthe desktop with minimal configuration. Virtual systems can be installed manually or with the expressinstallation function, which automatically pre-configures virtual machines with optimal settings. Thistool is provided by its own package called gnome-boxes.

Note

Refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for moreinformation about using GNOME Boxes .

4.6. Other useful tools

The following tools are used to access a guest virtual machine's disk via the host. The guest's disk isusually accessed directly via the disk-image file located on the host. However, it is sometimespossible to gain access via the l ibvirt domain. The commands that follow are part of the l ibvirtdomain and are used to access the guest's disk image.

guestmount

A command-line tool used to mount virtual machine file systems and disk images on thehost machine. This tool is installed as part of the libguestfs-tools-c package.

Virt ualizat ion Get t ing St art ed Guide

20

Page 25: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Warning

Using guestmount in --rw (read/write) mode to access a disk that is currently beingused by a guest can cause the disk to become corrupted. Do not use guestmountin --rw (read/write) mode on live virtual machines. Use the guestmount commandwith the --ro (read-only) option if the disk image is being used.

virt-builder

A command-line tool for quickly building and customizing new virtual machines. This toolis installed in Red Hat Enterprise Linux 7.1 and later as part of the libguestfs-tools package.

virt-cat

A command-line tool that can be used to quickly view the contents of one or more files in aspecified virtual machine's disk or disk image. This tool is installed as part of the libguestfs-tools package.

virt-customize

A command-line tool for customizing virtual machine disk images. virt-customize can beused to install packages, edit configuration files, run scripts, and set passwords. This toolis installed in Red Hat Enterprise Linux 7.1 and later as part of the libguestfs-tools package.

virt-df

A command-line tool used to show the actual physical disk usage of virtual machines,similar to the command-line tool df. Note that this tool does not work across remoteconnections. It is installed as part of the libguestfs-tools package.

virt-diff

A command-line tool for showing differences between the file systems of two virtualmachines, for example, to discover which files have changed between snapshots. This toolis installed in Red Hat Enterprise Linux 7.1 and later as part of the libguestfs-tools package.

virt-edit

A command-line tool used to edit files that exist on a specified virtual machine. This tool isinstalled as part of the libguestfs-tools package.

Warning

Using virt-edit on live virtual machines can cause disk corruption in the virtualmachine. Although the virt-edit command will try to prevent users from editingfiles on live virtual machines, it is not guaranteed to catch all instances. Do not use virt-edit on a live virtual machine.

virt-filesystems

A command-line tool used to discover file systems, partitions, logical volumes and theirsizes in a disk image or virtual machine. One common use is in shell scripts, to iterate overall file systems in a disk image. This tool is installed as part of the libguestfs-tools package.

This tool replaces virt-list-filesystems and virt-list-partitions.

Chapt er 4 . Virt ualizat ion T ools

21

Page 26: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

virt-inspector

A command-line tool that can examine a virtual machine or disk image to determine theversion of its operating system and other information. It can also produce XML output,which can be piped into other programs. Note that virt-inspector can only inspect onedomain at a time. This tool is installed as part of the libguestfs-tools package.

virt-log

A command-line tool for listing log files from virtual machines. This tool is installed in RedHat Enterprise Linux 7.1 and later as part of the libguestfs-tools package.

virt-ls

A command-line tool that lists files and directories inside a virtual machine. This tool isinstalled as part of the libguestfs-tools package.

virt-make-fs

A command-line tool for creating a file system based on a tar archive or files in a directory.It is similar to tools like mkisofs and mksquashfs, but it can create common file systemtypes such as ext2, ext3 and NTFS, and the size of the file system created can be equal toor greater than the size of the files it is based on. This tool is provided as part of thelibguestfs-tools package.

virt-rescue

A command-line tool that provides a rescue shell and some simple recovery tools forunbootable virtual machines and disk images. It can be run on any virtual machine knownto l ibvirt , or directly on disk images. This tool is installed as part of the libguestfs-toolspackage.

Warning

Using virt-rescue on running virtual machines can cause disk corruption in thevirtual machine. virt-rescue attempts to prevent its own use on running virtualmachines, 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 virt-rescue on a running virtual machine.

virt-resize

A command-line tool to resize virtual machine disks, and resize or delete any partitions ona virtual machine disk. It works by copying the guest image and leaving the original diskimage untouched. This tool is installed as part of the libguestfs-tools package.

Important

Using virt-resize on running virtual machines can give inconsistent results. It isrecommended to shut down virtual machines before attempting to resize them.

virt-sparsify

A command-line tool to make a virtual machine disk (or any disk image) thin-provisioned.

Virt ualizat ion Get t ing St art ed Guide

22

Page 27: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

A command-line tool to make a virtual machine disk (or any disk image) thin-provisioned.The tool can convert free space in the disk image to free space on the host.

virt-sysprep

A command-line tool to reset, customize, or unconfigure virtual machines to prepare atemplate for creating clones. This tool is installed as part of the libguestfs-tools package.

Important

Virtual machines must be shut down before running virt-sysprep. To preserve avirtual machine's existing contents, snapshot, copy or clone the disk before running virt-sysprep.

virt-tar-in

A command-line archive tool for unpacking an uncompressed tarball into a virtual machinedisk image or specified libvirt domain. This tool is installed as part of the libguestfs-toolspackage.

Warning

Using virt-tar-in command on a live virtual machine can cause disk corruptionin the virtual machine. The virtual machine must be shut down before using thiscommand.

virt-tar-out

A command-line archive tool for packing a virtual machine disk image directory into atarball. This tool is installed as part of the libguestfs-tools package.

virt-top

A command-line utility similar to top, which shows statistics related to virtualized domains.This tool is contained in its own package: virt-top.

virt-v2v

A command-line tool for converting virtual machines from a foreign hypervisor to run onKVM managed by libvirt, on Red Hat Enterprise Linux OpenStack Platform, or on Red HatEnterprise Virtualization. Currently, virt-v2v can convert Red Hat Enterprise Linux andWindows guests running on Xen and VMware ESX. The virt-v2v tool is installed in Red HatEnterprise Linux 7.1 and later as part of the libguestfs package.

virt-viewer

A minimal tool for displaying the graphical console of a virtual machine via the VNC andSPICE protocols. This tool is provided by its own package: virt-viewer.

virt-what

A shell script that detects whether a program is running in a virtual machine. This tool isprovided by its own package: virt-what.

virt-who

Chapt er 4 . Virt ualizat ion T ools

23

Page 28: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

The virt-who package is a Red Hat Enterprise Linux host agent that queries l ibvirt for guestUUIDs. It then passes that data to the local entitlement server for the purposes of issuingcertificates. This tool is provided by its own package: virt-who.

virt-xml-validate

A command-line tool to validate l ibvirt XML files for compliance with the published schema.This tool is installed as part of the libvirt-client package.

Virt ualizat ion Get t ing St art ed Guide

24

Page 29: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Chapter 5. Quick Start Guide to Virtualization in Red HatEnterprise Linux 7

This chapter provides instructions for installing the basic form of virtualization in Red Hat EnterpriseLinux 7.

The chapter begins with an outline of the minimum system specifications and required packages touse virtualization. After these basic packages are installed, follow the procedure in Section 5.2.2,“Creating a virtual machine with Virtual Machine Manager” to create a basic virtual machine onVirtual Machine Manager.

Note

This tutorial uses Virtual Machine Manager to quickly create a virtual machine to try out KVMvirtualization. To set up virtual machines with the capabilities necessary for a productionenvironment, refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and AdministrationGuide for detailed information about system requirements and recommendations for runningvirtual machines.

5.1. Basic requirements and setup

To set up a KVM virtual machine on Red Hat Enterprise 7, your system must meet several criteria:

Architecture

On certain architectures, KVM virtualization is not supported with Red Hat Enterprise Linux7. Notably, these include IBM Power Systems.

Disk space and RAM

For virtualization to work on your system, you require at minimum:

6 GB free disk space;

2 GB of RAM.

Required packages for virtualiz at ion

Before you can use virtualization, a basic set of virtualization packages must be installedon your computer. The virtualization packages can be installed either during the hostinstallation sequence, or after host installation using the yum command and the Red HatCustomer Portal.

To install the packages, your host machine must be registered and subscribed to the RedHat Customer Portal. To register via Red Hat Subscription Manager, run the subscription-manager register command and follow the prompts. Alternatively, runthe Red Hat Subscription Manager application from Applicat ions → System Tools onthe desktop to register.

If you do not have a valid Red Hat subscription, visit the Red Hat online store to obtain one.For more information on registering and subscribing a system to the Red Hat CustomerPortal, see https://access.redhat.com/solutions/253273.

Procedure 5.1. Installing the virtualiz at ion packages with yum

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 7

25

Page 30: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

To use virtualization on Red Hat Enterprise Linux, you require at minimum the qemu-kvm, qemu-img , and libvirt packages. These provide the user-level KVM emulator, diskimage manager, and virtualization management tools on the host Red Hat Enterprise Linuxsystem

1. Install the qemu-kvm and qemu-img packages with the following command:

# yum install qemu-kvm qemu-img

2. Install the virt-manager package with the following command:

# yum install virt-manager

3. Additionally, for this tutorial, download a Red Hat Enterprise Linux 7 ISO image toyour system to create the guest virtual machine's operating system.

Red Hat Enterprise Linux ISO files can be found on the Red Hat Customer Portal athttps://access.redhat.com/downloads/.

5.2. Deploying a virtual machine with Virtual Machine Manager

The Virtual Machine Manager, also known as virt -manager, is a graphical tool for quicklydeploying virtual machines in Red Hat Enterprise Linux. In this tutorial, you will become familiar withits basic functions, and will be able to use Virtual Machine Manager to create a virtual machine.

5.2.1. Int roduct ion to Virtual Machine Manager

Open the Virtual Machine Manager application from the Applicat ions menu and System Toolssubmenu.

The following image shows the Virtual Machine Manager interface. This interface allows you tocontrol all of your virtual machines from one central location:

Virt ualizat ion Get t ing St art ed Guide

26

Page 31: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.1. The Virtual Machine Manager in terface

Commonly-used functions include:

Create new virtual machine: Start here to create a new virtual machine.

Virtual machines: A list of all virtual machines, or guests. When a virtual machine iscreated, it will be listed here. When a guest is running, an animated graph shows the guest's CPUusage under CPU usage.

After selecting a virtual machine from this list, use the following buttons to control the selectedvirtual machine's state:

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 7

27

Page 32: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Open: Opens the guest virtual machine console and details in a new window.

Run: Turns on the virtual machine.

Pause: Pauses the virtual machine.

Shut down: Shuts down the virtual machine. Clicking on the arrow displays adropdown menu with several options for turning off the virtual machine, including Reboot,Shut Down, Force Reset, Force Off, and Save.

Right-clicking on a virtual machine shows a menu with more functions, including:

Clone: Clones the virtual machine.

Migrate: Migrates the virtual machine to another host.

Delete: Deletes the virtual machine.

5.2.2. Creat ing a virtual machine with Virtual Machine Manager

Follow these steps to create a Red Hat Enterprise Linux 7 virtual machine on Virtual MachineManager.

Procedure 5.2. Creat ing a guest virtual machine with Virtual Machine Manager

1. Open Virtual Machine Manager

Launch the Virtual Machine Manager application from the Applicat ions menu andSystem Tools submenu.

2. Create a new virtual machine

Click the Create a new virtual machine button (Figure 5.2, “The Create a new virtualmachine button” ) to open the New VM wizard.

Figure 5.2. The Create a new virtual machine but ton

3. Specify the installat ion method

Start the creation process by choosing the method of installing the new virtual machine.

Virt ualizat ion Get t ing St art ed Guide

28

Page 33: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.3. Select the installat ion method

For this tutorial, select Local install media (ISO image). This installation methoduses an image of an installation disk (for example, an .iso file). Click the Forward button tocontinue.

4. Locate installat ion media

Provide the location of the ISO that the guest virtual machine will install the operating systemfrom.

For this example, locate the ISO downloaded in Procedure 5.1, “ Installing the virtualizationpackages with yum” on your machine by using the Browse to provide the existing storagepath.

Select the OS type and Version of the installation, ensuring that you select the appropriateOS type for your virtual machine. For this example, select Linux from the dropdown in OStype and choose Red Hat Enterprise Linux 7 from the dropdown in Version , andclick the Forward button. Note that you can also let the Virtual Machine Managerautomatically detect the operating system by clicking the respective checkbox.

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 7

29

Page 34: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.4 . Local ISO image installat ion

5. Conf igure memory and CPU

Select the amount of memory and the number of CPUs to allocate to the virtual machine. Thewizard shows the number of CPUs and amount of memory available to allocate.

For this tutorial, select the default settings and click the Forward button.

Virt ualizat ion Get t ing St art ed Guide

30

Page 35: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.5. Conf iguring CPU and Memory

6. Conf igure storage

Assign storage to the guest virtual machine. The wizard shows options for storage, includingwhere to store the virtual machine on the host machine. For this tutorial, select the defaultsettings and click the Forward button.

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 7

31

Page 36: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.6 . Conf iguring storage

7. Naming and f inal overview

Finally, select a name for the virtual machine, verify the settings, and click the Finish button.Virtual Machine Manager will then create a virtual machine with your specified hardwaresettings.

Virt ualizat ion Get t ing St art ed Guide

32

Page 37: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.7. Naming and verif icat ion

After Virtual Machine Manager has created your Red Hat Enterprise Linux 7 virtual machine, followthe instructions in the Red Hat Enterprise Linux 7 installer to complete the installation of the virtualmachine's operating system.

Note

For help with Red Hat Enterprise Linux 7 installation, refer to the Red Hat Enterprise Linux 7Installation Guide.

5.2.3. Exploring the guest virtual machine

You can view a virtual machine's console by selecting a virtual machine in the Virtual MachineManager window and clicking Open. You can operate your Red Hat Enterprise Linux 7 virtualmachine from the console in the same way as a physical system.

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 7

33

Page 38: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Figure 5.8. The guest virtual machine console

Show the graphical console: This shows what is on the virtual machine's screen.The virtual machine can be operated the same as a physical machine from the console.

Show virtual hardware details: This window shows details of the virtual hardwarethat the guest is using. It provides an overview of basic system details, performance, processor,memory, and boot settings, plus details of the system's virtual devices.

These buttons control the virtual machine's state:

Run: Turns on the virtual machine.

Pause: Pauses the virtual machine.

Shut down: Shuts down the virtual machine. Clicking on the arrow displays adropdown menu with several options for turning off the virtual machine, including Reboot,Shut Down, Force Reset, Force Off, and Save.

Virt ualizat ion Get t ing St art ed Guide

34

Page 39: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Full screen: Switches the virtual machine to full screen view.

Send Key: Sends key combinations such as Ctrl+Alt+Backspace, Ctrl+Alt+Delete,Ctrl+Alt+F1, PrintScreen, and more to the virtual machine.

Note

Refer to the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for moreinformation about using the Virtual Machine Manager to create and run virtual machines.

Chapt er 5. Quick St art Guide t o Virt ualizat ion in Red Hat Ent erprise Linux 7

35

Page 40: Virtualization Getting Started Guidemirror.aminidc.com/redhat/RHEL_7.2/Docs/Red_Hat_Enterprise_Linu… · Red Hat Enterprise Linux 7 Virtualization Getting Started Guide An introduction

Appendix A. Revision History

Revision 1.0-4 5 Thu Nov 12 2015 Laura NovichPreparing document for 7.2 GA publication.

Revision 1.0-4 4 Thu Nov 12 2015 Laura NovichPreparing document for 7.2 GA publication.

Revision 1.0-4 3 Thu Oct 08 2015 Jiri HerrmannCleaned up the Revision History

Revision 1.0-4 2 Sun Jun 28 2015 Jiri HerrmannUpdated for the 7.2 beta release

Virt ualizat ion Get t ing St art ed Guide

36