Red Hat Enterprise Linux 6

Virtualization Administration Guide

Managing your virtual environment

Jiri Herrmann

Red Hat Customer Content Services

Yehuda Zimmerman

Red Hat Customer Content Services

Laura Novich

Red Hat Customer Content Services

Scott Radvan

Red Hat Customer Content Services

Dayle Parker

Red Hat Customer Content Services

Legal Notice

Copyright © 2016 Red Hat, Inc.
This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries 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 other trademarks are the property of their respective owners.


The Virtualization Administration Guide covers administration of host physical machines, networking, storage, device and guest virtual machine management, and troubleshooting.
Note: This document is under development, is subject to substantial change, and is provided only as a preview. The included information and instructions should not be considered complete, and should be used with caution.


To expand your expertise, you might also be interested in the Red Hat Enterprise Virtualization (RH318) training course.
1. Server Best Practices
2. Security for Virtualization
2.1. Storage Security Issues
2.2. SELinux and Virtualization
2.3. SELinux
2.4. Virtualization Firewall Information
3. sVirt
3.1. Security and Virtualization
3.2. sVirt Labeling
4. KVM Live Migration
4.1. Live Migration Requirements
4.2. Live Migration and Red Hat Enterprise Linux Version Compatibility
4.3. Shared Storage Example: NFS for a Simple Migration
4.4. Live KVM Migration with virsh
4.4.1. Additional Tips for Migration with virsh
4.4.2. Additional Options for the virsh migrate Command
4.5. Migrating with virt-manager
5. Remote Management of Guests
5.1. Remote Management with SSH
5.2. Remote Management Over TLS and SSL
5.3. Transport Modes
6. Overcommitting with KVM
6.1. Introduction
6.2. Overcommitting Virtualized CPUs
7. KSM
8. Advanced Guest Virtual Machine Administration
8.1. Control Groups (cgroups)
8.2. Huge Page Support
8.3. Running Red Hat Enterprise Linux as a Guest Virtual Machine on a Hyper-V Hypervisor
8.4. Guest Virtual Machine Memory Allocation
8.5. Automatically Starting Guest Virtual Machines
8.6. Disable SMART Disk Monitoring for Guest Virtual Machines
8.7. Configuring a VNC Server
8.8. Generating a New Unique MAC Address
8.8.1. Another Method to Generate a New MAC for Your Guest Virtual Machine
8.9. Improving Guest Virtual Machine Response Time
8.10. Virtual Machine Timer Management with libvirt
8.10.1. timer Child Element for clock
8.10.2. track
8.10.3. tickpolicy
8.10.4. frequency, mode, and present
8.10.5. Examples Using Clock Synchronization
8.11. Using PMU to Monitor Guest Virtual Machine Performance
8.12. Guest Virtual Machine Power Management
9. Guest virtual machine device configuration
9.1. PCI Devices
9.1.1. Assigning a PCI Device with virsh
9.1.2. Assigning a PCI Device with virt-manager
9.1.3. PCI Device Assignment with virt-install
9.1.4. Detaching an Assigned PCI Device
9.1.5. Creating PCI Bridges
9.1.6. PCI Passthrough
9.1.7. Configuring PCI Assignment (Passthrough) with SR-IOV Devices
9.1.8. Setting PCI Device Assignment from a Pool of SR-IOV Virtual Functions
9.2. USB Devices
9.2.1. Assigning USB Devices to Guest Virtual Machines
9.2.2. Setting a Limit on USB Device Redirection
9.3. Configuring Device Controllers
9.4. Setting Addresses for Devices
9.5. Managing Storage Controllers in a Guest Virtual Machine
9.6. Random Number Generator (RNG) Device
10. QEMU-img and QEMU Guest Agent
10.1. Using qemu-img
10.2. QEMU Guest Agent
10.2.1. Install and Enable the Guest Agent
10.2.2. Setting up Communication between Guest Agent and Host
10.2.3. Using the QEMU Guest Agent
10.2.4. Using the QEMU Guest Agent with libvirt
10.2.5. Creating a Guest Virtual Machine Disk Backup
10.3. Running the QEMU Guest Agent on a Windows Guest
10.3.1. Using libvirt Commands with the QEMU Guest Agent on Windows Guests
10.4. Setting a Limit on Device Redirection
10.5. Dynamically Changing a Host Physical Machine or a Network Bridge that is Attached to a Virtual NIC
11. Storage Concepts
11.1. Storage Pools
11.2. Volumes
12. Storage Pools
12.1. Disk-based Storage Pools
12.1.1. Creating a Disk-based Storage Pool Using virsh
12.1.2. Deleting a Storage Pool Using virsh
12.2. Partition-based Storage Pools
12.2.1. Creating a Partition-based Storage Pool Using virt-manager
12.2.2. Deleting a Storage Pool Using virt-manager
12.2.3. Creating a Partition-based Storage Pool Using virsh
12.2.4. Deleting a Storage Pool Using virsh
12.3. Directory-based Storage Pools
12.3.1. Creating a Directory-based Storage Pool with virt-manager
12.3.2. Deleting a Storage Pool Using virt-manager
12.3.3. Creating a Directory-based Storage Pool with virsh
12.3.4. Deleting a Storage Pool Using virsh
12.4. LVM-based Storage Pools
12.4.1. Creating an LVM-based Storage Pool with virt-manager
12.4.2. Deleting a Storage Pool Using virt-manager
12.4.3. Creating an LVM-based Storage Pool with virsh
12.4.4. Deleting a Storage Pool Using virsh
12.5. iSCSI-based Storage Pools
12.5.1. Configuring a Software iSCSI Target
12.5.2. Adding an iSCSI Target to virt-manager
12.5.3. Deleting a Storage Pool Using virt-manager
12.5.4. Creating an iSCSI-based Storage Pool with virsh
12.5.5. Deleting a Storage Pool Using virsh
12.6. NFS-based Storage Pools
12.6.1. Creating an NFS-based Storage Pool with virt-manager
12.6.2. Deleting a Storage Pool Using virt-manager
12.7. GlusterFS Storage Pools
12.8. Using an NPIV Virtual Adapter (vHBA) with SCSI Devices
12.8.1. Creating a vHBA
12.8.2. Creating a Storage Pool Using the vHBA
12.8.3. Configuring the Virtual Machine to Use a vHBA LUN
12.8.4. Destroying the vHBA Storage Pool
13. Volumes
13.1. Creating Volumes
13.2. Cloning Volumes
13.3. Adding Storage Devices to Guests
13.3.1. Adding File-based Storage to a Guest
13.3.2. Adding Hard Drives and Other Block Devices to a Guest
13.4. Deleting and Removing Volumes
14. Managing guest virtual machines with virsh
14.1. Generic Commands
14.1.1. help
14.1.2. quit and exit
14.1.3. version
14.1.4. Argument Display
14.1.5. connect
14.1.6. Displaying Basic Information
14.1.7. Injecting NMI
14.2. Attaching and Updating a Device with virsh
14.3. Attaching Interface Devices
14.4. Changing the Media of a CDROM
14.5. Domain Commands
14.5.1. Configuring a Domain to be Started Automatically at Boot
14.5.2. Connecting the Serial Console for the Guest Virtual Machine
14.5.3. Defining a Domain with an XML File
14.5.4. Editing and Displaying a Description and Title of a Domain
14.5.5. Displaying Device Block Statistics
14.5.6. Retrieving Network Statistics
14.5.7. Modifying the Link State of a Domain's Virtual Interface
14.5.8. Listing the Link State of a Domain's Virtual Interface
14.5.9. Setting Network Interface Bandwidth Parameters
14.5.10. Retrieving Memory Statistics for a Running Domain
14.5.11. Displaying Errors on Block Devices
14.5.12. Displaying the Block Device Size
14.5.13. Displaying the Block Devices Associated with a Domain
14.5.14. Displaying Virtual Interfaces Associated with a Domain
14.5.15. Using blockcommit to Shorten a Backing Chain
14.5.16. Using blockpull to Shorten a Backing Chain
14.5.17. Using blockresize to Change the Size of a Domain Path
14.5.18. Disk Image Management with Live Block Copy
14.5.19. Displaying a URI for Connection to a Graphical Display
14.5.20. Domain Retrieval Commands
14.5.21. Converting QEMU Arguments to Domain XML
14.5.22. Creating a Dump File of a Domain's Core
14.5.23. Creating a Virtual Machine XML Dump (Configuration File)
14.5.24. Creating a Guest Virtual Machine from a Configuration File
14.6. Editing a Guest Virtual Machine's configuration file
14.6.1. Adding Multifunction PCI Devices to KVM Guest Virtual Machines
14.6.2. Stopping a Running Domain to Restart It Later
14.6.3. Displaying CPU Statistics for a Specified Domain
14.6.4. Saving a Screenshot
14.6.5. Sending a Keystroke Combination to a Specified Domain
14.6.6. Sending Process Signal Names to Virtual Processes
14.6.7. Displaying the IP Address and Port Number for the VNC Display
14.7. NUMA Node Management
14.7.1. Displaying Node Information
14.7.2. Setting NUMA Parameters
14.7.3. Displaying the Amount of Free Memory in a NUMA Cell
14.7.4. Displaying a CPU List
14.7.5. Displaying CPU Statistics
14.7.6. Suspending the Host Physical Machine
14.7.7. Setting and Displaying the Node Memory Parameters
14.7.8. Creating Devices on Host Nodes
14.7.9. Detaching a Node Device
14.7.10. Retrieving a Device's Configuration Settings
14.7.11. Listing Devices on a Node
14.7.12. Triggering a Reset for a Node
14.8. Starting, Suspending, Resuming, Saving, and Restoring a Guest Virtual Machine
14.8.1. Starting a Defined Domain
14.8.2. Suspending a Guest Virtual Machine
14.8.3. Suspending a Running Domain
14.8.4. Waking Up a Domain from a pmsuspend State
14.8.5. Undefining a Domain
14.8.6. Resuming a Guest Virtual Machine
14.8.7. Save a Guest Virtual Machine
14.8.8. Updating the Domain XML File that will be Used for Restoring the Guest
14.8.9. Extracting the Domain XML File
14.8.10. Edit Domain XML Configuration Files
14.8.11. Restore a Guest Virtual Machine
14.9. Shutting Down, Rebooting, and Forcing Shutdown of a Guest Virtual Machine
14.9.1. Shutting Down a Guest Virtual Machine
14.9.2. Shutting Down Red Hat Enterprise Linux 6 Guests on a Red Hat Enterprise Linux 7 Host
14.9.3. Manipulating the libvirt-guests Configuration Settings
14.9.4. Rebooting a Guest Virtual Machine
14.9.5. Forcing a Guest Virtual Machine to Stop
14.9.6. Resetting a Virtual Machine
14.10. Retrieving Guest Virtual Machine Information
14.10.1. Getting the Domain ID of a Guest Virtual Machine
14.10.2. Getting the Domain Name of a Guest Virtual Machine
14.10.3. Getting the UUID of a Guest Virtual Machine
14.10.4. Displaying Guest Virtual Machine Information
14.11. Storage Pool Commands
14.11.1. Searching for a Storage Pool XML
14.11.2. Creating, Defining, and Starting Storage Pools
14.11.3. Stopping and Deleting Storage Pools
14.11.4. Creating an XML Dump File for a Storage Pool
14.11.5. Editing the Storage Pool's Configuration File
14.11.6. Converting Storage Pools
14.12. Storage Volume Commands
14.12.1. Creating Storage Volumes
14.12.2. Deleting Storage Volumes
14.12.3. Dumping Storage Volume Information to an XML File
14.12.4. Listing Volume Information
14.12.5. Retrieving Storage Volume Information
14.12.6. Uploading and Downloading Storage Volumes
14.12.7. Re-sizing Storage Volumes
14.13. Displaying Per-guest Virtual Machine Information
14.13.1. Displaying the Guest Virtual Machines
14.13.2. Displaying Virtual CPU Information
14.13.3. Configuring Virtual CPU Affinity
14.13.4. Displaying Information about the Virtual CPU Counts of a Domain
14.13.5. Configuring Virtual CPU Affinity
14.13.6. Configuring Virtual CPU Count
14.13.7. Configuring Memory Allocation
14.13.8. Changing the Memory Allocation for the Domain
14.13.9. Displaying Guest Virtual Machine Block Device Information
14.13.10. Displaying Guest Virtual Machine Network Device Information
14.14. Managing Virtual Networks
14.15. Migrating Guest Virtual Machines with virsh
14.15.1. Interface Commands
14.15.2. Managing Snapshots
14.16. Guest Virtual Machine CPU Model Configuration
14.16.1. Introduction
14.16.2. Learning about the Host Physical Machine CPU Model
14.16.3. Determining a Compatible CPU Model to Suit a Pool of Host Physical Machines
14.17. Configuring the Guest Virtual Machine CPU Model
14.18. Managing Resources for Guest Virtual Machines
14.19. Setting Schedule Parameters
14.20. Display or Set Block I/O Parameters
14.21. Configuring Memory Tuning
14.22. Virtual Networking Commands
14.22.1. Autostarting a Virtual Network
14.22.2. Creating a Virtual Network from an XML File
14.22.3. Defining a Virtual Network from an XML File
14.22.4. Stopping a Virtual Network
14.22.5. Creating a Dump File
14.22.6. Editing a Virtual Network's XML Configuration File
14.22.7. Getting Information about a Virtual Network
14.22.8. Listing Information about a Virtual Network
14.22.9. Converting a Network UUID to Network Name
14.22.10. Starting a (Previously Defined) Inactive Network
14.22.11. Undefining the Configuration for an Inactive Network
14.22.12. Converting a Network Name to Network UUID
14.22.13. Updating an Existing Network Definition File
15. Managing Guests with the Virtual Machine Manager (virt-manager)
15.1. Starting virt-manager
15.2. The Virtual Machine Manager Main Window
15.3. The Virtual Hardware Details Window
15.3.1. Attaching USB Devices to a Guest Virtual Machine
15.4. Virtual Machine Graphical Console
15.5. Adding a Remote Connection
15.6. Displaying Guest Details
15.7. Performance Monitoring
15.8. Displaying CPU Usage for Guests
15.9. Displaying CPU Usage for Hosts
15.10. Displaying Disk I/O
15.11. Displaying Network I/O
16. Guest Virtual Machine Disk Access with Offline Tools
16.1. Introduction
16.2. Terminology
16.3. Installation
16.4. The guestfish Shell
16.4.1. Viewing File Systems with guestfish
16.4.2. Modifying Files with guestfish
16.4.3. Other Actions with guestfish
16.4.4. Shell Scripting with guestfish
16.4.5. Augeas and libguestfs Scripting
16.5. Other Commands
16.6. virt-rescue: The Rescue Shell
16.6.1. Introduction
16.6.2. Running virt-rescue
16.7. virt-df: Monitoring Disk Usage
16.7.1. Introduction
16.7.2. Running virt-df
16.8. virt-resize: Resizing Guest Virtual Machines Offline
16.8.1. Introduction
16.8.2. Expanding a Disk Image
16.9. virt-inspector: Inspecting Guest Virtual Machines
16.9.1. Introduction
16.9.2. Installation
16.9.3. Running virt-inspector
16.10. virt-win-reg: Reading and Editing the Windows Registry
16.10.1. Introduction
16.10.2. Installation
16.10.3. Using virt-win-reg
16.11. Using the API from Programming Languages
16.11.1. Interaction with the API via a C Program
16.12. virt-sysprep: Resetting Virtual Machine Settings
16.13. Troubleshooting
16.14. Where to Find Further Documentation
17. Using Simple Tools for Guest Virtual Machine Management
17.1. Using virt-viewer
17.2. remote-viewer
18. Virtual Networking
18.1. Virtual Network Switches
18.2. Bridged Mode
18.3. Network Address Translation Mode
18.3.1. DNS and DHCP
18.4. Routed Mode
18.5. Isolated Mode
18.6. The Default Configuration
18.7. Examples of Common Scenarios
18.7.1. Bridged Mode
18.7.2. Routed Mode
18.7.3. NAT Mode
18.7.4. Isolated Mode
18.8. Managing a Virtual Network
18.9. Creating a Virtual Network
18.10. Attaching a Virtual Network to a Guest
18.11. Attaching Directly to a Physical Interface
18.12. Applying Network Filtering
18.12.1. Introduction
18.12.2. Filtering Chains
18.12.3. Filtering Chain Priorities
18.12.4. Usage of Variables in Filters
18.12.5. Automatic IP Address Detection and DHCP Snooping
18.12.6. Reserved Variables
18.12.7. Element and Attribute Overview
18.12.8. References to Other Filters
18.12.9. Filter Rules
18.12.10. Supported Protocols
18.12.11. Advanced Filter Configuration Topics
18.12.12. Limitations
18.13. Creating Tunnels
18.13.1. Creating Multicast Tunnels
18.13.2. Creating TCP Tunnels
18.14. Setting vLAN Tags
18.15. Applying QoS to Your Virtual Network
19. qemu-kvm Commands, Flags, and Arguments
19.1. Introduction
19.2. Basic Options
19.3. Disk Options
19.4. Display Options
19.5. Network Options
19.6. Device Options
19.7. Linux/Multiboot Boot
19.8. Expert Options
19.9. Help and Information Options
19.10. Miscellaneous Options
20. Manipulating the Domain XML
20.1. General Information and Metadata
20.2. Operating System Booting
20.2.1. BIOS Bootloader
20.2.2. Host Physical Machine Bootloader
20.2.3. Direct kernel boot
20.3. SMBIOS System Information
20.4. CPU Allocation
20.5. CPU Tuning
20.6. Memory Backing
20.7. Memory tuning
20.8. NUMA Node Tuning
20.9. Block I/O tuning
20.10. Resource Partitioning
20.11. CPU Model and Topology
20.11.1. Guest virtual machine NUMA topology
20.12. Events Configuration
20.13. Power Management
20.14. Hypervisor Features
20.15. Timekeeping
20.16. Devices
20.16.1. Hard Drives, Floppy Disks, CDROMs
20.16.2. Filesystems
20.16.3. Device Addresses
20.16.4. Controllers
20.16.5. Device Leases
20.16.6. Host Physical Machine Device Assignment
20.16.7. Redirected Devices
20.16.8. Smartcard Devices
20.16.9. Network Interfaces
20.16.10. Input Devices
20.16.11. Hub Devices
20.16.12. Graphical framebuffers
20.16.13. Video Devices
20.16.14. Consoles, Serial, Parallel, and Channel Devices
20.16.15. Guest Virtual Machine Interfaces
20.16.16. Channel
20.16.17. Host Physical Machine Interface
20.17. Sound Devices
20.18. Watchdog Device
20.19. Memory Balloon Device
20.20. Security Label
20.21. Example Domain XML Configuration
21. Troubleshooting
21.1. Debugging and Troubleshooting Tools
21.2. Preparing for Disaster Recovery
21.3. Creating virsh Dump Files
21.4. kvm_stat
21.5. Guest Virtual Machine Fails to Shutdown
21.6. Troubleshooting with Serial Consoles
21.7. Virtualization Log Files
21.8. Loop Device Errors
21.9. Live Migration Errors
21.10. Enabling Intel VT-x and AMD-V Virtualization Hardware Extensions in BIOS
21.11. KVM Networking Performance
21.12. Workaround for Creating External Snapshots with libvirt
21.13. Missing Characters on Guest Console with Japanese Keyboard
21.14. Verifying Virtualization Extensions
A. The Virtual Host Metrics Daemon (vhostmd)
B. Additional Resources
B.1. Online Resources
B.2. Installed Documentation
C. Revision History