Virtualization Getting Started Guide
An introduction to virtualization concepts
Abstract
Chapter 1. General Introduction to Virtualization
1.1. What is Virtualization?
- Full virtualization
- Full virtualization uses an unmodified version of the guest operating system. The guest addresses the host’s CPU using a channel created by the hypervisor. Because the guest communicates directly with the CPU, this is the fastest virtualization method.
- Paravirtualization
- Paravirtualization uses a modified guest operating system. The guest communicates with the hypervisor. The hypervisor passes the unmodified calls from the guest to the CPU and other interfaces, both real and virtual. Because the calls are routed through the hypervisor, this method is slower than full virtualization.
- Software virtualization (or emulation)
- Software virtualization uses binary translation and other emulation techniques to run unmodified operating systems. The hypervisor translates the guest calls to a format that can be used by the host system. Because all calls are translated, this method is slower than virtualization. Note that Red Hat does not support software virtualization on Red Hat Enterprise Linux.
1.2. Virtualization Solutions
- Red Hat Enterprise Linux
- The ability to create, run, and manage virtual machines, as well as a number of vitualization tools and features, are included in Red Hat Enterprise Linux 6. This solution supports a limited number of running guests per host, as well as a limited range of guest types. As such, virtualization on Red Hat Enterprise Linux can be useful for example to developers who require testing in multiple environments, or to small businesses running several servers that do not have strict uptime requirements or service-level agreements (SLAs).
- Red Hat Virtualization
- Red Hat Virtualization is based on the Kernel-based Virtual Machine (KVM) technology like virtualization on Red Hat Enterprise Linux is, but offers an enhanced array of features. Designed for enterprise-class scalability and performance, it enables management of your entire virtual infrastructure, including hosts, virtual machines, networks, storage, and users from a centralized graphical interface.Red Hat Virtualization can be used by enterprises running larger deployments or mission-critical applications. Examples of large deployments suited to Red Hat Virtualization include databases, trading platforms, and messaging systems that must run continuously without any downtime.
Note
This guide provides information about virtualization on Red Hat Enterprise Linux. For more information about Red Hat Virtualization, or to download a fully supported 60-day evaluation version, see http://www.redhat.com/en/technologies/virtualization/enterprise-virtualization
Chapter 2. Why Use Virtualization?
2.1. Virtualization Costs
- Less power
- Using virtualization negates much of the need for multiple physical platforms. This equates to less power being drawn for machine operation and cooling, resulting in reduced energy costs. The initial cost of purchasing multiple physical platforms, combined with the machines' power consumption and required cooling, is drastically cut by using virtualization.
- Less maintenance
- Provided that adequate planning is performed before migrating physical systems to virtualized ones, less time is spent maintaining them. This means less money needs to be spent on parts and labor.
- Extended life for installed software
- Older versions of software may not be able to run directly on more recent physical machines. By running older software virtually on a larger, faster system, the life of the software may be extended while taking advantage of better performance from a 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 for computer systems.
2.2. Performance
- Red Hat Enterprise Linux 6.4 and KVM recorded an industry-leading TPC-C benchmark with an IBM DB2 database running in an entirely virtualized x86 environment and delivering 88% of bare-metal performance. Due to resource demands, databases have previously been reserved for bare-metal deployments only.
- The industry standard SAP Sales and Distribution (SD) Standard Application Benchmark found that Red Hat Enterprise Linux 6.2 and KVM performs at the virtualization efficiency of 85% compared to a bare-metal system running on identical hardware.
- Red Hat Enterprise Linux 6.1 and KVM achieved record-setting virtualization performance in the SPECvirt_sc2010 benchmark recorded by the Standard Performance Evaluation Corporation (SPEC), setting the best virtual performance mark of any published SPECvirt result. The SPECvirt_sc2010 metric measures the end-to-end performance of system components in virtualized data center servers.
Note
2.3. Migration
Migration Types
- Offline migration
- An offline migration suspends the guest virtual machine, and then moves an image of the virtual machine's memory to the destination host. The virtual machine is then resumed on the destination host and the memory used by the virtual machine on the source host is freed.
- Live migration
- Live migration is the process of migrating an active virtual machine from one physical host to another. Note that this is not possible between all Red Hat Enterprise Linux releases. Consult the Virtualization Administration Guide for details.
2.3.1. Benefits of Migrating Virtual Machines
- Load balancing
- When a host machine is overloaded, one or more of its virtual machines could be migrated to other hosts using live migration. Similarly, machines that are not running and tend to overload can be migrated using offline migration.
- Upgrading or making changes to the host
- When the need arises to upgrade, add, or remove hardware devices on a host, virtual machines can be safely relocated to other hosts. This means that guests do not experience any downtime due to changes that are made to hosts.
- Energy saving
- Virtual machines can be redistributed to other hosts and the unloaded host systems can be powered off to save energy and cut costs in low usage periods.
- Geographic migration
- Virtual machines can be moved to other physical locations for lower latency or for other reasons.
Note
2.3.2. Virtualized to Virtualized Migration (V2V)
virt-v2v
tool converts and imports virtual machines from Xen, other versions of KVM, VMware ESX, and Hyper-V.
virt-v2v
tool converts and imports virtual machines with virtual disk image formats including VHDX, VMDK, OVF, raw, and qcow2.
Important
2.4. Security
2.4.1. Virtualization Security Features
Security-Enhanced Linux, or SELinux, provides Mandatory Access Control (MAC) for all Linux system, and thus benefits also Linux guests. Under the control of SELinux, all processes and files are given a type, and their access on the system is limited by fine-grained controls of various types. SELinux limits the abilities of an attacker and works to prevent many common security exploits such as buffer overflow attacks and privilege escalation.
sVirt is a technology included in Red Hat Enterprise Linux 6 that integrates SELinux and virtualization. It applies Mandatory Access Control (MAC) to improve security when using virtual machines, and improves security and hardens the system against hypervisor bugs that might be used to attack the host or another virtual machine.
Note
2.5. Disaster Recovery
Chapter 3. Introduction to Red Hat Virtualization Products and Features
3.1. KVM and Virtualization in Red Hat Enterprise Linux
virt-manager
and virsh
). Virtual machines are executed and run as multi-threaded Linux processes, controlled by these tools.
Figure 3.1. KVM architecture
- Overcommitting
- The KVM hypervisor supports overcommitting of system resources. Overcommitting means allocating more virtualized CPUs or memory than the available resources on the system, so the resources can be dynamically swapped when required by one guest and not used by another. This can improve how efficiently guests use the resources of the host, and can make it possible for the user to require fewer hosts.
Important
Overcommitting involves possible risks to system stability. For more information on overcommitting with KVM, and the precautions that should be taken, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide. - KSM
- Kernel Same-page Merging (KSM), used by the KVM hypervisor, makes it possible for KVM guests to share identical memory pages. These shared pages are usually common libraries or other identical, high-use data. KSM allows for greater guest density of identical or similar guest operating systems by avoiding memory duplication.
Note
For more information on KSM, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide. - QEMU guest agent
- The QEMU guest agent runs on the guest operating system and enables the host machine to issue commands to the guest operating system.
Note
For more information on the QEMU guest agent, refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide. - Hyper-V Enlightenment
- KVM in Red Hat Enterprise Linux 6.5 and later implements several Hyper-V compatible functions that are used by Windows guests to improve performance and stability, enabling Windows guests to perform as if they were running on a Microsoft Hyper-V hypervisor.
Note
For more information on Hyper-V Enlightenment, refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide. - KVM guest virtual machine compatibility
- Red Hat Enterprise Linux 6 servers have certain support limits.The following URLs explain the processor and memory amount limitations for Red Hat Enterprise Linux:
- For the host system: 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 Red Hat Customer Portal.Note
To verify whether your processor supports virtualization extensions and for information on enabling virtualization extensions if they are disabled, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
3.2. libvirt and libvirt Tools
- A virtualization layer to securely manage virtual machines on a host.
- An interface for managing local and networked hosts.
- The APIs required to provision, create, modify, monitor, control, migrate, and stop virtual machines. Although multiple hosts may be accessed with libvirt simultaneously, the APIs are limited to single node operations.
Note
Only operations supported by the hypervisor can be performed using libvirt.
virsh
and virt-manager
3.3. Virtualized Hardware Devices
- Virtualized and Emulated Devices
- Paravirtualized devices
- Physically shared devices
3.3.1. Virtualized and Emulated devices
- Virtual CPUs (vCPUs)
- A host system can have up to 160 virtual CPUs (vCPUs) that can be presented to guests for use, regardless of the number of host CPUs.
- 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
- Emulated storage drivers
- Storage devices and storage pools can use these emulated devices to attach storage devices to virtual machines. The guest uses an emulated storage driver to access the storage pool.Note that like all virtual devices, the storage drivers are not storage devices. The drivers are used 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 storage pool volume.
- The emulated IDE driver
- KVM provides two emulated PCI IDE interfaces. An emulated IDE driver can be used to attach any combination of up to four virtualized IDE hard disks or virtualized IDE CD-ROM drives to each virtual machine. The emulated IDE driver is also used for virtualized CD-ROM and DVD-ROM drives.
- The emulated floppy disk drive driver
- The emulated floppy disk drive driver is used for creating virtualized floppy drives.
- Emulated sound devices
- Red Hat Enterprise Linux 6.1 and above provides an emulated (Intel) HDA sound device,
intel-hda
. This device is supported on the following guest operating systems:- Red Hat Enterprise Linux 6, for the 32-bit AMD and Intel architecture, and AMD64 and Intel 64 architectures
- Red Hat Enterprise Linux 5, for i386, and the 32-bit AMD and Intel architecture and Intel 64 architectures
- Red Hat Enterprise Linux 4, for i386 and the 32-bit AMD and Intel architecture and Intel 64 architectures
- Windows 7, for i386 and AMD64 and Intel 64 architectures
- Windows 2008 R2, for the AMD64 and Intel 64 architecture
Note
The following emulated sound devices are also available, but are not recommended due to compatibility issues with certain guest operating systems:ac97
, an emulated Intel 82801AA AC97 Audio compatible sound cardes1370
, an emulated ENSONIQ AudioPCI ES1370 sound card
- Emulated graphics cards
- The following emulated graphics devices are provided:
- A Cirrus CLGD 5446 PCI VGA card
- A standard VGA graphics card with Bochs VESA extensions (hardware level, including all non-standard modes)
Guests can connect to these devices with the Simple Protocol for Independent Computing Environments (SPICE) protocol or with the Virtual Network Computing (VNC) system. - Emulated network devices
- The following emulated network devices are provided:
- The
e1000
device emulates an Intel E1000 network adapter (Intel 82540EM, 82573L, 82544GC). - The
rtl8139
device emulates a Realtek 8139 network adapter.
- Emulated watchdog devices
- Red Hat Enterprise Linux 6 provide two emulated watchdog devices. A watchdog can be used to automatically reboot a virtual machine when it becomes overloaded 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 guest operating system Red Hat Enterprise Linux versions 6.0 and above, and is the recommended device to use.ib700
, an emulated iBase 700 ISA watchdog device. Theib700
watchdog device is only supported in guests using Red Hat Enterprise Linux 6.2 and above.
Both watchdog devices are supported in the 32-bit AMD and Intel architecture and AMD64 and Intel 64 architectures for guest operating systems Red Hat Enterprise Linux 6.2 and above.
3.3.2. Paravirtualized Devices
Note
- The paravirtualized network device (virtio-net)
- The paravirtualized network device is a virtual network device that provides network access to virtual machines with increased I/O performance and lower latency.
- The paravirtualized block device (virtio-blk)
- The paravirtualized block device is a high-performance virtual storage device with that provides storage to virtual machines with increased I/O performance and lower latency. The paravirtualized block device is supported by the hypervisor and is attached to the virtual machine (except for floppy disk drives, which must be emulated).
- The paravirtualized controller device (virtio-scsi)
- The paravirtualized SCSI controller device is a new feature in Red Hat Enterprise Linux 6.4 that provides a more flexible and scalable alternative to virtio-blk. A virtio-scsi guest is capable of inheriting the feature set of the target device, and can handle hundreds of devices compared to virtio-blk, which can only handle 28 devices.In Red Hat Enterprise Linux 6.4 and above, virtio-scsi is fully supported for the following guest operating systems:
- Red Hat Enterprise Linux 6.4 and above
- Windows Server 2008
- Windows 7
- Windows Server 2012
- Windows 8 (32/64 bit)
- The paravirtualized 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 providing guests with a paravirtualized clock. Additionally, the paravirtualized clock assists with time adjustments needed after a guest runs the sleep (S3) or suspend to RAM operations.
- The paravirtualized serial device (virtio-serial)
- The paravirtualized serial device is a bytestream-oriented, character stream device, and provides a simple communication interface between the host's user space and the guest's user space.
- The balloon device (virtio-balloon)
- The balloon device can designate part of a virtual machine's RAM as not being used (a process known as inflating the balloon), so that the memory can be freed for the host (or for other virtual machines on that host) to use. When the virtual machine needs the memory again, the balloon can be deflated and the host can distribute the RAM back to the virtual machine.
- The paravirtualized graphics card (QXL)
- The paravirtualized graphics card works with the QXL driver to provide an efficient way to display a virtual machine's graphics from a remote host. The QXL driver is required to use SPICE.
3.3.3. Physical Host Devices
- PCI device assignment
- The KVM hypervisor supports attaching PCI devices on the host system to virtual machines. PCI device assignment provides guests with exclusive access to PCI devices for a range of tasks. It enables PCI devices to appear and behave as if they were physically attached to the guest virtual machine.Device assignment is supported on PCI Express devices, with the exception of graphics cards. Parallel PCI devices may be supported as assigned devices, but they have severe limitations due to security and system configuration conflicts.
Note
For more information on device assignment, refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide. - USB passthrough
- The KVM hypervisor supports attaching USB devices on the host system to virtual machines. USB device assignment makes it possible for guests to have exclusive access to USB devices for a range of tasks. It also enables USB devices to appear and behave as if they were physically attached to the virtual machine.
Note
For more information on USB passthrough, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide. - SR-IOV
- SR-IOV (Single Root I/O Virtualization) is a PCI Express standard that extends a single 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 through PCI device assignment.An SR-IOV-capable PCI-e device, provides a Single Root Function (for example, a single Ethernet port) and presents multiple, separate virtual devices as unique PCI device functions. 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 6 Virtualization Host Configuration and Guest Installation Guide. - NPIV
- N_Port ID Virtualization (NPIV) is a functionality available with some Fibre Channel devices. NPIV shares a single physical N_Port as multiple N_Port IDs. NPIV provides similar functionality for Fibre Channel Host Bus Adapters (HBAs) that SR-IOV provides for PCIe interfaces. With NPIV, virtual machines can be provided with a virtual Fibre Channel initiator to Storage Area Networks (SANs).NPIV can provide high density virtualized environments with enterprise-level storage solutions.
Note
For more information on NPIV, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
3.4. Guest CPU Models
Note
3.5. Storage
3.5.1. Storage Pools
- Local storage pools
- Local storage pools are attached directly to the host server. They include local directories, directly attached disks, physical partitions, and Logical Volume Management (LVM) volume groups on local devices. Local storage pools are useful for development, testing and small deployments that do not require migration or large numbers of virtual machines. Local storage pools may not be suitable for many production environments, because they do not support live migration.
- Networked (shared) storage pools
- Networked storage pools include storage devices shared over a network using standard protocols. Networked storage is required when migrating virtual machines between hosts with virt-manager, but is optional when migrating with
virsh
. Networked storage pools are managed by libvirt.
3.5.2. Storage Volumes
3.5.3. Emulated Storage Devices
- virtio-scsi
- virtio-scsi is the recommended paravirtualized storage device for guests using large numbers of disks, or advanced storage features such as TRIM.
- virtio-blk
- virtio-blk is a paravirtualized storage device suitable for exposing image files to guests. virtio-blk can provide the best disk I/O performance for virtual machines, but has fewer features than virtio-scsi.
- IDE
- IDE is recommended for legacy guests that do not support virtio drivers. IDE performance is lower 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 presenting ISO files or the host CD-ROM drive to guests. virtio-scsi CD-ROMs can be used with guests that have the virtio-scsi driver installed. ATAPI CD-ROMs offer wider compatibility but lower performance.
- USB mass storage devices and floppy disks
- Emulated USB mass storage devices and floppy disks are available when removable media is required. USB mass storage devices are preferable to floppy disks due to their larger capacity.
3.5.4. Host Storage
- Image files
- Image files can only be stored on a host be file system. The image files can be stored on a local file system, such as ext4 or xfs, or a network file system, such as NFS.Tools such as libguestfs can manage, back up, and monitor files. Disk image formats on KVM 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 thin provisioning. Pre-allocated files are fully provisioned but have higher performance than sparse files.Raw files are desirable when disk I/O performance is critical and transferring the image file over a network is rarely necessary.
- qcow2
- qcow2 image files offer a number of advanced disk image features, including backing files, snapshots, compression, and encryption. They can be used to instantiate virtual machines from template images.qcow2 files are typically more efficient to transfer over a network, because only sectors written by the virtual machine are allocated in the image.
- LVM volumes
- Logical volumes (LVs) can be used for disk images and managed using the system's LVM tools. LVM offers higher performance than file systems because of its simpler block storage model.LVM thin provisioning offers snapshots and efficient space usage for LVM volumes, and can be used as an alternative to migrating to qcow2.
- Host devices
- Host devices such as physical CD-ROMs, raw disks, and logical unit numbers (LUNs) can be presented to the guest. This enables a guest to use storage area network (SAN) or iSCSI LUNs, as well as local CD-ROM media, with good performance.Host devices can be used when storage management is done on a SAN instead of on hosts.
- Distributed storage systems
- Gluster volumes can be used as disk images. This enables high-performance clustered storage over the network.Red Hat Enterprise Linux 6.5 and above includes native support for creating virtual machines with GlusterFS. This enables a KVM host to boot virtual machine images from GlusterFS volumes, and to use images from a GlusterFS volume as data disks for virtual machines. When compared to GlusterFS FUSE, the native support in KVM delivers higher performance.
Note
3.6. Virtual Networking
libvirt
's virtual network configuration. The host therefore acts as a virtual network switch, which can be configured in a number of different ways to fit the guest's networking needs.
default
. Guests on this network can make the following connections:
- With each other and with the virtualization host
- Both inbound and outbound traffic is possible, but is affected by the firewalls in the guest operating system's network stack and by libvirt network filtering rules attached to the guest interface.
- With other hosts on the network beyond the virtualization host
- Only outbound traffic is possible, and is affected by Network Address Translation (NAT) rules, as well as the host system's firewall.
- Isolated mode
- The guests are connected to a network that does not allow any traffic beyond the virtualization host.
- Routed mode
- The guests are connected to a network that routes traffic between the guest and external hosts without performing any NAT. This enables incoming connections but requires extra routing-table entries for systems on the external network.
- Bridged mode
- The guests are connected to a bridge device that is also connected directly to a physical ethernet device connected to the local ethernet. This makes the guest directly visible on the physical network, and thus enables incoming connections, but does not require any extra routing-table entries.
default
network is installed along with the libvirt package, and automatically started when the libvirtd
service is started. If more advanced functionality is needed, additional networks can be created and configured using either virsh or virt-manager, and the guest XML configuration file can be edited to use one of these new networks.
Note
Chapter 4. Quick Start Tutorial on Virtualization in Red Hat Enterprise Linux 6
Note
4.1. Tutorial overview
4.2. Basic Requirements and Setup
- Architecture
- Virtualization with the KVM hypervisor is currently only supported on Intel 64 and AMD64 systems.
- Disk space and RAM
- Minimum:
- 6 GB free disk space
- 2 GB RAM
- Customer Portal subscription
- To install virtualization packages, your host machine must be registered and subscribed to the Red Hat Customer Portal. To register run the
subscription-manager register
command and follow the prompts. Alternatively, run the Red Hat Subscription Manager application from → 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 more information on registering and subscribing a system to the Red Hat Customer Portal, see https://access.redhat.com/solutions/253273. - Required packages
- Before you can use virtualization, a basic set of virtualization packages must be installed on your computer.
Procedure 4.1. Installing the virtualization packages with
yum
To use virtualization on Red Hat Enterprise Linux the libvirt, qemu-kvm and qemu-img packages must be installed. These packages provide the user-level KVM emulator and disk image manager on the host system.- Install the qemu-kvm, qemu-img, libvirt, and virt-manager packages with the following command:
# yum install qemu-kvm qemu-img libvirt virt-manager
- Download a Red Hat Enterprise Linux 7 Workstation binary DVD ISO image from the Red Hat Customer Portal. This image will be used to install the guest virtual machine's operating system.
Note
If you encounter any problems during the installation process, see the Troubleshooting section of the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide.
4.3. Creating a Virtual Machine with Virtual Machine Manager
4.3.1. Introduction to Virtual Machine Manager
virt-manager
command.
Figure 4.1. The Virtual Machine Manager interface
- Create new virtual machine: Click here to create a new virtual machine.
- Virtual machines: A list of configured connections and all guest virtual machines associated with them. When a virtual machine is created, it will be listed here. When a guest is running, an animated graph shows the guest's CPU usage in the CPU usage column.After selecting a virtual machine from this list, use the following buttons to control the selected virtual machine's state:
- 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 a drop-down menu with several options for turning off the virtual machine, including Reboot, Shut Down, Force Reset, Force Off, and Save.
- Clone: Clones the virtual machine.
- Migrate: Migrates the virtual machine to another host.
- Delete: Deletes the virtual machine.
4.3.2. Creating a Virtual Machine with Virtual Machine Manager
Procedure 4.2. Creating a guest virtual machine with Virtual Machine Manager
Open Virtual Machine Manager
Click→ →orOpen the terminal and use thevirt-manager
.Create a new virtual machine
Click to open thewizard.Specify name and installation method
In Step 1, type in a virtual machine name and choose an installation type to install the guest virtual machine's operating system.Figure 4.2. Name virtual machine and select installation method
For this tutorial, select Local install media (ISO image). This installation method uses an image of an installation disk (in this case an.iso
file). Click to continue to the next step.Locate installation media
- Select the
Use ISO Image
option. - Click→ buttons.
- Locate the ISO downloaded in Procedure 4.1, “Installing the virtualization packages with
yum
” on your machine. - Select the ISO file and click.
- Ensure that Virtual Machine Manager correctly detected the OS type. If not, uncheck
Automatically detect operating system based on install media
and select Linux from the drop-down and Red Hat Enterprise Linux 7 from the drop-down.
Figure 4.3. Local ISO image installation
Configure memory and CPU
You can use step 3 of the wizard to configure the amount of memory and the number of CPUs to allocate to the virtual machine. The wizard shows the number of CPUs and amount of memory available to allocate.For this tutorial, leave the default settings and click.Figure 4.4. Configuring CPU and Memory
Configure storage
Using step 4 of the wizard, you can assign storage to the guest virtual machine. The wizard shows options for storage, including where to store the virtual machine on the host machine. For this tutorial, leave the default settings and click.Figure 4.5. Configuring storage
Review the configuration
Using step 5 of the wizard, you can configure the virtualization type, and guest architecture, and networking settings. For this tutorial, verify the settings, and click Virtual Machine Manager will create a virtual machine with the specified hardware settings..Figure 4.6. Verifying the configuration
Note
4.3.3. Exploring the Guest Virtual Machine
Figure 4.7. The guest virtual machine console
- Show the graphical console: Shows the virtual machine's display. The virtual machine can be operated from the console the same as a physical machine.
- Show virtual hardware details: Shows details about the virtual hardware that the guest is using. These include an overview of basic system details, performance, processor, memory, and boot settings, and 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 a drop-down menu with several options for turning off the virtual machine, including Reboot, Shut Down, Force Reset, Force Off, and Save.
- 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
Chapter 5. Virtualization Tools
5.1. virsh
virsh
is built on the libvirt management API. . The virsh
command can be used in read-only mode by unprivileged users, or for full administration by users with root access. In addition, virsh
is the 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 the libvirt-client package.
Note
virsh
.
5.2. virt-manager
virsh
. It provides the ability to control the life cycle of existing machines, provision new machines, manage virtual networks, access the graphical console of virtual machines, and view performance statistics. For a demonstration of using virt-manager, see Section 4.3, “Creating a Virtual Machine with Virtual Machine Manager”. This tool is provided by the virt-manager package.
Note
virt-manager
.
5.3. virt-install
Note
virt-install
.
5.4. guestfish
guestfs
API.
Warning
guestfish
on running virtual machines may cause disk-image corruption. Use the guestfish
command with the --ro
(read-only) option if the disk image is being used by a running virtual machine.
Note
guestfish
.
5.5. Other Useful Tools
disk-image
file located on the host. The commands that follow are part of the libvirt domain and are used to gain access to the guest's disk image.
guestmount
- A command-line tool used to mount virtual machine file systems and disk images on the host machine.
Warning
Usingguestmount
in--r/w
(read/write) mode to access a disk that is currently being used by a guest may cause the disk to become corrupted. Do not useguestmount
in--r/w
(read/write) mode on live virtual machines. Use theguestmount
command with the--ro
(read-only) option if the disk image is being used. virt-cat
- A command-line tool that can be used to quickly view the contents of one or more files in a specified virtual machine's disk or disk image. This tool is installed as part of the libguestfs-tools-c 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 remote connections. It is installed as part of the libguestfs-tools-c package. virt-edit
- A command-line tool used to edit files that exist on a specified virtual machine. This tool is installed as part of the libguestfs-tools-c package.
Warning
Usingvirt-edit
on live virtual machines may cause disk corruption in the virtual machine. Although thevirt-edit
command will try to prevent users from editing files on live virtual machines, it is not guaranteed to catch all instances. Do not usevirt-edit
on a live virtual machine. virt-filesystems
- A command-line tool used to discover file systems, partitions, logical volumes and their sizes in a disk image or virtual machine. One common use is in shell scripts, to iterate over all file systems in a disk image. This tool is installed as part of the libguestfs-tools-c package.
Note
This tool replacesvirt-list-filesystems
andvirt-list-partitions
. virt-inspector
- A command-line tool that can examine a virtual machine or disk image to determine the version 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 one domain at a time. This tool is installed as part of the libguestfs-tools-c package. virt-inspector2
- An alternative tool to
virt-inspector
, written in C. This tool is installed as part of the libguestfs-tools-c package. virt-ls
- A command-line tool that lists files and directories inside a virtual machine. This tool is installed as part of the libguestfs-tools-c 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
andmksquashfs
, but it can create common file system types such as ext2, ext3 and NTFS, and the size of the file system created can be equal to or greater than the size of the files it is based on. This tool is provided as part of the libguestfs-tools package. virt-p2v
- A graphical tool to convert physical machines into virtual machines. This tool is installed as part of the virt-v2v package in Red Hat Enterprise Linux 6.2 and later.
virt-rescue
- A command-line tool that provides a rescue shell and some simple recovery tools for unbootable virtual machines and disk images. It can be run on any virtual machine known to libvirt, or directly on disk images. This tool is installed as part of the libguestfs-tools-c package.
Warning
Usingvirt-rescue
on running virtual machines may cause disk corruption in the virtual machine.virt-rescue
attempts to prevent its own use on running virtual machines, but cannot catch all cases. Using the command with the--ro
(read-only) option will not cause disk corruption, but may give strange or inconsistent results.Avoid usingvirt-rescue
on a running virtual machine. virt-resize
- A command-line tool to resize virtual machine disks, and resize or delete any partitions on a virtual machine disk. It works by copying the guest image and leaving the original disk image untouched. This tool is installed as part of the libguestfs-tools-c package.
Important
Usingvirt-resize
on running virtual machines can give inconsistent results. It is best to shut down virtual machines before attempting to resize them. virt-sysprep
- A command-line tool to reset, customize, or unconfigure virtual machines to prepare a template for creating clones. This tool is installed as part of the libguestfs-tools-c package.
Important
Virtual machines must be shut down before runningvirt-sysprep
. To preserve a virtual machine's existing contents, snapshot, copy or clone the disk before runningvirt-sysprep
. virt-tar
- A command-line archive tool for downloading and uploading parts of a virtual machine's file system. This tool is commonly used for making backups, uploading data, reviewing guest activity, and fixing or customizing guests. This tool is installed as part of the libguestfs-tools package.
Warning
Usingvirt-tar
with the-u
(upload) option on running virtual machines can cause disk corruption in the virtual machine.virt-tar
attempts to prevent its own use on running virtual machines, but cannot catch all cases.Usingvirt-tar
with the-x
(extract) option on running virtual machines will not cause disk corruption, but may give strange or inconsistent results. It is best to shut down virtual machines before attempting to extract files from them. virt-top
- A command-line utility similar to
top
, which shows statistics related to virtualized domains. This tool is provided by the virt-top package. virt-v2v
- A graphical tool to convert virtual machines from Xen and VMware hypervisors to run on KVM. This tool is provided by the virt-v2v package.
virt-viewer
- A lightweight utility for displaying the graphical console of a virtual machine using the VNC and SPICE protocols. This tool is provided by the virt-viewer package.
virt-what
- A shell script that detects whether a program is running in a virtual machine. This tool is provided by virt-what package.
virt-who
- The virt-who package is a Red Hat Enterprise Linux host agent that queries libvirt for guest UUIDs. It then passes that data to the local entitlement server for the purposes of issuing certificates. This tool is provided by the virt-who package.
Note
For further information on usingvirt-who
, see the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide. virt-win-reg
- A command-line tool to export and merge Windows Registry entries from a Windows virtual machine, and perform simple Registry operations. This tool is installed as part of the libguestfs-tools package.
Warning
Usingvirt-win-reg
on running virtual machines will cause irreversible disk corruption in the virtual machine.virt-win-reg
attempts to prevent its own use on running virtual machines, but cannot catch all cases.Warning
Modifying the Windows Registry is an inherently risky operation, as the format is deliberately obscure and undocumented. Changes to the registry can leave the system unbootable, so ensure you have a reliable backup before you use the--merge
option. virt-xml-validate
- A command-line tool to validate libvirt XML files for compliance with the published schema. This tool is installed as part of the libvirt-client package.
Appendix A. Revision History
Revision History | |||
---|---|---|---|
Revision 1.1-10 | Wed Mar 08 2017 | ||
| |||
Revision 1.1-8 | Mon December 20 2016 | ||
| |||
Revision 1.1-7 | Mon May 02 2016 | ||
| |||
Revision 1.1-6 | Tue Mar 01 2016 | ||
| |||
Revision 1.1-5 | Thu Oct 08 2015 | ||
| |||
Revision 1.1-4 | Mon Jul 13 2015 | ||
| |||
Revision 1.1-03 | Thurs Apr 16 2015 | ||
|