Red Hat Enterprise Linux 6

Virtualization Administration Guide

Managing your virtual environment

Laura Novich

Red Hat Customer Content Services

Scott Radvan

Red Hat Customer Content Services

Dayle Parker

Red Hat Customer Content Services

Legal Notice

Copyright © 2015 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, MetaMatrix, 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.
To expand your expertise, you might also be interested in the Red Hat Enterprise Virtualization (RH318) training course.
1. Introduction
1.1. Virtualization Documentation Suite
2. Server best practices
3. Security for virtualization
3.1. Storage security issues
3.2. SELinux and virtualization
3.3. SELinux
3.4. Virtualization firewall information
4. sVirt
4.1. Security and Virtualization
4.2. sVirt labeling
5. KVM live migration
5.1. Live migration requirements
5.2. Live migration and Red Hat Enterprise Linux version compatibility
5.3. Shared storage example: NFS for a simple migration
5.4. Live KVM migration with virsh
5.4.1. Additional tips for migration with virsh
5.4.2. Additional options for the virsh migrate command
5.5. Migrating with virt-manager
6. Remote management of guests
6.1. Remote management with SSH
6.2. Remote management over TLS and SSL
6.3. Transport modes
7. Overcommitting with KVM
7.1. Introduction
7.2. Overcommitting virtualized CPUs
8. KSM
9. Advanced guest virtual machine administration
9.1. Control Groups (cgroups)
9.2. Huge page support
9.3. Running Red Hat Enterprise Linux as a guest virtual machine on a Hyper-V hypervisor
9.4. Guest virtual machine memory allocation
9.5. Automatically starting guest virtual machines
9.6. Disable SMART disk monitoring for guest virtual machines
9.7. Configuring a VNC Server
9.8. Generating a new unique MAC address
9.8.1. Another method to generate a new MAC for your guest virtual machine
9.9. Improving guest virtual machine response time
9.10. Virtual machine timer management with libvirt
9.10.1. timer child element for clock
9.10.2. track
9.10.3. tickpolicy
9.10.4. frequency, mode, and present
9.10.5. Examples using clock synchronization
9.11. Using PMU to monitor guest virtual machine performance
9.12. Guest virtual machine power management
10. Guest virtual machine device configuration
10.1. PCI devices
10.1.1. Assigning a PCI device with virsh
10.1.2. Assigning a PCI device with virt-manager
10.1.3. PCI device assignment with virt-install
10.1.4. Detaching an assigned PCI device
10.1.5. Creating PCI bridges
10.1.6. PCI passthrough
10.1.7. Configuring PCI assignment (passthrough) with SR-IOV devices
10.1.8. Setting PCI device assignment from a pool of SR-IOV virtual functions
10.2. USB devices
10.2.1. Assigning USB devices to guest virtual machines
10.2.2. Setting a limit on USB device redirection
10.3. Configuring device controllers
10.4. Setting addresses for devices
10.5. Managing storage controllers in a guest virtual machine
10.6. Random number generator (RNG) device
11. QEMU-img and QEMU guest agent
11.1. Using qemu-img
11.2. QEMU guest agent
11.2.1. Install and enable the guest agent
11.2.2. Setting up communication between guest agent and host
11.2.3. Using the QEMU guest agent
11.2.4. Using the QEMU guest agent with libvirt
11.2.5. Creating a guest virtual machine disk backup
11.3. Running the QEMU guest agent on a Windows guest
11.3.1. Using libvirt commands with the QEMU guest agent on Windows guests
11.4. Setting a limit on device redirection
11.5. Dynamically changing a host physical machine or a network bridge that is attached to a virtual NIC
12. Storage concepts
12.1. Storage pools
12.2. Volumes
13. Storage pools
13.1. Disk-based storage pools
13.1.1. Creating a disk based storage pool using virsh
13.1.2. Deleting a storage pool using virsh
13.2. Partition-based storage pools
13.2.1. Creating a partition-based storage pool using virt-manager
13.2.2. Deleting a storage pool using virt-manager
13.2.3. Creating a partition-based storage pool using virsh
13.2.4. Deleting a storage pool using virsh
13.3. Directory-based storage pools
13.3.1. Creating a directory-based storage pool with virt-manager
13.3.2. Deleting a storage pool using virt-manager
13.3.3. Creating a directory-based storage pool with virsh
13.3.4. Deleting a storage pool using virsh
13.4. LVM-based storage pools
13.4.1. Creating an LVM-based storage pool with virt-manager
13.4.2. Deleting a storage pool using virt-manager
13.4.3. Creating an LVM-based storage pool with virsh
13.4.4. Deleting a storage pool using virsh
13.5. iSCSI-based storage pools
13.5.1. Configuring a software iSCSI target
13.5.2. Adding an iSCSI target to virt-manager
13.5.3. Deleting a storage pool using virt-manager
13.5.4. Creating an iSCSI-based storage pool with virsh
13.5.5. Deleting a storage pool using virsh
13.6. NFS-based storage pools
13.6.1. Creating a NFS-based storage pool with virt-manager
13.6.2. Deleting a storage pool using virt-manager
13.7. GlusterFS storage pools
13.7.1. Creating a GlusterFS storage pool using virsh
13.7.2. Deleting a GlusterFS storage pool using virsh
13.8. Using a NPIV virtual adapter (vHBA) with SCSI devices
13.8.1. Creating a vHBA
13.8.2. Creating a storage pool using the vHBA
13.8.3. Configuring the virtual machine to use a vHBA LUN
13.8.4. Destroying the vHBA storage pool
14. Volumes
14.1. Creating volumes
14.2. Cloning volumes
14.3. Adding storage devices to guests
14.3.1. Adding file based storage to a guest
14.3.2. Adding hard drives and other block devices to a guest
14.4. Deleting and removing volumes
15. Managing guest virtual machines with virsh
15.1. Generic Commands
15.1.1. help
15.1.2. quit and exit
15.1.3. version
15.1.4. Argument display
15.1.5. connect
15.1.6. Displaying basic information
15.1.7. Injecting NMI
15.2. Attaching and updating a device with virsh
15.3. Attaching interface devices
15.4. Changing the media of a CDROM
15.5. Domain Commands
15.5.1. Configuring a domain to be started automatically at boot
15.5.2. Connecting the serial console for the guest virtual machine
15.5.3. Defining a domain with an XML file
15.5.4. Editing and displaying a description and title of a domain
15.5.5. Displaying device block statistics
15.5.6. Retrieving network statistics
15.5.7. Modifying the link state of a domain's virtual interface
15.5.8. Listing the link state of a domain's virtual interface
15.5.9. Setting network interface bandwidth parameters
15.5.10. Retrieving memory statistics for a running domain
15.5.11. Displaying errors on block devices
15.5.12. Displaying the block device size
15.5.13. Displaying the block devices associated with a domain
15.5.14. Displaying virtual interfaces associated with a domain
15.5.15. Using blockcommit to shorten a backing chain
15.5.16. Using blockpull to shorten a backing chain
15.5.17. Using blockresize to change the size of a domain path
15.5.18. Disk image management with live block copy
15.5.19. Displaying a URI for connection to a graphical display
15.5.20. Domain Retrieval Commands
15.5.21. Converting QEMU arguments to domain XML
15.5.22. Creating a dump file of a domain's core
15.5.23. Creating a virtual machine XML dump (configuration file)
15.5.24. Creating a guest virtual machine from a configuration file
15.6. Editing a guest virtual machine's configuration file
15.6.1. Adding multifunction PCI devices to KVM guest virtual machines
15.6.2. Stopping a running domain in order to restart it later
15.6.3. Displaying CPU statistics for a specified domain
15.6.4. Saving a screenshot
15.6.5. Sending a keystroke combination to a specified domain
15.6.6. Sending process signal names to virtual processes
15.6.7. Displaying the IP address and port number for the VNC display
15.7. NUMA node management
15.7.1. Displaying node information
15.7.2. Setting NUMA parameters
15.7.3. Displaying the amount of free memory in a NUMA cell
15.7.4. Displaying a CPU list
15.7.5. Displaying CPU statistics
15.7.6. Suspending the host physical machine
15.7.7. Setting and displaying the node memory parameters
15.7.8. Creating devices on host nodes
15.7.9. Detaching a node device
15.7.10. Retrieving a device's configuration settings
15.7.11. Listing devices on a node
15.7.12. Triggering a reset for a node
15.8. Starting, suspending, resuming, saving and restoring a guest virtual machine
15.8.1. Starting a defined domain
15.8.2. Suspending a guest virtual machine
15.8.3. Suspending a running domain
15.8.4. Waking up a domain from pmsuspend state
15.8.5. Undefining a domain
15.8.6. Resuming a guest virtual machine
15.8.7. Save a guest virtual machine
15.8.8. Updating the domain XML file that will be used for restoring the guest
15.8.9. Extracting the domain XML file
15.8.10. Edit Domain XML configuration files
15.8.11. Restore a guest virtual machine
15.9. Shutting down, rebooting and force-shutdown of a guest virtual machine
15.9.1. Shut down a guest virtual machine
15.9.2. Shutting down Red Hat Enterprise Linux 6 guests on a Red Hat Enterprise Linux 7 host
15.9.3. Manipulating the libvirt-guests configuration settings
15.9.4. Rebooting a guest virtual machine
15.9.5. Forcing a guest virtual machine to stop
15.9.6. Resetting a virtual machine
15.10. Retrieving guest virtual machine information
15.10.1. Getting the domain ID of a guest virtual machine
15.10.2. Getting the domain name of a guest virtual machine
15.10.3. Getting the UUID of a guest virtual machine
15.10.4. Displaying guest virtual machine information
15.11. Storage pool commands
15.11.1. Searching for a storage pool XML
15.11.2. Creating, defining, and starting storage pools
15.11.3. Stopping and deleting storage pools
15.11.4. Creating an XML dump file for a pool
15.11.5. Editing the storage pool's configuration file
15.11.6. Converting storage pools
15.12. Storage Volume Commands
15.12.1. Creating storage volumes
15.12.2. Deleting storage volumes
15.12.3. Dumping storage volume information to an XML file
15.12.4. Listing volume information
15.12.5. Retrieving storage volume information
15.12.6. Uploading and downloading storage volumes
15.12.7. Re-sizing storage volumes
15.13. Displaying per-guest virtual machine information
15.13.1. Displaying the guest virtual machines
15.13.2. Displaying virtual CPU information
15.13.3. Configuring virtual CPU affinity
15.13.4. Displaying information about the virtual CPU counts of a domain
15.13.5. Configuring virtual CPU affinity
15.13.6. Configuring virtual CPU count
15.13.7. Configuring memory allocation
15.13.8. Changing the memory allocation for the domain
15.13.9. Displaying guest virtual machine block device information
15.13.10. Displaying guest virtual machine network device information
15.14. Managing virtual networks
15.15. Migrating guest virtual machines with virsh
15.15.1. Interface Commands
15.15.2. Managing snapshots
15.16. Guest virtual machine CPU model configuration
15.16.1. Introduction
15.16.2. Learning about the host physical machine CPU model
15.16.3. Determining a compatible CPU model to suit a pool of host physical machines
15.17. Configuring the guest virtual machine CPU model
15.18. Managing resources for guest virtual machines
15.19. Setting schedule parameters
15.20. Disk I/O throttling
15.21. Display or set block I/O parameters
15.22. Configuring memory Tuning
15.23. Virtual Networking Commands
15.23.1. Autostarting a virtual network
15.23.2. Creating a virtual network from an XML file
15.23.3. Defining a virtual network from an XML file
15.23.4. Stopping a virtual network
15.23.5. Creating a dump file
15.23.6. Editing a virtual network's XML configuration file
15.23.7. Getting information about a virtual network
15.23.8. Listing information about a virtual network
15.23.9. Converting a network UUID to network name
15.23.10. Starting a (previously defined) inactive network
15.23.11. Undefining the configuration for an inactive network
15.23.12. Converting a network name to network UUID
15.23.13. Updating an existing network definition file
16. Managing guests with the Virtual Machine Manager (virt-manager)
16.1. Starting virt-manager
16.2. The Virtual Machine Manager main window
16.3. The virtual hardware details window
16.3.1. Attaching USB devices to a guest virtual machine
16.4. Virtual Machine graphical console
16.5. Adding a remote connection
16.6. Displaying guest details
16.7. Performance monitoring
16.8. Displaying CPU usage for guests
16.9. Displaying CPU usage for hosts
16.10. Displaying Disk I/O
16.11. Displaying Network I/O
17. Guest virtual machine disk access with offline tools
17.1. Introduction
17.2. Terminology
17.3. Installation
17.4. The guestfish shell
17.4.1. Viewing file systems with guestfish
17.4.2. Modifying files with guestfish
17.4.3. Other actions with guestfish
17.4.4. Shell scripting with guestfish
17.4.5. Augeas and libguestfs scripting
17.5. Other commands
17.6. virt-rescue: The rescue shell
17.6.1. Introduction
17.6.2. Running virt-rescue
17.7. virt-df: Monitoring disk usage
17.7.1. Introduction
17.7.2. Running virt-df
17.8. virt-resize: resizing guest virtual machines offline
17.8.1. Introduction
17.8.2. Expanding a disk image
17.9. virt-inspector: inspecting guest virtual machines
17.9.1. Introduction
17.9.2. Installation
17.9.3. Running virt-inspector
17.10. virt-win-reg: Reading and editing the Windows Registry
17.10.1. Introduction
17.10.2. Installation
17.10.3. Using virt-win-reg
17.11. Using the API from Programming Languages
17.11.1. Interaction with the API via a C program
17.12. virt-sysprep: resetting virtual machine settings
17.13. Troubleshooting
17.14. Where to find further documentation
18. Using simple tools for guest virtual machine management
18.1. Using virt-viewer
18.2. remote-viewer
19. Virtual Networking
19.1. Virtual network switches
19.2. Bridge Mode
19.3. Network Address Translation mode
19.3.1. DNS and DHCP
19.4. Routed mode
19.5. Isolated mode
19.6. The default configuration
19.7. Examples of common scenarios
19.7.1. Bridged mode
19.7.2. Routed mode
19.7.3. NAT mode
19.7.4. Isolated mode
19.8. Managing a virtual network
19.9. Creating a virtual network
19.10. Attaching a virtual network to a guest
19.11. Directly attaching to physical interface
19.12. Applying network filtering
19.12.1. Introduction
19.12.2. Filtering chains
19.12.3. Filtering chain priorities
19.12.4. Usage of variables in filters
19.12.5. Automatic IP address detection and DHCP snooping
19.12.6. Reserved Variables
19.12.7. Element and attribute overview
19.12.8. References to other filters
19.12.9. Filter rules
19.12.10. Supported protocols
19.12.11. Advanced Filter Configuration Topics
19.12.12. Limitations
19.13. Creating Tunnels
19.13.1. Creating Multicast Tunnels
19.13.2. Creating TCP tunnels
19.14. Setting vLAN tags
19.15. Applying QoS to your virtual network
20. qemu-kvm Commands, Flags, and Arguments
20.1. Introduction
20.2. Basic options
20.3. Disk options
20.4. Display options
20.5. Network options
20.6. Device options
20.7. Linux/Multiboot boot
20.8. Expert options
20.9. Help and information options
20.10. Miscellaneous options
21. Manipulating the domain xml
21.1. General information and metadata
21.2. Operating system booting
21.2.1. BIOS bootloader
21.2.2. Host physical machine bootloader
21.2.3. Direct kernel boot
21.3. SMBIOS system information
21.4. CPU allocation
21.5. CPU tuning
21.6. Memory backing
21.7. Memory tuning
21.8. NUMA node tuning
21.9. Block I/O tuning
21.10. Resource partitioning
21.11. CPU model and topology
21.11.1. Guest virtual machine NUMA topology
21.12. Events configuration
21.13. Power Management
21.14. Hypervisor features
21.15. Time keeping
21.16. Devices
21.16.1. Hard drives, floppy disks, CDROMs
21.16.2. Filesystems
21.16.3. Device addresses
21.16.4. Controllers
21.16.5. Device leases
21.16.6. Host physical machine device assignment
21.16.7. Redirected devices
21.16.8. Smartcard devices
21.16.9. Network interfaces
21.16.10. Input devices
21.16.11. Hub devices
21.16.12. Graphical framebuffers
21.16.13. Video devices
21.16.14. Consoles, serial, parallel, and channel devices
21.16.15. Guest virtual machine interfaces
21.16.16. Channel
21.16.17. Host physical machine interface
21.17. Sound devices
21.18. Watchdog device
21.19. Memory balloon device
21.20. TPM devices
21.21. Security label
21.22. Example domain XML configuration
22. Troubleshooting
22.1. Debugging and troubleshooting tools
22.2. Creating virsh dump files
22.3. kvm_stat
22.4. Guest virtual machine fails to shutdown
22.5. Troubleshooting with serial consoles
22.6. Virtualization log files
22.7. Loop device errors
22.8. Live Migration Errors
22.9. Enabling Intel VT-x and AMD-V virtualization hardware extensions in BIOS
22.10. KVM networking performance
22.11. Workaround for creating external snapshots with libvirt
22.12. Missing characters on guest console with Japanese keyboard
22.13. Verifying virtualization extensions
A. The Virtual Host Metrics Daemon (vhostmd)
B. Additional resources
B.1. Online resources
B.2. Installed documentation
C. Revision History