Red Hat ENTERPRISE LINUX 5 - VIRTUALIZATION GUIDE Manual

Hide thumbs Also See for ENTERPRISE LINUX 5 - VIRTUALIZATION GUIDE:
Table of Contents

Advertisement

Red Hat Enterprise Linux 5

Virtualization Guide
The definitive guide for virtualization on Red Hat Enterprise Linux
Christopher Curran

Advertisement

Table of Contents
loading

Summary of Contents for Red Hat ENTERPRISE LINUX 5 - VIRTUALIZATION GUIDE

  • Page 1: Red Hat Enterprise Linux

    Red Hat Enterprise Linux 5 Virtualization Guide The definitive guide for virtualization on Red Hat Enterprise Linux Christopher Curran...
  • Page 2 Edition 5 Author Christopher Curran ccurran@redhat.com Copyright © 2008,2009,2010 Red Hat, Inc. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/.
  • Page 3: Table Of Contents

    Preface 1. About this book ......................ix 2. Document Conventions ....................ix 2.1. Typographic Conventions ..................ix 2.2. Pull-quote Conventions ..................xi 2.3. Notes and Warnings .................... xi 3. We need your feedback ....................xii 3.1. Technical review requests ..................xii 4.
  • Page 4 Virtualization Guide 9.2. Bridged networking with libvirt ................144 10. Pre-Red Hat Enterprise Linux 5.4 Xen networking 10.1. Configuring multiple guest network bridges to use multiple Ethernet cards ... 147 10.2. Red Hat Enterprise Linux 5.0 laptop network configuration ........ 149 11.
  • Page 5 19.2. Configuring guest live migration ............... 231 20. KVM live migration 20.1. Live migration requirements ................233 20.2. Share storage example: NFS for a simple migration .......... 234 20.3. Live KVM migration with virsh ................. 235 20.4. Migrating with virt-manager ................236 21.
  • Page 6 Virtualization Guide VII. Tips and Tricks 31. Tips and tricks 31.1. Automatically starting guests ................321 31.2. Changing between the KVM and Xen hypervisors ..........321 31.2.1. Xen to KVM ..................321 31.2.2. KVM to Xen ..................323 31.3. Using qemu-img ..................... 324 31.4.
  • Page 7 34.3. Virtualized Ethernet devices are not found by networking tools ......361 34.4. Loop device errors ..................361 34.5. Failed domain creation caused by a memory shortage ........362 34.6. Wrong kernel image error ................362 34.7. Wrong kernel image error - non-PAE kernel on a PAE platform ......363 34.8.
  • Page 8 viii...
  • Page 9: Preface

    Preface This book is the Red Hat Enterprise Linux Virtualization Guide. The Guide covers all aspects of using and managing virtualization products included with Red Hat Enterprise Linux. 1. About this book This book is divided into 7 parts: • System Requirements •...
  • Page 10 Preface The above includes a file name, a shell command and a keycap, all presented in mono-spaced bold and all distinguishable thanks to context. Key combinations can be distinguished from keycaps by the hyphen connecting each part of a key combination.
  • Page 11: Pull-Quote Conventions

    Pull-quote Conventions To see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release. Note the words in bold italics above — username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system.
  • Page 12: We Need Your Feedback

    3. We need your feedback If you find a typographical error in this manual, or if you have thought of a way to make this manual http://bugzilla.redhat.com/ better, we would love to hear from you. Submit a report in Bugzilla: against Red_Hat_Enterprise_Linux with the doc-Virtualization_Guide component.
  • Page 13: How Should Cio's Think About Virtualization

    How should CIO's think about virtualization Verification a request to check a fact, procedure, or whether material should be obsoleted. For example, "Section describes how to connect to a generic iSCSI storage device. Please verify this on your hardware" or "Section still describes how to update kernel modules using a LS-120 SuperDisk; please verify that we still need to tell readers about this obsolete hardware."...
  • Page 14 Then, extend your target architectures to incorporate virtual solutions. Although substantial benefits are available from virtualizing existing services, building new applications with an integrated virtualization strategy can yield further benefits in both manageability and availability. http://www.redhat.com/products/ You can learn more about Red Hat’s virtualization solutions at...
  • Page 15: Requirements And Limitations For Virtualization With Red Hat Enterprise Linux

    Part I. Requirements and Limitations for Virtualization with Red Hat Enterprise Linux System requirements, support restrictions and limitations These chapters outline the system requirements, support restrictions, and limitations of virtualization on Red Hat Enterprise Linux.
  • Page 17: System Requirements

    Chapter 1. System requirements This chapter lists system requirements for successfully running virtualization with Red Hat Enterprise Linux. Virtualization is available for Red Hat Enterprise Linux 5 Server. Kernel-based Virtual The requirements for virtualization vary depending on the type of hypervisor. The Machine hypervisors are provided with Red Hat Enterprise Linux 5.
  • Page 18 Chapter 1. System requirements KVM requirements The KVM hypervisor requires: • an Intel processor with the Intel VT and the Intel 64 extensions, or • an AMD processor with the AMD-V and the AMD64 extensions. Section 31.6, “Verifying virtualization extensions” Refer to to determine if your processor has the virtualization extensions.
  • Page 19: Xen Restrictions And Support

    Chapter 2. Xen restrictions and support Red Hat Enterprise Linux 5 supports various architecture combinations for hosts and virtualized guests. This lists tested compatible guests for Red Hat Enterprise Linux 5 hosts. Other combinations may be possible but are not tested and are unsupported by Red Hat. The x86 architecture The 32 bit Red Hat Enterprise Linux kernel-xen package on x86-compatible systems is limited to 16 processor cores.
  • Page 20 Chapter 2. Xen restrictions and support • Red Hat Enterprise Linux 5.5 supports up to 192 CPU processor cores. Supported fully virtualized guests Operating system Support level Red Hat Enterprise Linux 3 Optimized x86-64 Red Hat Enterprise Linux 3 x86 Optimized Red Hat Enterprise Linux 4 Optimized...
  • Page 21 Supported fully virtualized guests Operating system Support level Red Hat Enterprise Linux 3 Supported Itanium Red Hat Enterprise Linux 4 Optimized Itanium Red Hat Enterprise Linux 5 Optimized Itanium Windows Server 2003 for Supported Itanium-based Systems Only Red Hat Enterprise Linux 5 is supported as a para-virtualized guest on the Intel Itanium architecture.
  • Page 23: Kvm Restrictions And Support

    Chapter 3. KVM restrictions and support Important KVM only supports AMD64 and Intel 64 versions of Red Hat Enterprise Linux. Other architectures are not supported at this time. The KVM hypervisor requires a processor with the Intel-VT or AMD-V virtualization extensions. To verify whether your processor supports the virtualization extensions and for information on Section 31.6, “Verifying virtualization enabling the virtualization extensions if they are disabled, refer to...
  • Page 25: Virtualization Limitations

    Chapter 4. Virtualization limitations This chapter covers additional limitations of the virtualization packages in Red Hat Enterprise Linux. 4.1. General limitations for virtualization Switching hypervisors Presently, there are no applications for switching Xen-based guests to KVM or KVM-based guests to Xen. Guests can only be used on the hypervisor type that they were created on. There is an application in development at time of writing for automating this task.
  • Page 26: Xen Limitations

    Chapter 4. Virtualization limitations Virtualized IDE devices KVM is limited to a maximum of four virtualized (emulated) IDE devices per guest. Para-virtualized devices Para-virtualized devices, which use the virtio drivers, are PCI devices. Presently, guests are limited to a maximum of 32 PCI devices. Some PCI devices are critical for the guest to run and these devices cannot be removed.
  • Page 27 Xen limitations Xen host (dom0) limitations tap:aio • A limit of 100 block devices using the driver and file-based devices per host. The total number of block devices attached to para-virtualized guests cannot exceed 100 devices per host. Working around the para-virtualized device limit There are two methods for working around the para-virtualized device limit: using devices (devices using the physical access mode) or using LVM on the guest.
  • Page 28: Application Limitations

    Chapter 4. Virtualization limitations • A maximum of 15 network devices per virtualized guest. • A maximum of 15 virtualized SCSI devices per virtualized guest. PCI passthrough limitations • PCI passthrough (attaching PCI devices to guests) is presently only supported on the following architectures: •...
  • Page 29: Installation

    Part II. Installation Virtualization installation topics These chapters describe setting up the host and installing virtualized guests with Red Hat Enterprise Linux. It is recommended to read these chapters carefully to ensure successful installation of virtualized guest operating systems.
  • Page 31: Installing The Virtualization Packages

    This section covers installing virtualization tools and Xen packages as part of a fresh Red Hat Enterprise Linux installation. Need help installing? The Installation Guide (available from redhat.com ) covers installing Red Hat Enterprise Linux in detail. Start an interactive Red Hat Enterprise Linux installation from the Red Hat Enterprise Linux Installation CD-ROM, DVD or PXE.
  • Page 32 Chapter 5. Installing the virtualization packages Select the Virtualization package group and the Customize Now radio button. Select the Virtualization package group. The Virtualization package group selects the Xen hypervisor, virt-manager, libvirt and virt-viewer and all dependencies for installation.
  • Page 33 Installing Xen with a new Red Hat Enterprise Linux installation Customize the packages (if required) Customize the Virtualization group if you require other virtualization packages.
  • Page 34 Chapter 5. Installing the virtualization packages Press the Close button then the Forward button to continue the installation. Note You require a valid RHN virtualization entitlement to receive updates for the virtualization packages. Installing Xen packages with Kickstart files This section describes how to use a Kickstart file to install Red Hat Enterprise Linux with the Xen hypervisor packages.
  • Page 35: Installing Xen Packages On An Existing Red Hat Enterprise Linux System

    Installing Xen packages on an existing Red Hat Enterprise Linux system xen-ia64-guest-firmware redhat.com , in the Installation More information on Kickstart files can be found on Red Hat's website, Guide. 5.2. Installing Xen packages on an existing Red Hat Enterprise Linux system The section describes the steps necessary to install the virtualization packages on a working Red Hat Enterprise Linux system.
  • Page 36: Installing Kvm With A New Red Hat Enterprise Linux Installation

    This section covers installing virtualization tools and KVM package as part of a fresh Red Hat Enterprise Linux installation. Need help installing? The Installation Guide (available from redhat.com ) covers installing Red Hat Enterprise Linux in detail. You need a valid installation number You cannot select the virtualization packages during the installation without a valid installation number.
  • Page 37 Installing KVM with a new Red Hat Enterprise Linux installation You must enter a valid installation number when prompted to receive access to the virtualization and other Advanced Platform packages. Complete the other steps up to the package selection step. Select the Virtualization package group and the Customize Now radio button.
  • Page 38 Chapter 5. Installing the virtualization packages Customize the packages (if required) Customize the Virtualization group if you require other virtualization packages.
  • Page 39 Kickstart file to install Red Hat Enterprise Linux with the virtualization packages. In the %packages section of your Kickstart file, append the following package group: %packages @kvm redhat.com , in the Installation More information on Kickstart files can be found on Red Hat's website, Guide.
  • Page 40: Installing Kvm Packages On An Existing Red Hat Enterprise Linux System

    Recommended virtualization packages: python-virtinst Provides the virt-install command for creating virtual machines. libvirt libvirt is an API library for interacting with hypervisors. libvirt uses the xm virtualization framework and the virsh command line tool to manage and control virtual machines. https://www.redhat.com/wapps/store/catalog.html...
  • Page 41 Installing KVM packages on an existing Red Hat Enterprise Linux system libvirt-python The libvirt-python package contains a module that permits applications written in the Python programming language to use the interface supplied by the libvirt API. virt-manager virt-manager, also known as Virtual Machine Manager, provides a graphical tool for administering virtual machines.
  • Page 43: Virtualized Guest Installation Overview

    Chapter 6. Virtualized guest installation overview After you have installed the virtualization packages on the host system you can create guest operating systems. This chapter describes the general processes for installing guest operating systems on virtual machines. You can create guests using the New button in virt-manager or use the command line interface virt-install.
  • Page 44 Chapter 6. Virtualized guest installation overview Procedure 6.1. Creating a virtualized guest with virt-manager Open virt-manager Start virt-manager. Launch the Virtual Machine Manager application from the Applications menu and System Tools submenu. Alternatively, run the virt-manager command as root. Optional: Open a remote hypervisor Open the File ->...
  • Page 45 Creating guests with virt-manager New guest wizard The Create a new virtual machine window provides a summary of the information you must provide in order to create a virtual machine:...
  • Page 46 Chapter 6. Virtualized guest installation overview Review the information for your installation and click the Forward button. Name the virtual machine Provide a name for your virtualized guest. Punctuation and whitespace characters are not permitted in versions before Red Hat Enterprise Linux 5.5. Red Hat Enterprise Linux 5.5 adds support for '_', '.' and '-' characters.
  • Page 47 Creating guests with virt-manager Press Forward to continue. Choose virtualization method The Choosing a virtualization method window appears. Choose between Para-virtualized or Fully virtualized. Full virtualization requires a system with Intel® VT or AMD-V processor. If the virtualization extensions are not present the fully virtualized radio button or the Enable kernel/hardware acceleration will not be selectable.
  • Page 48 Chapter 6. Virtualized guest installation overview Choose the virtualization type and click the Forward button. Select the installation method The Installation Method window asks for the type of installation you selected. Guests can be installed using one of the following methods: Local media installation This method uses a CD-ROM or DVD or an image of an installation CD-ROM or DVD (an .iso file).
  • Page 49 Creating guests with virt-manager The network services and files can be hosted using network services on the host or another mirror. Network boot This method uses a Preboot eXecution Environment (PXE) server to install the guest. Setting up a PXE server is covered in the Red Hat Enterprise Linux Deployment Guide. Using this method requires a guest with a routable IP address or shared network device.
  • Page 50 Chapter 6. Virtualized guest installation overview Para-virtualized guest installation Para-virtualized installation must be installed with a network installation tree. The installation tree must be accessible using one of the following network protocols: HTTP, FTP or NFS. The installation media URL must contain a Red Hat Enterprise Linux installation tree.
  • Page 51 Creating guests with virt-manager Click the Forward button to procede. Network install tree installation If Network install tree was selected in the previous step this screen is called Installation Source. Network installation requires the address of a mirror of a Linux installation tree using NFS, FTP or HTTP.
  • Page 52 Chapter 6. Virtualized guest installation overview Storage setup The Storage window displays. Choose a disk partition, LUN or create a file-based image for the guest storage. All image files should be stored in the /var/lib/libvirt/images/ directory. Other directory locations for file-based images are prohibited by SELinux. If you run SELinux in enforcing mode, Section 17.2, “SELinux and virtualization”...
  • Page 53 Creating guests with virt-manager Note It is recommend that you use the default directory for virtual machine images, /var/ lib/libvirt/images/. If you are using a different location (such as /images/ in this example) make sure it is added to your SELinux policy and relabeled before you continue with the installation (later in the document you will find information on how to modify your SELinux policy).
  • Page 54 Chapter 6. Virtualized guest installation overview Press Forward to continue. 11. Memory and CPU allocation The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance. Guests require sufficient physical memory (RAM) to run efficiently and effectively.
  • Page 55 Creating guests with virt-manager the host system. It is possible to over allocate virtual processors, however, over allocating has a significant, negative affect on guest and host performance due to processor context switching overheads. Press Forward to continue. 12. Verify and start guest installation The Finish Virtual MAchine Creation window presents a summary of all configuration information you entered.
  • Page 56: Installing Guests With Pxe

    Chapter 6. Virtualized guest installation overview A VNC window opens showing the start of the guest operating system installation process. Chapter 7, Guest This concludes the general process for creating guests with virt-manager. operating system installation procedures contains step-by-step instructions to installing a variety of common operating systems.
  • Page 57 Installing guests with PXE # cd -/etc/sysconfig/network-scripts/ # vim ifcfg-installation DEVICE=installation TYPE=Bridge BOOTPROTO=dhcp ONBOOT=yes Warning The line, TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'. Start the new bridge by restarting the network service. The ifup installation command can start the individual bridge but it is safer to test the entire network restarts properly.
  • Page 58 Chapter 6. Virtualized guest installation overview Security configuration Configure iptables to allow all traffic to be forwarded across the bridge. # iptables --I FORWARD --m physdev ---physdev-is-bridged --j ACCEPT # service iptables save # service iptables restart Disable iptables on bridges Alternatively, prevent bridged traffic from being processed by iptables rules.
  • Page 59 Installing guests with PXE Select the bridge Select Shared physical device and select the bridge created in the previous procedure.
  • Page 60 Chapter 6. Virtualized guest installation overview Start the installation The installation is ready to start.
  • Page 61 Installing guests with PXE A DHCP request is sent and if a valid PXE server is found the guest installation processes will start.
  • Page 63: Guest Operating System Installation Procedures

    Chapter 7. Guest operating system installation procedures This chapter covers how to install various guest operating systems in a virtualized environment on Chapter 6, Virtualized guest Red Hat Enterprise Linux. To understand the basic processes, refer to installation overview. 7.1. Installing Red Hat Enterprise Linux 5 as a para- virtualized guest This section describes how to install Red Hat Enterprise Linux 5 as a para-virtualized guest.
  • Page 64 Chapter 7. Guest operating system installation procedures After your guest has completed its initial boot, the standard installation process for Red Hat Enterprise Linux starts. For most systems the default answers are acceptable. Procedure 7.1. Para-virtualized Red Hat Enterprise Linux guest installation procedure Select the language and click OK.
  • Page 65 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Select the keyboard layout and click OK.
  • Page 66 Chapter 7. Guest operating system installation procedures Assign the guest's network address. Choose to use DHCP (as shown below) or a static IP address:...
  • Page 67 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest If you select DHCP the installation process will now attempt to acquire an IP address:...
  • Page 68 Chapter 7. Guest operating system installation procedures If you chose a static IP address for your guest this prompt appears. Enter the details on the guest's networking configuration: Enter a valid IP address. Ensure the IP address you enter can reach the server with the installation tree.
  • Page 69 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest This is an example of a static IP address configuration:...
  • Page 70 Chapter 7. Guest operating system installation procedures The installation process now retrieves the files it needs from the server:...
  • Page 71 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Once the initial steps are complete the graphical installation process starts.
  • Page 72 Chapter 7. Guest operating system installation procedures If you are installing a Beta or early release distribution confirm that you want to install the operating system. Click Install Anyway, and then click OK:...
  • Page 73 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Procedure 7.2. The graphical installation process Enter a valid registration code. If you have a valid RHN subscription key please enter in the Installation Number field:...
  • Page 74 Chapter 7. Guest operating system installation procedures Note If you skip the registration step, confirm your Red Hat Network account details after the installation with the rhn_register command. The rhn_register command requires root access. The installation prompts you to confirm erasure of all data on the storage you selected for the installation:...
  • Page 75 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Yes to continue. Review the storage configuration and partition layout. You can chose to select the advanced storage configuration if you want to use iSCSI for the guest's storage.
  • Page 76 Chapter 7. Guest operating system installation procedures Make your selections then click Forward. Confirm the selected storage for the installation.
  • Page 77 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Yes to continue. Configure networking and hostname settings. These settings are populated with the data entered earlier in the installation process. Change these settings if necessary.
  • Page 78 Chapter 7. Guest operating system installation procedures Click OK to continue. Select the appropriate time zone for your environment.
  • Page 79 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Enter the root password for the guest.
  • Page 80 Chapter 7. Guest operating system installation procedures Click Forward to continue. Select the software packages to install. Select the Customize Now button. You must install the kernel-xen package in the System directory. The kernel-xen package is required for para- virtualization.
  • Page 81 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Forward. Dependencies and space requirements are calculated.
  • Page 82 Chapter 7. Guest operating system installation procedures 10. After the installation dependencies and space requirements have been verified click Forward to start the actual installation.
  • Page 83 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest 11. All of the selected software packages are installed automatically.
  • Page 84 Chapter 7. Guest operating system installation procedures 12. After the installation has finished reboot your guest:...
  • Page 85 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest 13. The guest will not reboot, instead it will shutdown..
  • Page 86 Chapter 7. Guest operating system installation procedures Section 7.1, 14. Boot the guest. The guest's name was chosen when you used the virt-install in “Installing Red Hat Enterprise Linux 5 as a para-virtualized guest”. If you used the default example the name is rhel5PV.
  • Page 87 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest...
  • Page 88 Chapter 7. Guest operating system installation procedures 15. Booting the guest starts the First Boot configuration screen. This wizard prompts you for some basic configuration choices for your guest.
  • Page 89 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest 16. Read and agree to the license agreement.
  • Page 90 Chapter 7. Guest operating system installation procedures Click Forward on the license agreement windows. 17. Configure the firewall.
  • Page 91 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Forward to continue. If you disable the firewall you will be prompted to confirm your choice. Click Yes to confirm • and continue. It is not recommended to disable your firewall.
  • Page 92 Chapter 7. Guest operating system installation procedures 18. Configure SELinux. It is strongly recommended you run SELinux in enforcing mode. You can choose to either run SELinux in permissive mode or completely disable it.
  • Page 93 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Forward to continue. If you choose to disable SELinux this warning displays. Click Yes to disable SELinux. •...
  • Page 94 Chapter 7. Guest operating system installation procedures 19. Enable kdump if necessary.
  • Page 95 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Forward to continue. 20. Confirm time and date are set correctly for your guest. If you install a para-virtualized guest time and date should synchronize with the hypervisor. If the users sets the time or date during the installation it is ignored and the hypervisor's time is used.
  • Page 96 Chapter 7. Guest operating system installation procedures Click Forward to continue. 21. Set up software updates. If you have a Red Hat Network subscription or want to trial one use the screen below to register your newly installed guest in RHN.
  • Page 97 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click Forward to continue. Confirm your choices for RHN.
  • Page 98 Chapter 7. Guest operating system installation procedures You may see an additional screen if you did not configure RHN access. If RHN access is not enabled, you will not receive software updates.
  • Page 99 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest Click the Forward button. 22. Create a non root user account. It is advised to create a non root user for normal usage and enhanced security. Enter the Username, Name and password.
  • Page 100 Chapter 7. Guest operating system installation procedures Click the Forward button. 23. If a sound device is detected and you require sound, calibrate it. Complete the process and click Forward.
  • Page 101 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest 24. You can install additional packages from a CD or another repository using this screen. It it often more efficient to not install any additional software at this point but add packages later using the yum command or RHN.
  • Page 102 Chapter 7. Guest operating system installation procedures 25. The guest now configure any settings you changed and continues the boot process.
  • Page 103 Installing Red Hat Enterprise Linux 5 as a para-virtualized guest 26. The Red Hat Enterprise Linux 5 login screen displays. Log in using the username created in the previous steps.
  • Page 104 Chapter 7. Guest operating system installation procedures 27. You have now successfully installed a para-virtualized Red Hat Enterprise Linux guest.
  • Page 105: Installing Red Hat Enterprise Linux As A Fully Virtualized Guest

    Installing Red Hat Enterprise Linux as a fully virtualized guest 7.2. Installing Red Hat Enterprise Linux as a fully virtualized guest This section covers installing a fully virtualized Red Hat Enterprise Linux 5 guest. This procedure covers both the KVM and the Xen hypervisors; the steps are interchangeable and different steps are noted.
  • Page 106 Chapter 7. Guest operating system installation procedures Connect to a hypervisor if you have not already done so. Open the File menu and select the Add Connection... option. Refer to Section 25.1, “The Add Connection window”. Once a hypervisor connection is selected the New button becomes available. Press the New button.
  • Page 107 Installing Red Hat Enterprise Linux as a fully virtualized guest Press Forward to continue. Choose a virtualization method Choose the virtualization method for the virtualized guest. Note you can only select an installed 4) you must use the hypervisor virtualization method. If you selected KVM or Xen earlier (Step you selected.
  • Page 108 Chapter 7. Guest operating system installation procedures Press Forward to continue. Select the installation method Red Hat Enterprise Linux can be installed using one of the following methods: • local install media, either an ISO image or physical optical media. •...
  • Page 109 Installing Red Hat Enterprise Linux as a fully virtualized guest Press Forward to continue. Locate installation media Select ISO image location or CD-ROM or DVD device. This example uses an ISO file image of the Red Hat Enterprise Linux installation DVD. Press the Browse button.
  • Page 110 Chapter 7. Guest operating system installation procedures Press Forward to continue. Image files and SELinux For ISO image files and guest storage images the recommended to use the / var/lib/libvirt/images/ directory. Any other location may require additional Section 17.2, “SELinux and virtualization” configuration for SELinux, refer to details.
  • Page 111 Installing Red Hat Enterprise Linux as a fully virtualized guest Press Forward to continue. Migration Live and offline migrations require guests to be installed on shared network storage. Part V, “Virtualization For information on setting up shared storage for guests refer to Storage Topics”.
  • Page 112 Chapter 7. Guest operating system installation procedures Press Forward to continue. 10. Memory and CPU allocation The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance. Virtualized guests require sufficient physical memory (RAM) to run efficiently and effectively.
  • Page 113 Installing Red Hat Enterprise Linux as a fully virtualized guest a significant, negative effect on guest and host performance due to processor context switching overheads. Press Forward to continue. 11. Verify and start guest installation Verify the configuration.
  • Page 114: Installing Windows Xp As A Fully Virtualized Guest

    Chapter 7. Guest operating system installation procedures Press Finish to start the guest installation procedure. 12. Installing Red Hat Enterprise Linux Complete the Red Hat Enterprise Linux 5 installation sequence. The installation sequence is covered by the Installation Guide, refer to Red Hat Documentation for the Red Hat Enterprise Linux Installation Guide.
  • Page 115 Installing Windows XP as a fully virtualized guest Before commencing this procedure ensure you must have root access. Itanium® support Presently, Red Hat Enterprise Linux hosts on the Itanium® architecture does not support fully virtualized Windows XP guests. Only Windows Server 2003 for Itanium-based Systems is supported for Itanium systems.
  • Page 116 Chapter 7. Guest operating system installation procedures Choosing a virtualization method Step 1 If you selected KVM or Xen earlier (step ) you must use the hypervisor you selected. This example uses the KVM hypervisor. Windows can only be installed using full virtualization. Choosing an installation method This screen enables you to specify the installation method and the type of operating system.
  • Page 117 Installing Windows XP as a fully virtualized guest Image files and SELinux For ISO image files and guest storage images the recommended to use the / var/lib/libvirt/images/ directory. Any other location may require additional Section 17.2, “SELinux and virtualization” configuration for SELinux, refer to details.
  • Page 118 Chapter 7. Guest operating system installation procedures Press Forward to continue. The Storage window displays. Choose a disk partition, LUN or create a file-based image for the guest's storage. All image files should be stored in the /var/lib/libvirt/images/ directory. Other directory locations for file-based images are prohibited by SELinux.
  • Page 119 Installing Windows XP as a fully virtualized guest Choose the appropriate size for the guest on your selected storage type and click the Forward button. Note It is recommend that you use the default directory for virtual machine images, /var/ lib/libvirt/images/.
  • Page 120 Chapter 7. Guest operating system installation procedures The virtual network option uses Network Address Translation (NAT) to share the default network device with the virtualized guest. Use the virtual network option for wireless networks. The shared physical device option uses a network bond to give the virtualized guest full access to a network device.
  • Page 121 Installing Windows XP as a fully virtualized guest causing degraded system performance and responsiveness. Ensure to allocate sufficient memory for all guests and the host to operate effectively. Assign sufficient virtual CPUs for the virtualized guest. If the guest runs a multithreaded application, assign the number of virtualized CPUs the guest will require to run efficiently.
  • Page 122 Chapter 7. Guest operating system installation procedures 10. You must make a hardware selection so open a console window quickly after the installation starts. Click Finish then switch to the virt-manager summary window and select your newly started Windows guest. Double click on the system name and the console window opens. Quickly and repeatedly press F5 to select a new HAL, once you get the dialog box in the Windows install select the 'Generic i486 Platform' tab.
  • Page 123 Installing Windows XP as a fully virtualized guest 11. The installation continues with the standard Windows installation.
  • Page 124 Chapter 7. Guest operating system installation procedures...
  • Page 125 Installing Windows XP as a fully virtualized guest 12. Partition the hard drive when prompted.
  • Page 126 Chapter 7. Guest operating system installation procedures 13. After the drive is formatted, Windows starts copying the files to the hard drive.
  • Page 127 Installing Windows XP as a fully virtualized guest 14. The files are copied to the storage device, Windows now reboots. 15. Restart your Windows guest: # virsh start WindowsGuest Where WindowsGuest is the name of your virtual machine. 16. When the console window opens, you will see the setup phase of the Windows installation.
  • Page 128 Chapter 7. Guest operating system installation procedures 17. If your installation seems to get stuck during the setup phase, restart the guest with virsh reboot WindowsGuestName. When you restart the virtual machine, the Setup is being restarted message displays:...
  • Page 129 Installing Windows XP as a fully virtualized guest 18. After setup has finished you will see the Windows boot screen:...
  • Page 130 Chapter 7. Guest operating system installation procedures 19. Now you can continue with the standard setup of your Windows installation:...
  • Page 131 Installing Windows XP as a fully virtualized guest 20. The setup process is complete.
  • Page 132: Installing Windows Server 2003 As A Fully Virtualized Guest

    Chapter 7. Guest operating system installation procedures 7.4. Installing Windows Server 2003 as a fully virtualized guest This chapter describes installing a fully virtualized Windows Server 2003 guest with the virt- install command. virt-install can be used instead of virt-manager This process is similar Section 7.3, “Installing Windows XP as a fully virtualized to the Windows XP installation covered in guest”.
  • Page 133 Installing Windows Server 2003 as a fully virtualized guest Xen virt-install # virt-install ---virt-type=xen --hvm ---name windows2003sp1 ---file=/var/lib/libvirt/images/windows2003sp2.img \ ---file-size=6 \ ---cdrom=/var/lib/libvirt/images/ISOs/WIN/en_windows_server_2003_sp1.iso \ ---vnc ---ram=1024 KVM virt-install # virt-install ---accelerate ---hvm ---connect qemu:///system \ ---name rhel3support ---network network:default \ ---file=/var/lib/libvirt/images/windows2003sp2.img \ ---file-size=6 \ ---cdrom=/var/lib/libvirt/images/ISOs/WIN/en_windows_server_2003_sp1.iso \ ---vnc ---ram=1024...
  • Page 134 Chapter 7. Guest operating system installation procedures...
  • Page 135: Installing Windows Server 2008 As A Fully Virtualized Guest

    Installing Windows Server 2008 as a fully virtualized guest Windows Server 2003 is now installed as a fully virtualized guest. 7.5. Installing Windows Server 2008 as a fully virtualized guest This section covers installing a fully virtualized Windows Server 2008 guest. This procedure covers both the KVM and the Xen hypervisors;...
  • Page 136 Chapter 7. Guest operating system installation procedures Press Forward to continue. Name the virtual machine Provide a name for your virtualized guest. Punctuation and whitespace characters are not permitted in versions before Red Hat Enterprise Linux 5.5. Red Hat Enterprise Linux 5.5 adds support for '_', '.' and '-' characters.
  • Page 137 Installing Windows Server 2008 as a fully virtualized guest Press Forward to continue. Choose a virtualization method Choose the virtualization method for the virtualized guest. Note you can only select an installed virtualization method. If you selected KVM or Xen earlier (step 2) you must use the hypervisor you selected.
  • Page 138 Chapter 7. Guest operating system installation procedures Press Forward to continue. Select the installation method For all versions of Windows you must use local install media, either an ISO image or physical optical media. PXE may be used if you have a PXE server configured for Windows network installation. PXE Windows installation is not covered by this guide.
  • Page 139 Installing Windows Server 2008 as a fully virtualized guest Press Forward to continue. Locate installation media Select ISO image location or CD-ROM or DVD device. This example uses an ISO file image of the Windows Server 2008 installation CD. Press the Browse button. Search to the location of the ISO file and select it.
  • Page 140 Chapter 7. Guest operating system installation procedures Press Open to confirm your selection. The file is selected and ready to install.
  • Page 141 Installing Windows Server 2008 as a fully virtualized guest Press Forward to continue. Image files and SELinux For ISO image files and guest storage images, the recommended directory to use is the /var/lib/libvirt/images/ directory. Any other location may Section 17.2, “SELinux and require additional configuration for SELinux, refer to virtualization”...
  • Page 142 Chapter 7. Guest operating system installation procedures Press Forward to continue. Network setup Select either Virtual network or Shared physical device. The virtual network option uses Network Address Translation (NAT) to share the default network device with the virtualized guest. Use the virtual network option for wireless networks. The shared physical device option uses a network bond to give the virtualized guest full access to a network device.
  • Page 143 Installing Windows Server 2008 as a fully virtualized guest Press Forward to continue. 10. Memory and CPU allocation The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance. Virtualized guests require sufficient physical memory (RAM) to run efficiently and effectively.
  • Page 144 Chapter 7. Guest operating system installation procedures a significant, negative effect on guest and host performance due to processor context switching overheads. Press Forward to continue. 11. Verify and start guest installation Verify the configuration.
  • Page 145 Installing Windows Server 2008 as a fully virtualized guest Press Finish to start the guest installation procedure.
  • Page 146 Chapter 7. Guest operating system installation procedures 12. Installing Windows Complete the Windows Server 2008 installation sequence. The installation sequence is not documentation covered by this guide, refer to Microsoft's for information on installing Windows.
  • Page 147: Configuration

    Part III. Configuration Configuring Virtualization in Red Hat Enterprise Linux These chapters cover configuration procedures for various advanced virtualization tasks. These tasks include adding network and storage devices, enhancing security, improving performance, and using para-virtualized drivers on fully virtualized guests.
  • Page 149: Virtualized Storage Devices

    Chapter 8. Virtualized storage devices This chapter covers installing and configuring storage devices in virtualized guests. The term block devices refers to various forms of storage devices. All the procedures in this chapter work with both Xen and KVM hypervisors. Valid disk targets The target variable in libvirt configuration files accepts only the following device names: •...
  • Page 150: Adding Storage Devices To Guests

    Chapter 8. Virtualized storage devices # virsh dumpxml rhel5FV > rhel5FV.xml This saves the configuration settings as an XML file which can be edited to customize the operations and devices used by the guest. For more information on using the virsh XML Chapter 32, Creating custom libvirt scripts.
  • Page 151 Adding storage devices to guests Create an empty container file or using an existing file container (such as an ISO file). Create a sparse file using the dd command. Sparse files are not recommended due to data integrity and performance issues. Sparse files are created much faster and can used for testing but should not be used in production environments.
  • Page 152 Chapter 8. Virtualized storage devices The guest now uses the file FileName.img as the device called /dev/hdb. This device requires formatting from the guest. On the guest, partition the device into one primary partition for the entire device then format the device. Press n for a new partition.
  • Page 153 Adding storage devices to guests Mount the disk on the guest. # mount -/dev/hdb1 /myfiles The guest now has an additional virtualized file-based storage device. Adding hard drives and other block devices to a guest System administrators use additional hard drives for to provide more storage space or to separate Procedure 8.1, “Adding physical block devices to system data from user data.
  • Page 154: Configuring Persistent Storage In Red Hat Enterprise Linux 5

    Chapter 8. Virtualized storage devices 8.3. Configuring persistent storage in Red Hat Enterprise Linux 5 This section is for systems with external or networked storage; that is, Fibre Channel or iSCSI based storage devices. It is recommended that those systems have persistent device names configured for your hosts.
  • Page 155 Configuring persistent storage in Red Hat Enterprise Linux 5 Replace UUID and devicename with the UUID retrieved above, and a name for the device. This is a rule for the example above: KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/scsi_id --g --s", RESULT="3600a0b800013275100000015427b625e", NAME="rack4row16" The udev daemon now searches all devices named /dev/sd* for the UUID in the rule. Once a matching device is connected to the system the device is assigned the name from the rule.
  • Page 156: Add A Virtualized Cd-Rom Or Dvd Device To A Guest

    Chapter 8. Virtualized storage devices alias oramp4 This configuration will create 4 LUNs named /dev/mpath/oramp1, /dev/mpath/oramp2, /dev/ mpath/oramp3 and /dev/mpath/oramp4. Once entered, the mapping of the devices' WWID to their new names are now persistent after rebooting. 8.4. Add a virtualized CD-ROM or DVD device to a guest To attach an ISO file to a guest while the guest is online use virsh with the attach-disk parameter.
  • Page 157: Network Configuration

    Chapter 9. Network Configuration This page provides an introduction to the common networking configurations used by libvirt based applications. This information applies to all hypervisors, whether Xen, KVM or another. For additional information consult the libvirt network architecture docs. The two common setups are "virtual network" or "shared physical device". The former is identical across all distributions and available out-of-the-box.
  • Page 158: Bridged Networking With Libvirt

    Chapter 9. Network Configuration libvirt adds iptables rules which allow traffic to and from guests attached to the virbr0 device in the INPUT, FORWARD, OUTPUT and POSTROUTING chains. libvirt then attempts to enable the ip_forward parameter. Some other applications may disable ip_forward, so the best option is to add the following to /etc/sysctl.conf.
  • Page 159 Bridged networking with libvirt # service NetworkManager stop # service network start Note Instead of turning off NetworkManager, you can add "NM_CONTROLLED=no" to the ifcfg-* scripts used in the examples. Creating network initscripts Create or edit the following two network configuration files. This step can be repeated (with different names) for additional network bridges.
  • Page 160 Chapter 9. Network Configuration # service network restart Configure iptables to allow all traffic to be forwarded across the bridge. # iptables --I FORWARD --m physdev ---physdev-is-bridged --j ACCEPT # service iptables save # service iptables restart Disable iptables on bridges Alternatively, prevent bridged traffic from being processed by iptables rules.
  • Page 161: Pre-Red Hat Enterprise Linux 5.4 Xen Networking

    Chapter 10. Pre-Red Hat Enterprise Linux 5.4 Xen networking This chapter covers special topics for networking and network configuration with the Xen hypervisor. Most guest network configuration occurs during the guest initialization and installation process. To learn about configuring networking during the guest installation process, read the relevant sections of Chapter 6, Virtualized guest installation overview.
  • Page 162 Chapter 10. Pre-Red Hat Enterprise Linux 5.4 Xen networking Below is the commented out line and the new line, containing the network-xen-multi- bridge parameter to enable multiple network bridges. #network-script network-bridge network-script network-xen-multi-bridge Create a script to create multiple network bridges. This example creates a script called network- xen-multi-bridge.sh in the /etc/xen/scripts/ directory.
  • Page 163: Red Hat Enterprise Linux 5.0 Laptop Network Configuration

    Red Hat Enterprise Linux 5.0 laptop network configuration 10.2. Red Hat Enterprise Linux 5.0 laptop network configuration For Red Hat Enterprise Linux 5.1 or newer This section describes manually adding network bridges. This procedure is not required or recommended for all versions of Red Hat Enterprise Linux newer than version 5.0. For newer versions use "Virtual Network"...
  • Page 164 Chapter 10. Pre-Red Hat Enterprise Linux 5.4 Xen networking alias dummy0 dummy options dummy numdummies=1 To configure networking for dummy0 edit/create /etc/sysconfig/network-scripts/ ifcfg-dummy0: DEVICE=dummy0 BOOTPROTO=none ONBOOT=yes USERCTL=no IPV6INIT=no PEERDNS=yes TYPE=Ethernet NETMASK=255.255.255.0 IPADDR=10.1.1.1 ARP=yes Bind xenbr0 to dummy0, so you can use networking even when not connected to a physical network.
  • Page 165 • Get the latest version of dnsmasq from here • Document for dnsmasq can be found http://et.redhat.com/~jmh/tools/xen/ • Copy the other files referenced below from and grab the file dnsmasq.tgz. The tar archive includes the following files: • nm-dnsmasq can be used as a dispatcher script for NetworkManager. It will be run every time NetworkManager detects a change in connectivity and force a restart/reload of dnsmasq.
  • Page 166 Chapter 10. Pre-Red Hat Enterprise Linux 5.4 Xen networking • Edit the configuration to suit your local needs and requirements. The following parameters are likely the ones you want to modify: • The interface parameter allows dnsmasq to listen for DHCP and DNS requests only on specified interfaces.
  • Page 167: Xen Para-Virtualized Drivers

    Chapter 11. Xen Para-virtualized Drivers Para-virtualized drivers provide increased performance for fully virtualized Red Hat Enterprise Linux guests. Use these drivers if you are using fully virtualized Red Hat Enterprise Linux guests and require better performance. Other para-virtualized drivers There are other para-virtualized drivers for Windows for both Xen and KVM hypervisors. For Windows guests on Xen hosts, refer to the Windows Para-virtualized Drivers Guide which covers installation and administration.
  • Page 168: System Requirements

    Chapter 11. Xen Para-virtualized Drivers operating systems because only the para-virtualized device driver (but not the rest of the operating system) is aware of the underlying virtualization platform. After installing the para-virtualized device drivers, a disk device or network card will continue to appear as a normal, physical disk or network card to the operating system.
  • Page 169: Para-Virtualization Restrictions And Support

    Para-virtualization Restrictions and Support Red Hat Enterprise Linux 3 requires: • kmod-xenpv. You require at least 50MB of free disk space in the /lib file system. 11.2. Para-virtualization Restrictions and Support This section outlines support restrictions and requirements for using para-virtualized drivers on Red Hat Enterprise Linux.
  • Page 170 Chapter 11. Xen Para-virtualized Drivers Important The host system requires Red Hat Enterprise Linux 5.1 or newer. Finding which kernel you are using Write the output of the command below down or remember it. This is the value that determines which packages and modules you need to download. # rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel Your output should appear similar to this:...
  • Page 171: Installing The Para-Virtualized Drivers

    Installing the Para-virtualized Drivers Guest kernel type Required host kernel type i686-HUGEMEM i686 Table 11.2. Required host kernel architecture for guests using para-virtualized drivers on Red Hat Enterprise Linux 3 for Intel processors The table below shows which host kernel is required to run a Red Hat Enterprise Linux 3 guest on if the guest was compiled for an AMD processor.
  • Page 172: Enterprise Linux 3

    Chapter 11. Xen Para-virtualized Drivers Copy the RPMs for your hardware architecture to a suitable location in your guest operating system. Your home directory is sufficient. If you do not know which RPM you require verify against Section 11.2, “Para-virtualization Restrictions and Support”.
  • Page 173 Installation and Configuration of Para-virtualized Drivers on Red Hat Enterprise Linux 3 1. Install the latest kernel version. The para-virtualized drivers require at least Red Hat Enterprise Linux 3.9 kernel version kernel-2.4.21-60.EL for all the required headers. 2. Copy the kmod-xenpv rpm for your hardware architecture and kernel variant to your guest operating system.
  • Page 174 Chapter 11. Xen Para-virtualized Drivers • Add any additional disk partitions, volumes or LUNs to the guest so that they can be accessed via the para-virtualized (xen-vbd) disk driver. • For each physical device, LUN, partition or volume you want to use the para-virtualized drivers you must edit the disk entry for that device in the libvirt configuration file.
  • Page 175 Installation and Configuration of Para-virtualized Drivers on Red Hat Enterprise Linux 3 # change/add xvda to xvdb, xvbd, etc. for 2nd, 3rd, etc., disk added in # in xen config file, respectively. mknod -/dev/xvdb b $major 16 mknod -/dev/xvdb1 b $major 17 mknod -/dev/xvdb2 b $major 18 chgrp disk -/dev/xvd* chmod 0660 -/dev/xvd*...
  • Page 176: Enterprise Linux 4

    Chapter 11. Xen Para-virtualized Drivers /dev/xvdb1 -/mnt/pvdisk_p1 ext3 defaults /dev/xvdb2 -/mnt/pvdisk_p2 ext3 defaults Performance tip Using a Red Hat Enterprise Linux 5.1 host (dom0), the "noapic" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf entry as seen below.
  • Page 177 Installation and Configuration of Para-virtualized Drivers on Red Hat Enterprise Linux 4 Note There are different packages for UP, SMP, Hugemem and architectures so make sure you have the right RPMs for your kernel. 3. Execute cat /etc/modprobe.conf to verify you have an alias for eth0 like the one below. If you are planning to configure multiple interfaces add an additional line for each interface.
  • Page 178 Chapter 11. Xen Para-virtualized Drivers Performance tip Using a Red Hat Enterprise Linux 5.1 host (dom0), the "noapic" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf entry as seen below. Keep in mind your architecture and kernel version may be different. kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic A Red Hat Enterprise Linux 5.2 dom0 will not need this kernel parameter for the guest.
  • Page 179: Xen Para-Virtualized Drivers On Red Hat Enterprise Linux 5

    Xen Para-virtualized Drivers on Red Hat Enterprise Linux 5 Note This package is not supported for Red Hat Enterprise Linux 4-GA through Red Hat Enterprise Linux 4 update 2 systems and kernels. Important note IA64 binary RPM packages and builds are not presently available. Automatic module loading The xen-vbd driver may not automatically load.
  • Page 180 Chapter 11. Xen Para-virtualized Drivers disk = [ -"file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"] Once you have added additional physical devices, LUNs, partitions or volumes; the para- virtualized driver entry in your XML configuration file should resemble the entry shown below. disk = [ -"file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w", "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w"...
  • Page 181: Para-Virtualized Network Driver Configuration

    Para-virtualized Network Driver Configuration [root@rhel5]# df -/mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 31985 -/mnt/pvdisk_p1 Update the /etc/fstab file inside the guest to mount the devices during the boot sequence. Add the following lines: /dev/xvdb1 -/mnt/pvdisk_p1 ext3 defaults /dev/xvdb2 -/mnt/pvdisk_p2...
  • Page 182 Chapter 11. Xen Para-virtualized Drivers 3. To display the present settings for eth0 execute “# ifconfig eth0”. If you receive an error Section 35.4, about the device not existing you should load the modules manually as outlined in “Manually loading the para-virtualized drivers”.
  • Page 183 Para-virtualized Network Driver Configuration Configure the network settings as required.
  • Page 184 Chapter 11. Xen Para-virtualized Drivers 6. Complete the configuration by pressing the 'Apply' button.
  • Page 185 Para-virtualized Network Driver Configuration 7. Press the 'Activate' button to apply the new settings and restart the network.
  • Page 186: Additional Para-Virtualized Hardware Configuration

    For more details on configuring network and storage resources on Red Hat Enterprise Linux 5 Emerging Technologies, Red Hat.com Virtualization read the document available on 11.5.1. Virtualized Network Interfaces Perform the following steps to configure additional network devices for your guest. http://et.redhat.com/~jmh/docs/Installing_RHEL5_Virt.pdf...
  • Page 187: Virtual Storage Devices

    The command above should display the properties of eth1, repeat the command for eth2 if you added a third interface, and so on. Now configure the new network interfaces with redhat-config-network on Red Hat Enterprise Linux 3 or system-config-network on Red Hat Enterprise Linux 4 and Red Hat Enterprise Linux 11.5.2.
  • Page 188 Chapter 11. Xen Para-virtualized Drivers Note You need to increment the letter for the 'xvd' device, that is for your second storage entity it would be 'xvdb' instead of 'xvda'. disk = [ -"file:/var/lib/libvirt/images/rhel5_64_fv.dsk,hda,w", -"tap:aio:/var/lib/libvirt/images/UserStorage1.dsk,xvda,w", -"tap:aio:/var/lib/libvirt/images/UserStorage2.dsk,xvdb,w" -] Verify the partitions have been created and are available. # cat -/proc/partitions major minor #blocks...
  • Page 189: Kvm Para-Virtualized Drivers

    Chapter 12. KVM Para-virtualized Drivers Para-virtualized drivers are available for virtualized Windows guests running on KVM hosts. These para-virtualized drivers are included in the virtio-win package. The virtio-win package supports block (storage) devices and network interface controllers. As with the KVM module, the virtio-win drivers pacakge is only available on hosts running Red Hat Enterprise Linux 5.4 and newer.
  • Page 190 Chapter 12. KVM Para-virtualized Drivers You can install the para-virtualized drivers on your guest by one of the following methods: • hosting the installation files on a network accessible to the guest, • using a virtualized CD-ROM device of the driver installation disk .iso file, or •...
  • Page 191 Installing the KVM Windows para-virtualized drivers Select the device type This opens a wizard for adding the new device. Select Storage from the dropdown menu.
  • Page 192 Chapter 12. KVM Para-virtualized Drivers Click the Forward button to proceed. Select the ISO file Choose the File (disk image) option and set the file location of the para-virtualized drivers .iso image file. The location file is named /usr/share/virtio-win/virtio-win.iso. If the drivers are stored on a physical CD-ROM, use the Normal Disk Partition option. Set the Device type to IDE cdrom and click Forward to proceed.
  • Page 193 Installing the KVM Windows para-virtualized drivers Disc assigned The disk has been assigned and is available for the guest once the guest is started. Click Finish to close the wizard or back if you made a mistake.
  • Page 194 Chapter 12. KVM Para-virtualized Drivers Reboot Reboot or start the guest to add the new device. Virtualized IDE devices require a restart before they can be recognized by guests. Once the CD-ROM with the drivers is attached and the guest has started, proceed with Procedure 12.2, “Windows installation”.
  • Page 195 Installing the KVM Windows para-virtualized drivers Select the correct installation files There are four files available on the disc. Select the drivers you require for your guest's architecture: • the para-virtualized block device driver (RHEV-Block.msi for 32-bit guests or RHEV- Block64.msi for 64-bit guests), •...
  • Page 196 Chapter 12. KVM Para-virtualized Drivers Press Next to continue. Confirm the exception Windows may prompt for a security exception.
  • Page 197 Installing the KVM Windows para-virtualized drivers Press Yes if it is correct. Finish Press Finish to complete the installation. Install the network device driver Start the network device driver installation Double click RHEV-Network.msi or RHEV-Network64.msi.
  • Page 198 Chapter 12. KVM Para-virtualized Drivers Press Next to continue. Performance setting This screen configures advanced TCP settings for the network driver. TCP timestamps and TCP window scaling can be enabled or disabled. The default is, 1, for window scaling to be enabled.
  • Page 199 Installing the KVM Windows para-virtualized drivers Press Next to continue. Confirm the exception Windows may prompt for a security exception. Press Yes if it is correct.
  • Page 200: Installing Drivers With A Virtualized Floppy Disk

    Chapter 12. KVM Para-virtualized Drivers Finish Press Finish to complete the installation. Reboot Reboot the guest to complete the driver installation. (Section 12.3, “Using KVM para- Change the device configuration to use the para-virtualized drivers virtualized drivers for existing devices”) or install a new device which uses the para-virtualized drivers (Section 12.4, “Using KVM para-virtualized drivers for new devices”).
  • Page 201: Using Kvm Para-Virtualized Drivers For Existing Devices

    Using KVM para-virtualized drivers for existing devices 12.3. Using KVM para-virtualized drivers for existing devices Modify an existing hard disk device attached to the guest to use the virtio driver instead of virtualized IDE driver. This example edits libvirt configuration files. Alternatively, virt-manager, virsh attach-disk or virsh attach-interface can add a new device using the para- Section 12.4, “Using KVM para-virtualized drivers for new devices”.
  • Page 202 Chapter 12. KVM Para-virtualized Drivers 2. New network devices Select Virtual network or Shared physical device. Select virtio as the Device type and press Forward.
  • Page 203 Using KVM para-virtualized drivers for new devices Press Finish to save the device.
  • Page 204 Chapter 12. KVM Para-virtualized Drivers Reboot the guest. The device may not be recognized until the Windows guest restarts.
  • Page 205: Pci Passthrough

    Chapter 13. PCI passthrough This chapter covers using PCI passthrough with Xen and KVM hypervisors. KVM and Xen hypervisors support attaching PCI devices on the host system to virtualized guests. PCI passthrough allows guests to have exclusive access to PCI devices for a range of tasks. PCI passthrough allows PCI devices to appear and behave as if they were physically attached to the guest operating system.
  • Page 206: Adding A Pci Device With Virsh

    Chapter 13. PCI passthrough Procedure 13.2. Preparing an AMD system for PCI passthrough Enable AMD IOMMU extensions • The AMD IOMMU extensions are required for PCI passthrough with Red Hat Enterprise Linux. The extensions must be enabled in the BIOS. Some system manufacturers disable these extensions by default.
  • Page 207 Adding a PCI device with virsh Each PCI device is identified by a string in the following format (Where **** is a four digit hexadecimal code): pci_8086_**** Tip: determining the PCI device Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
  • Page 208: Adding A Pci Device With Virt-Manager

    Chapter 13. PCI passthrough Run virsh edit (or virsh attach device) and added a device entry in the <devices> section to attach the PCI device to the guest. Only run this command on offline guests. Red Hat Enterprise Linux does not support hotplugging PCI devices at this time. # virsh edit win2k3 <hostdev mode='subsystem' type='pci' managed='yes'>...
  • Page 209 Adding a PCI device with virt-manager # virsh nodedev-list -| grep pci Each PCI device is identified by a string in the following format (Where **** is a four digit hexadecimal code): pci_8086_**** Tip: determining the PCI device Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
  • Page 210 Chapter 13. PCI passthrough Add the new device Select Physical Host Device from the Hardware type list. The Physical Host Device represents PCI devices. Click Forward to continue.
  • Page 211 Adding a PCI device with virt-manager Select a PCI device Select an unused PCI device. Note taht selecting PCI devices presently in use on the host causes errors. In this example a PCI to USB interface device is used.
  • Page 212 Chapter 13. PCI passthrough Confirm the new device Click the Finish button to confirm the device setup and add the device to the guest.
  • Page 213: Pci Passthrough With Virt-Install

    PCI passthrough with virt-install The setup is complete and the guest can now use the PCI device. 13.3. PCI passthrough with virt-install To use PCI passthrough with the virt-install parameter, use the additional --host-device parameter. Identify the PCI device Identify the PCI device designated for passthrough to the guest. The virsh nodedev-list command lists all devices attached to the system.
  • Page 214: And Older

    Chapter 13. PCI passthrough pci_8086_**** Tip: determining the PCI device Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code. Add the device Use the PCI identifier output from the virsh nodedev command as the value for the --host- device parameter.
  • Page 215 PCI passthrough for para-virtualized Xen guests on Red Hat Enterprise Linux 5.3 and older options pciback hide=(0000:09:00.0)(0000:0a:04.1) Pass the device through by adding the following line to the guest's configuration file. pci = [ -"0000:09:00.0" -]...
  • Page 217: Sr-Iov

    Chapter 14. SR-IOV 14.1. Introduction The PCI-SIG (PCI Special Interest Group) developed the Single Root I/O Virtualization (SR-IOV) specification. The SR-IOV specification is a standard for a type of PCI passthrough which natively shares a single device to multiple guests. SR-IOV does not require hypervisor involvement in data transfer and management by providing an independent memory space, interrupts, and DMA streams for virtualized guests.
  • Page 218: Using Sr-Iov

    Chapter 14. SR-IOV Disadvantages of SR-IOV Live migration is presently unsupported. As with PCI passthrough, identical device configurations are required for live (and offline) migrations. Without identical device configurations, guest's cannot access the passed-through devices after migrating. 14.2. Using SR-IOV This section covers attaching Virtual Function to a guest as an additional network device.
  • Page 219 Using SR-IOV 87592 6708 1 igb Activate Virtual Functions The max_vfs parameter of the igb module allocates the maximum number of Virtual Functions. The max_vfs parameter causes the driver to spawn, up to the value of the parameter in, Virtual Functions.
  • Page 220 Chapter 14. SR-IOV # virsh nodedev-dumpxml pci_8086_10ca # virsh nodedev-dumpxml pci_8086_10ca_0 <device> <name>pci_8086_10ca_0</name> <parent>pci_8086_3408</parent> <driver> <name>igbvf</name> </driver> <capability type='pci'> <domain>0</domain> <bus>3</bus> <slot>16</slot> <function>1</function> <product id='0x10ca'>82576 Virtual Function</product> <vendor id='0x8086'>Intel Corporation</vendor> </capability> </device> Step 9. Note the bus, This example adds the Virtual Function pci_8086_10ca_0 to the guest in slot and function parameters of the Virtual Function, these are required for adding the device.
  • Page 221: Troubleshooting Sr-Iov

    Troubleshooting SR-IOV Open the XML configuration file with the virsh edit command. This example edits a guest named MyGuest. # virsh edit MyGuest The default text editor will open the libvirt configuration file for the guest. Add the new device to the devices section of the XML configuration file.
  • Page 223: Kvm Guest Timing Management

    Chapter 15. KVM guest timing management Virtualization poses various challenges for guest time keeping. Guests which use the Time Stamp Counter (TSC) as a clock source may suffer timing issues as some CPUs do not have a constant Time Stamp Counter. Guests without accurate timekeeping may have issues with some networked applications and processes as the guest will run faster or slower than the actual time and fall out of synchronization.
  • Page 224 5.4 x86 without the para- divider=10 clocksource=acpi_pm lpj=n virtualized clock 5.3 AMD64/Intel 64 divider=10 notsc 5.3 x86 divider=10 clocksource=acpi_pm 4.8 AMD64/Intel 64 notsc divider=10 4.8 x86 clock=pmtmr divider=10 3.9 AMD64/Intel 64 Additional parameters are not required 3.9 x86 Additional parameters are not required https://bugzilla.redhat.com/show_bug.cgi?id=513138...
  • Page 225 Using the Real-Time Clock with Windows Server 2003 and Windows XP guests Windows uses the both the Real-Time Clock (RTC) and the Time Stamp Counter (TSC). For Windows guests the Real-Time Clock can be used instead of the TSC for all time sources which resolves guest timing issues.
  • Page 227: Iv. Administration

    Part IV. Administration Administering virtualized systems These chapters contain information for administering host and virtualized guests using tools included in Red Hat Enterprise Linux.
  • Page 229: Server Best Practices

    Chapter 16. Server best practices The following tasks and tips can assist you with securing and ensuring reliability of your Red Hat Enterprise Linux 5 server host (dom0). • Run SELinux in enforcing mode. You can do this by executing the command below. # setenforce 1 •...
  • Page 231: Security For Virtualization

    Chapter 17. Security for virtualization When deploying virtualization technologies on your corporate infrastructure, you must ensure that the host cannot be compromised. The host, in the Xen hypervisor, is a privileged domain that handles system management and manages all virtual machines. If the host is insecure, all other domains in the system are vulnerable.
  • Page 232: Selinux

    Chapter 17. Security for virtualization Procedure 17.1. Creating and mounting a logical volume on a virtualized guest with SELinux enabled Create a logical volume. This example creates a 5 gigabyte logical volume named NewVolumeName on the volume group named volumegroup. # lvcreate --n NewVolumeName --L 5G volumegroup Format the NewVolumeName logical volume with a file system that supports extended attributes,...
  • Page 233: Virtualization Firewall Information

    Virtualization firewall information # semanage fcontext --a --t xen_image _t --f --b -/dev/sda2 # restorecon -/dev/sda2 The Boolean parameter xend_disable_t can set the xend to unconfined mode after restarting the daemon. It is better to disable protection for a single daemon than the whole system. It is advisable that you should not re-label directories as xen_image_t that you will use elsewhere.
  • Page 234 Chapter 17. Security for virtualization • Enabling IP forwarding (net.ipv4.ip_forward = 1) is also required for shared bridges and the default bridge. Note that installing libvirt enables this variable so it will be enabled when the virtualization packages are installed unless it was manually disabled.
  • Page 235: Managing Guests With Xend

    Chapter 18. Managing guests with xend The xend node control daemon performs certain system management functions that relate to virtual machines. This daemon controls the virtualized resources, and xend must be running to interact with virtual machines. Before you start xend, you must specify the operating parameters by editing the xend configuration file /etc/xen/xend-config.sxp.
  • Page 236 Chapter 18. Managing guests with xend Item Description (xend-relocation-address) Determines the host addresses allowed for migration. The default value is the value of xend-address. (xend-address) Determines the address that the domain socket server binds to. The default value allows all connections.
  • Page 237: Xen Live Migration

    Chapter 19. Xen live migration migration The Xen hypervisor supports for para-virtualized guests and fully virtualized guests. Migration is only supported on Red Hat Enterprise Linux 5.1 and newer systems. Migration can be performed offline or live. • Offline migration suspends the virtualized guest on the original host, transfers it to the destination host and then resumes it once the guest is fully transferred.
  • Page 238: A Live Migration Example

    Chapter 19. Xen live migration (xend-relocation-server yes) The default value, which disables migration, is no. Change the value of xend-relocation- server to yes to enable migration. (xend-relocation-port 8002) The parameter, (xend-relocation-port), specifies the port xend should use for the relocation interface, if xend-relocation-server is set to yes The default value of this variable should work for most installations.
  • Page 239 A live migration example environment a more robust shared storage configuration using Fibre Channel or iSCSI and GFS is recommended. The configuration below consists of two servers (et-virt07 and et-virt08), both of them are using eth1 as their default network interface hence they are using xenbr1 as their Xen networking bridge.
  • Page 240 Chapter 19. Xen live migration bridge name bridge id STP enabled interfaces xenbr1 8000.feffffffffff peth1 vif0.1 Verify the relocation parameters are configured on both hosts: [et-virt07 ~]# grep xend-relocation -/etc/xen/xend-config.sxp -|grep --v -'#' (xend-relocation-server yes) (xend-relocation-port 8002) (xend-relocation-address -'') (xend-relocation-hosts-allow -'') [et-virt08 ~]# grep xend-relocation -/etc/xen/xend-config.sxp -|grep --v -'#' (xend-relocation-server yes) (xend-relocation-port 8002)
  • Page 241 A live migration example Domain testvm1 started Verify the virtual machine is running: [et-virt07 ~]# virsh list Id Name State ---------------------------------- Domain-0 running testvm1 blocked Save the virtual machine on the local host: [et-virt07 images]# time virsh save testvm1 testvm1.sav real 0m15.744s user...
  • Page 242 Initiate a live migration to et-virt07. You can add the time command to see how long the migration takes: [et-virt08 ~]# xm migrate ---live testvm1 et-virt07 run the script inside the guest: # -./doit dhcp78-218.lab.boston.redhat.com Fri Jan 12 02:26:27 EST 2007 Filesystem 1K-blocks Used Available Use% Mounted on...
  • Page 243 A live migration example -rw-r--r-- 1 root root 186 Jan 12 02:26 -/var/tmp/2279.log Fri Jan 12 02:26:45 EST 2007 dhcp78-218.lab.boston.redhat.com Fri Jan 12 02:26:48 EST 2007 dhcp78-218.lab.boston.redhat.com Fri Jan 12 02:26:51 EST 2007 dhcp78-218.lab.boston.redhat.com Fri Jan 12 06:54:57 EST 2007 dhcp78-218.lab.boston.redhat.com...
  • Page 244 Chapter 19. Xen live migration dhcp78-218.lab.boston.redhat.com Fri Jan 12 06:57:56 EST 2007 Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 2983664 2043120 786536 73% -/ -rw-r--r-- 1 root root 124 Jan 12 06:57 -/var/tmp/2418.log dhcp78-218.lab.boston.redhat.com Fri Jan 12 06:57:53 EST 2007 dhcp78-218.lab.boston.redhat.com...
  • Page 245: Configuring Guest Live Migration

    Configuring guest live migration Id Name State ---------------------------------- Domain-0 running testvm1 blocked and run another cycle: [et-virt08 ~]# time virsh migrate ---live testvm1 et-virt07 real 0m10.378s user 0m0.068s 0m0.052s At this point you have successfully performed an offline and a live migration test. 19.2.
  • Page 247: Kvm Live Migration

    Chapter 20. KVM live migration This chapter covers migrating guests running on a KVM hypervisor to another KVM host. Migration is name for the process of moving a virtualized guest from one host to another. Migration is a key feature of virtualization as software is completely separated from hardware. Migration is useful for: •...
  • Page 248: Share Storage Example: Nfs For A Simple Migration

    Chapter 20. KVM live migration • NFS • GFS2 • Two or more Red Hat Enterprise Linux systems of the same version with the same updates. • Both system must have the appropriate ports open. • Both systems must have identical network configurations. All bridging and network configurations must be exactly the same on both hosts.
  • Page 249: Live Kvm Migration With Virsh

    Live KVM migration with virsh # mount sourceURL:/var/lib/libvirt/images -/var/lib/libvirt/images Locations must be the same on source and destination Whichever directory is chosen for the guests must exactly the same on host and guest. This applies to all types of shared storage. The directory must be the same or the migration will fail.
  • Page 250: Migrating With Virt-Manager

    Chapter 20. KVM live migration Wait The migration may take some time depending on load and the size of the guest. virsh only reports errors. The guest continues to run on the source host until fully migrated. Verify the guest has arrived at the destination host From the destination system, test2.example.com, verify RHEL4test is running: [root@test2 ~]# virsh list Id Name...
  • Page 251 Migrating with virt-manager The Virtual Machine Manager displays a list of connected hosts.
  • Page 252 Chapter 20. KVM live migration Add a storage pool with the same NFS to the source and target hosts. On the Edit menu, click Host Details, the Host Details window appears. Click the Storage tab.
  • Page 253 Migrating with virt-manager Add a new storage pool. In the lower left corner of the window, click the + button. The Add a New Storage Pool window appears. Enter the following details: • Name: Enter the name of the storage pool. •...
  • Page 254 Chapter 20. KVM live migration Click Forward. Enter the following details: • Format: Select the storage type. This must be NFS or iSCSI for live migrations. • Host Name: Enter the IP address or fully-qualified domain name of the storage server.
  • Page 255 Migrating with virt-manager Click Finish. Create a new volume in the shared storage pool, click New Volume.
  • Page 256 Chapter 20. KVM live migration Enter the details, then click Create Volume. Create a virtual machine with the new volume, then run the virtual machine.
  • Page 257 Migrating with virt-manager The Virtual Machine window appears. In the Virtual Machine Manager window, right-click on the virtual machine, select Migrate, then click the migration location.
  • Page 258 Chapter 20. KVM live migration Click Yes to confirm migration. The Virtual Machine Manger displays the virtual machine in its new location.
  • Page 259 Migrating with virt-manager The VNC connection displays the remote host's address in its title bar.
  • Page 260 Chapter 20. KVM live migration...
  • Page 261: Remote Management Of Virtualized Guests

    Chapter 21. Remote management of virtualized guests This section explains how to remotely manage your virtualized guests using ssh or TLS and SSL. 21.1. Remote management with SSH The ssh package provides an encrypted network protocol which can securely send management functions to remote virtualization servers.
  • Page 262: Remote Management Over Tls And Ssl

    Chapter 21. Remote management of virtualized guests $ ssh-keygen --t rsa Coping the keys to the remote hosts Remote login without a password, or with a passphrase, requires an SSH key to be distributed to the systems being managed. Use the ssh-copy-id command to copy the key to root user at the system address provided (in the example, root@example.com).
  • Page 263 Remote management over TLS and SSL based on x509 certificates. In addition the VNC console for each guest virtual machine will be setup to use TLS with x509 certificate authentication. This method does not require shell accounts on the remote machines being managed. However, extra firewall rules are needed to access the management service or VNC console.
  • Page 264: Transport Modes

    Chapter 21. Remote management of virtualized guests 21.3. Transport modes For remote management, libvirt supports the following transport modes: Transport Layer Security (TLS) Transport Layer Security TLS 1.0 (SSL 3.1) authenticated and encrypted TCP/IP socket, usually listening on a public port number. To use this you will need to generate client and server certificates. The standard port is 16514.
  • Page 265 Transport modes • Connect to a remote Xen hypervisor on the host named towada using TLS. xen://towada/ • Connect to a remote Xen hypervisor on host towada using TLS. The no_verify=1 tells libvirt not to verify the server's certificate. xen://towada/?no_verify=1 •...
  • Page 266 Chapter 21. Remote management of virtualized guests Name Transport mode Description Example usage the default is ssh. The PATH is searched for the command. socket unix and ssh The path to the UNIX socket=/opt/libvirt/run/ domain socket, which libvirt/libvirt-sock overrides the default. For ssh transport, this is passed to the remote netcat command (see...
  • Page 267 Transport modes Name Transport mode Description Example usage password if it cannot log in to the remote machine automatically (for using ssh-agent or similar). Use this when you do not have access to a terminal - for example in graphical programs which use libvirt.
  • Page 269: V. Virtualization Storage Topics

    Part V. Virtualization Storage Topics Introduction to storage administration for virtualization This part covers using shared, networked storage with virtualization on Red Hat Enterprise Linux. The following methods are supported for virtualization: • Fibre Channel • iSCSI • NFS • GFS2 Networked storage is essential for live and offline guest migrations.
  • Page 271: Using Shared Storage With Virtual Disk Images

    Chapter 22. Using shared storage with virtual disk images This chapter covers using various types of shared and network storage devices for virtual disks. 22.1. Using iSCSI for storing virtual disk images This chapter covers using iSCSI-based devices to store virtualized guests. 22.2.
  • Page 273: Vi. Virtualization Reference Guide

    Part VI. Virtualization Reference Guide Virtualization commands, system tools, applications and additional systems reference These chapters provide detailed descriptions of virtualization commands, system tools, and applications included in Red Hat Enterprise Linux. These chapters are designed for users requiring information on advanced functionality and other features.
  • Page 275: Virtualization Tools

    System Administration Tools • vmstat • iostat • lsof # lsof --i -:5900 xen-vncfb 10635 root IPv4 218738 TCP grumble.boston.redhat.com:5900 (LISTEN) • qemu-img Advanced Debugging Tools • systemTap • crash • xen-gdbserver • sysrq • sysrq t • sysrq w •...
  • Page 276 Chapter 23. Virtualization tools topology change timer 0.00 gc timer 0.02 flags vif13.0 (3) port id 8003 state forwarding designated root 8000.feffffffffff path cost designated bridge 8000.feffffffffff message age timer 0.00 designated port 8003 forward delay timer 0.00 designated cost hold timer 0.43 flags...
  • Page 277: Managing Guests With Virsh

    Chapter 24. Managing guests with virsh virsh is a command line interface tool for managing guests and the hypervisor. The virsh tool is built on the libvirt management API and operates as an alternative to the xm command and the graphical guest Manager (virt-manager). virsh can be used in read-only mode by unprivileged users.
  • Page 278 Chapter 24. Managing guests with virsh Command Description Changes number of virtual CPUs assigned to a setvcpus guest. Displays virtual CPU information about a guest. vcpuinfo Controls the virtual CPU affinity of a guest. vcpupin Displays block device statistics for a running domblkstat guest.
  • Page 279 Editing a guest's configuration file. You can edit This file guest.xml can recreate the guest (refer to this XML configuration file to configure additional devices or to deploy additional guests. Refer to Section 32.1, “Using XML configuration files with virsh” for more information on modifying files created with virsh dumpxml.
  • Page 280 Chapter 24. Managing guests with virsh # virsh suspend {domain-id, domain-name or domain-uuid} When a guest is in a suspended state, it consumes system RAM but not processor resources. Disk and network I/O does not occur while the guest is suspended. This operation is immediate and the (Resuming a guest) option.
  • Page 281 Forcing a guest to stop Force a guest to stop with the virsh command: # virsh destroy {domain-id, domain-name or domain-uuid} This command does an immediate ungraceful shutdown and stops the specified guest. Using virsh destroy can corrupt guest file systems . Use the destroy option only when the guest is option(Shut down a guest) instead.
  • Page 282 Chapter 24. Managing guests with virsh Displaying host information To display information about the host: # virsh nodeinfo An example of virsh nodeinfo output: # virsh nodeinfo CPU model x86_64 CPU (s) CPU frequency 2895 Mhz CPU socket(s) Core(s) per socket Threads per core: Numa cell(s) Memory size:...
  • Page 283 • Domains in the dying state are in is in process of dying, which is a state where the domain has not completely shut-down or crashed. • crashed guests have failed while running and are no longer running. This state can only occur if the guest has been configured not to restart on crash.
  • Page 284 Chapter 24. Managing guests with virsh systems. A higher maximum memory value does not affect an active guests. If the new value is lower the available memory will shrink and the guest may crash. Displaying guest block device information Use virsh domblkstat to display block device statistics for a running guest. # virsh domblkstat GuestName block-device Displaying guest network device information Use virsh domifstat to display network interface statistics for a running guest.
  • Page 285 # virsh net-dumpxml NetworkName This displays information about a specified virtual network in XML format: # virsh net-dumpxml vnet1 <network> <name>vnet1</name> <uuid>98361b46-1581-acb7-1643-85a412626e70</uuid> <forward dev='eth0'/> <bridge name='vnet0' stp='on' forwardDelay='0' -/> <ip address='192.168.100.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.100.128' end='192.168.100.254' -/> </dhcp> </ip> </network> Other virsh commands used in managing virtual networks are: •...
  • Page 287: Managing Guests With The Virtual Machine Manager (Virt-Manager)

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) This section describes the Virtual Machine Manager (virt-manager) windows, dialog boxes, and various GUI controls. virt-manager provides a graphical view of hypervisors and guest on your system and on remote machines.
  • Page 288: The Virtual Machine Manager Main Window

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Figure 25.1. Virtual Machine Manager connection window 25.2. The Virtual Machine Manager main window This main window displays all the running guests and resources used by guests. Select a virtualized guest by double clicking the guest's name.
  • Page 289: The Guest Overview Tab

    The guest Overview tab Figure 25.2. Virtual Machine Manager main window 25.3. The guest Overview tab The Overview tab displays graphs and statistics of a guest's live resource utilization data available from virt-manager. The UUID field displays the globally unique identifier for the virtual machines.
  • Page 290: Virtual Machine Graphical Console

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Figure 25.3. The Overview tab 25.4. Virtual Machine graphical console This window displays a virtual machine's graphical console. Para-virtualized and fully virtualized guests use different techniques to export their local virtual framebuffers, but both technologies use VNC to make them available to the Virtual Machine Manager's console window.
  • Page 291: Starting Virt-Manager

    Starting virt-manager Figure 25.4. Graphical console window A note on security and VNC VNC is considered insecure by many security experts, however, several changes have been made to enable the secure usage of VNC for virtualization on Red Hat enterprise Linux.
  • Page 292: Restoring A Saved Machine

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Figure 25.5. Starting virt-manager Alternatively, virt-manager can be started remotely using ssh as demonstrated in the following command: ssh --X host's address[remotehost]# virt-manager Section 21.1, “Remote Using ssh to manage virtual machines and hosts is discussed further in management with SSH”.
  • Page 293 Restoring a saved machine From the File menu, select Restore a saved machine. Figure 25.6. Restoring a virtual machine The Restore Virtual Machine main window appears. Navigate to correct directory and select the saved session file. Click Open. The saved virtual system appears in the Virtual Machine Manager main window.
  • Page 294: Displaying Guest Details

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Figure 25.7. A restored virtual machine manager session 25.7. Displaying guest details You can use the Virtual Machine Monitor to view activity data information for any virtual machines on your system. To view a virtual system's details:...
  • Page 295 Displaying guest details In the Virtual Machine Manager main window, highlight the virtual machine that you want to view. Figure 25.8. Selecting a virtual machine to display From the Virtual Machine Manager Edit menu, select Machine Details (or click the Details button on the bottom of the Virtual Machine Manager main window).
  • Page 296 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) The Overview tab summarizes CPU and memory usage for the virtualized guest you specified. Figure 25.10. Displaying guest details overview...
  • Page 297 Displaying guest details On the Virtual Machine window, click the Hardwaretab. Figure 25.11. Displaying guest hardware details...
  • Page 298 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) On the Hardware tab, click on Processor to view or change the current processor allocation. Figure 25.12. Processor allocation panel On the Hardware tab, click on Memory to view or change the current RAM memory allocation. Figure 25.13.
  • Page 299: Status Monitoring

    Status monitoring On the Hardware tab, click on Disk to view or change the current hard disk configuration. Figure 25.14. Displaying disk configuration On the Hardware tab, click on NIC to view or change the current network configuration. Figure 25.15. Displaying network configuration 25.8.
  • Page 300 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) From the Edit menu, select Preferences. Figure 25.16. Modifying guest preferences The Preferences window appears. From the Stats tab specify the time in seconds or stats polling options. Figure 25.17. Configuring status monitoring...
  • Page 301: Displaying Guest Identifiers

    Displaying guest identifiers 25.9. Displaying guest identifiers To view the guest IDs for all virtual machines on your system: From the View menu, select the Domain ID check box. Figure 25.18. Viewing guest IDs The Virtual Machine Manager lists the Domain IDs for all domains on your system. Figure 25.19.
  • Page 302: Displaying A Guest's Status

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) 25.10. Displaying a guest's status To view the status of all virtual machines on your system: From the View menu, select the Status check box. Figure 25.20. Selecting a virtual machine's status The Virtual Machine Manager lists the status of all virtual machines on your system.
  • Page 303: Displaying Virtual Cpus

    Displaying virtual CPUs 25.11. Displaying virtual CPUs To view the amount of virtual CPUs for all virtual machines on your system: From the View menu, select the Virtual CPUs check box. Figure 25.22. Selecting the virtual CPUs option The Virtual Machine Manager lists the Virtual CPUs for all virtual machines on your system. Figure 25.23.
  • Page 304: Displaying Cpu Usage

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) 25.12. Displaying CPU usage To view the CPU usage for all virtual machines on your system: From the View menu, select the CPU Usage check box. Figure 25.24. Selecting CPU usage The Virtual Machine Manager lists the percentage of CPU in use for all virtual machines on your system.
  • Page 305: Displaying Memory Usage

    Displaying memory usage 25.13. Displaying memory usage To view the memory usage for all virtual machines on your system: From the View menu, select the Memory Usage check box. Figure 25.26. Selecting Memory Usage The Virtual Machine Manager lists the percentage of memory in use (in megabytes) for all virtual machines on your system.
  • Page 306: Managing A Virtual Network

    Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) 25.14. Managing a virtual network To configure a virtual network on your system: From the Edit menu, select Host Details. Figure 25.28. Selecting a host's details...
  • Page 307: Creating A Virtual Network

    Creating a virtual network This will open the Host Details menu. Click the Virtual Networks tab. Figure 25.29. Virtual network configuration All available virtual networks are listed on the left-hand box of the menu. You can edit the configuration of a virtual network by selecting it from this box and editing as you see fit. 25.15.
  • Page 308 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Open the Host Details menu (refer to Section 25.14, “Managing a virtual network”) and click the Add button. Figure 25.30. Virtual network configuration This will open the Create a new virtual network menu. Click Forward to continue.
  • Page 309 Creating a virtual network Figure 25.31. Creating a new virtual network...
  • Page 310 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Enter an appropriate name for your virtual network and click Forward. Figure 25.32. Naming your virtual network...
  • Page 311 Creating a virtual network Enter an IPv4 address space for your virtual network and click Forward. Figure 25.33. Choosing an IPv4 address space...
  • Page 312 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) Define the DHCP range for your virtual network by specifying a Start and End range of IP addresses. Click Forward to continue. Figure 25.34. Selecting the DHCP range...
  • Page 313 Creating a virtual network Select how the virtual network should connect to the physical network. Figure 25.35. Connecting to physical network If you select Forwarding to physical network, choose whether the Destination should be NAT to any physical device or NAT to physical device eth0. Click Forward to continue.
  • Page 314 Chapter 25. Managing guests with the Virtual Machine Manager (virt-manager) You are now ready to create the network. Check the configuration of your network and click Finish. Figure 25.36. Ready to create network...
  • Page 315 Creating a virtual network The new virtual network is now available in the Virtual Network tab of the Host Details menu. Figure 25.37. New virtual network is now available...
  • Page 317: The Xm Command Quick Reference

    Chapter 26. The xm command quick reference The xm command can manage the Xen hypervisor. Most operations can be performed with the libvirt tools, virt-manager application or the virsh command. The xm command does not have the error checking capacity of the libvirt tools and should not be used for tasks the libvirt tools support. There are a few operations which currently can not be performed using virt-manager.
  • Page 318 Chapter 26. The xm command quick reference Resource management options Use the following xm commands to manage resources: • xm mem-set • use the xm vcpu-list to list virtualized CPU affinities: $ xm vcpu-list Name VCPUs CPU State Time(s) CPU Affinity Domain-0 708.9 any cpu...
  • Page 319: Configuring The Xen Kernel Boot Parameters

    Chapter 27. Configuring the Xen kernel boot parameters The GNU Grand Unified Boot Loader (GRUB) is a program for booting various installed operating systems or kernels. GRUB also allows the user to pass arguments to the kernel. The GRUB configuration file (located in /boot/grub/grub.conf) creates the list of operating systems the GRUB boot menu interface.
  • Page 320 Chapter 27. Configuring the Xen kernel boot parameters **** Linux config options: propagated to domain0 ****/ -"acpi=off": Disables both ACPI table parsing and interpreter. -"acpi=force": Overrides the disable blacklist. -"acpi=strict": Disables out-of-spec workarounds. -"acpi=ht": Limits ACPI from boot-time to enable HT. -"acpi=noirq": Disables ACPI interrupt routing.
  • Page 321: Configuring Elilo

    Chapter 28. Configuring ELILO ELILO is the boot loader used on EFI-based systems, notably Itanium®. Similar to the GRUB, the boot loader on x86 and x86-64 systems, ELILO allows the user to select which installed kernel to load during the system boot sequence. ELILO also allows the user to pass arguments to the kernel. The ELILO configuration file, which is located in the EFI boot partition and symbolically linked to /etc/ elilo.conf, contains a list of global options and image stanzas.
  • Page 322 Chapter 28. Configuring ELILO append="dom0_mem=2G --- quiet" ELILO hypervisor parameters Parameter Description The mem parameter defines the hypervisor maximum RAM usage. mem= Any additional RAM in the system is ignored. The parameter may be specified with a B, K, M or G suffix; representing bytes, kilobytes, megabytes and gigabytes respectively.
  • Page 323: Libvirt Configuration Reference

    Chapter 29. libvirt configuration reference This chapter provides is a references for various parameters of libvirt XML configuration files Item Description Specifies the physical address extension configuration data. Specifies the advanced programmable interrupt apic controller configuration data. Specifies the memory size in megabytes. memory Specifies the numbers of virtual CPUs.
  • Page 325: Xen Configuration Files

    Chapter 30. Xen configuration files Red Hat Enterprise Linux uses libvirt configuration files for most tasks. Some users may need Xen configuration files which contain the following standard variables. Configuration items within these files must be enclosed in single quotes('). These configuration files reside in the /etc/xen directory. Table 30.1, “Xen configuration file reference”, is formatted output from xm create The table below,...
  • Page 326 Chapter 30. Xen configuration files Parameter Description always restart on exit, ignore exit code - never: never restart on exit, ignore exit code on_poweroff=destroy | restart | Behavior when a domain exits with reason preserve | destroy 'poweroff'. - destroy: the domain is cleaned up as normal;...
  • Page 327 Parameter Description Add an IRQ (interrupt line) to a domain. For irq=IRQ example irq=7. This option may be repeated to add more than one IRQ. Add a physical USB port to a domain, as usbport=PATH specified by the path to that port. This option may be repeated to add more than one port.
  • Page 328 Chapter 30. Xen configuration files Parameter Description created correctly on the system where a domain is started or resumed. DEPRECATED. Use empty vif entries instead. nics=NUM Set the number of network interfaces. Use the vif option to define interface parameters, otherwise defaults are used.
  • Page 329 Parameter Description X11 Authority to use xauthority=XAUTHORITY xenstore UUID (universally unique identifier) uuid to use. One will be randomly generated if this option is not set, just like MAC addresses for virtual network interfaces. This must be a unique value across the entire cluster. Table 30.1.
  • Page 330 Chapter 30. Xen configuration files Parameter Parser function Default value name set_value None bootloader set_value None bootargs set_value None bootentry set_value None kernel set_value None ramdisk set_value features set_value builder set_value 'linux' memory set_int maxmem set_int None shadow_memory set_int set_int None cpus set_value...
  • Page 331 Parameter Parser function Default value set_value gateway set_value netmask set_value hostname set_value interface set_value "eth0" dhcp set_value 'off' nfs_server set_value None nfs_root set_value None device_model set_value set_value set_value serial set_value localtime set_bool keymap set_value set_bool usbdevice set_value stdvga set_bool set_bool boot set_value nographic...
  • Page 333 Part VII. Tips and Tricks Tips and Tricks to Enhance Productivity These chapters contain useful hints and tips to improve virtualization performance, scale and stability.
  • Page 335: Automatically Starting Guests

    Chapter 31. Tips and tricks This chapter contain useful hints and tips to improve virtualization performance, scale and stability. 31.1. Automatically starting guests This section covers how to make virtualized guests start automatically during the host system's boot phase. This example uses virsh to set a guest, TestServer, to automatically start when the host boots. # virsh autostart TestServer Domain TestServer marked as autostarted The guest now automatically starts with the host.
  • Page 336 Chapter 31. Tips and tricks Verify which kernel is in use The kernel-xen package may be installed. Use the uname command to determine which kernel is running: $ uname --r 2.6.18-159.el5xen The present kernel, "2.6.18-159.el5xen", is running on the system. If the default kernel, "2.6.18-159.el5", is running you can skip the substep.
  • Page 337: Kvm To Xen

    KVM to Xen The kvm module and either the kvm_intel module or the kvm_amd module are present if everything worked. 31.2.2. KVM to Xen The following procedure covers changing from the KVM hypervisor to the Xen hypervisor. This procedure assumes the kvm package is installed and enabled. Install the Xen packages Install the kernel-xen and xen package if you have not already done so.
  • Page 338: Using Qemu-Img

    Chapter 31. Tips and tricks initrd -/initrd-2.6.18-159.el5.img title Red Hat Enterprise Linux Server (2.6.18-159.el5xen) root (hd0,0) kernel -/xen.gz-2.6.18-159.el5 module -/vmlinuz-2.6.18-159.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet module -/initrd-2.6.18-159.el5xen.img Reboot to load the new kernel Reboot the system. The computer will restart with the Xen kernel. Verify with the uname command: $ uname --r 2.6.18-159.el5xen...
  • Page 339: Overcommitting With Kvm

    Overcommitting with KVM getting image information the info parameter displays information about a disk image. the format for the info option is as follows: # qemu-img info [-f format] filename give information about the disk image filename. use it in particular to know the size reserved on disk which can be different from the displayed size.
  • Page 340 Overcommitting virtualized CPUs The KVM hypervisor supports overcommitting virtualized CPUs. Virtualized CPUs can be overcommitted as far as load limits of virtualized guests allow. Use caution when overcommitting VCPUs as loads near 100% may cause dropped requests or unusable response times. http://kbase.redhat.com/faq/docs/DOC-15252...
  • Page 341: Modifying /Etc/Grub.conf

    Modifying /etc/grub.conf Virtualized CPUs are overcommitted best when each virtualized guest only has a single VCPU. The Linux scheduler is very efficient with this type of load. KVM should safely support guests with loads under 100% at a ratio of five VCPUs. Overcommitting single VCPU virtualized guests is not an issue. You cannot overcommit symmetric multiprocessing guests on more than the physical number of processing cores.
  • Page 342: Verifying Virtualization Extensions

    Chapter 31. Tips and tricks #boot=/dev/sda default=0 timeout=15 #splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu serial ---unit=0 ---speed=115200 ---word=8 ---parity=no ---stop=1 terminal ---timeout=10 serial console title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21.el5xen) root (hd0,0) kernel -/xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1 dom0_mem=256MB module -/vmlinuz-2.6.17-1.2519.4.21.el5xen ro root=/dev/VolGroup00/LogVol00 module -/initrd-2.6.17-1.2519.4.21.el5xen.img 31.6. Verifying virtualization extensions Use this section to determine whether your system has the hardware virtualization extensions.
  • Page 343: Accessing Data From A Guest Disk Image

    Accessing data from a guest disk image For users of the KVM hypervisor If the kvm package is installed. I As an additional check, verify that the kvm modules are loaded in the kernel: # lsmod -| grep kvm If the output includes kvm_intel or kvm_amd then the kvm hardware virtualization modules are loaded and your system meets requirements.
  • Page 344 Chapter 31. Tips and tricks # kpartx --a -/var/lib/libvirt/images/guest1.img • Test that the partition mapping worked. There should be new devices in the /dev/mapper/ directory # ls -/dev/mapper/ loop0p1 loop0p2 The mappings for the image are named in the format loopXpY. Mount the loop device which to a directory.
  • Page 345: Setting Kvm Processor Affinities

    Setting KVM processor affinities 2 logical volumes in volume group VolGroup00 now active. Use the lvs command to display information about the new volumes. The volume names (the LV column) are required to mount the volumes. # lvs LV VG Attr Lsize Origin Snap% Move Log Copy% LogVol00 VolGroup00 --wi-a- 5.06G LogVol01 VolGroup00 --wi-a- 800.00M Mount /dev/VolGroup00/LogVol00 in the /mnt/guestboot/ directory.
  • Page 346 Chapter 31. Tips and tricks # virsh nodeinfo CPU model: x86_64 CPU(s): CPU frequency: 1000 MHz CPU socket(s): Core(s) per socket: Thread(s) per core: NUMA cell(s): Memory size: 8179176 kB This system has eight CPUs, in two sockets, each processor has four cores. The output shows that that the system has a NUMA architecture.
  • Page 347 Setting KVM processor affinities physical CPUs 0 to 3, or 4 to 7 to avoid accessing non-local memory, which are significantly slower than accessing local memory. If a guest requires eight virtual CPUs, as each NUMA node only has four physical CPUs, a better utilization may be obtained by running a pair of four virtual CPU guests and splitting the work between them, rather than using a single 8 CPU guest.
  • Page 348 Chapter 31. Tips and tricks <vcpus>4</vcpus> The guest in this example has four CPUs. Add a cpuset attribute with the CPU numbers for the relevent NUMA cell. <vcpus cpuset='4-7'>4</vcpus> Save the configuration file and restart the guest. The guest has been locked to CPUs 4 to 7. Automatically locking guests to CPUs with virt-install The virt-install provisioning tool provides a simple way to automatically apply a 'best fit' NUMA policy when guests are created.
  • Page 349: Identifying Guest Type And Implementation

    Identifying guest type and implementation To lock the virtual CPUs to the second NUMA node (CPUs four to seven), run the following commands. # virsh vcpupin guest1 0 4 # virsh vcpupin guest1 1 5 # virsh vcpupin guest1 2 6 # virsh vcpupin guest1 3 7 The virsh vcpuinfo command confirms the change in affinity.
  • Page 350: Generating A New Unique Mac Address

    Chapter 31. Tips and tricks check_para() if $(grep --q control_d -/proc/xen/capabilities); then echo -"Host is dom0" IS_PARA=1 else echo -"Guest is para-virt domU" IS_PARA=1 if [ --f -/proc/acpi/dsdt -]; then check_hvm if [ ${IS_HVM} --eq 0 -]; then if [ --f -/proc/xen/capabilities -] -; then check_para if [ ${IS_HVM} --eq 0 --a ${IS_PARA} --eq 0 -];...
  • Page 351: Limit Network Bandwidth For A Xen Guest

    Limit network bandwidth for a Xen guest # echo -'import virtinst.util -; print\ virtinst.util.uuidToString(virtinst.util.randomUUID())' -| python # echo -'import virtinst.util -; print virtinst.util.randomMAC()' -| python The script above can also be implemented as a script file as seen below. #!/usr/bin/env python --*- mode: python;...
  • Page 352: Configuring Xen Processor Affinities

    Chapter 31. Tips and tricks This rate entry would limit the virtual machine's interface to 10MB/s for outgoing traffic 31.12. Configuring Xen processor affinities Xen can allocate virtual CPUs to associate with one or more host CPUs. This allocates real processing resources to virtualized guests.
  • Page 353: Very Secure Ftpd

    Very Secure ftpd serial ---unit=0 ---speed =115200 ---word=8 ---parity=no ---stop=1 terminal ---timeout=10 serial console title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21. el5xen) root (hd0,0) kernel -/xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1 dom0_mem=256MB module -/vmlinuz-2.6.17-1.2519.4.21.el5xen ro root=/dev/VolGroup00/LogVol00 module -/initrd-2.6.17-1.2519.4.21.el5xen.img 31.14. Very Secure ftpd vsftpd can provide access to installation trees for para-virtualized guests (for example, the Red Hat Enterprise Linux 5 repositories) or other data.
  • Page 354 Chapter 31. Tips and tricks # options=-b Then replace it with this parameter: # options=-g This tells udev to monitor all system SCSI devices for returning UUIDs. To determine the system UUIDs, use the scsi_id command: # scsi_id --g --s -/block/sdc *3600a0b80001327510000015427b625e* The long string of characters in the output is the UUID.
  • Page 355: Disable Smart Disk Monitoring For Guests

    Disable SMART disk monitoring for guests This defines 4 LUNs: /dev/mpath/oramp1, /dev/mpath/oramp2, /dev/mpath/oramp3, and dev/mpath/oramp4. The devices will reside in the /dev/mpath directory. These LUN names are persistent after reboots as it creates aliased names on the wwid for each of the LUNs. 31.16.
  • Page 356: Cloning Guest Configuration Files

    Chapter 31. Tips and tricks 31.19. Cloning guest configuration files You can copy an existing configuration file to create an all new guest. You must modify the name parameter of the guests' configuration file. The new, unique name then appears in the hypervisor and is viewable by the management utilities.
  • Page 357 Duplicating an existing guest and its configuration file /etc/sysconfig/network-scripts/ifcfg-eth0 • Modify the HWADDR address to the output from ifconfig eth0 • Modify the IPADDR entry if a static IP address is used.
  • Page 359 You can add devices defined in an XML file to a running para- virtualized guest. For example, to add a ISO file as hdc to a running guest create an XML file: # cat satelliteiso.xml <disk type="file" device="disk"> <driver name="file"/> <source file="/var/lib/libvirt/images/rhn-satellite-5.0.1-11-redhat-linux-as-i386-4-embedded- oracle.iso"/> <target dev="hdc"/> <readonly/> </disk>...
  • Page 361 Red Hat Enterprise Linux Release Notes for your version and hardware architecture. The Release Notes can be found in the documentation section of the Red www.redhat.com/docs/manuals/enterprise/ Hat website, If all else fails... Contact Red Hat Global Support Services (https://www.redhat.com/apps/support/). Our staff can assist you in resolving your issues.
  • Page 363 Chapter 33. Troubleshooting Xen This chapter covers essential concepts to assist you in troubleshooting problems in Xen. Troubleshooting topics covered in this chapter include: • troubleshooting tools for Linux and virtualization. • troubleshooting techniques for identifying problems. • The location of log files and explanations of the information in logs. This chapter is to give you, the reader, a background to identify where problems with virtualization technologies are.
  • Page 364: Log Files Overview

    Chapter 33. Troubleshooting Xen • ifconfig • tcpdump The tcpdump command 'sniffs' network packets. tcpdump is useful for finding network abnormalities and problems with network authentication. There is a graphical version of tcpdump named wireshark. • brctl brctl is a networking tool that inspects and configures the Ethernet bridge configuration in the Virtualization linux kernel.
  • Page 365: Log File Descriptions

    Log file descriptions • The Xen configuration directory is /etc/xen/. This directory contains the xend daemon and other virtual machine configuration files. The networking script files are found in the scripts directory. • All Xen log files are stored in the /var/log/xen directory. •...
  • Page 366: Troubleshooting With The Logs

    Chapter 33. Troubleshooting Xen • The proc folders are another resource that allows you to gather system information. These proc entries reside in the /proc/xen directory: /proc/xen/capabilities /proc/xen/balloon /proc/xen/xenbus/ 33.5. Troubleshooting with the logs When encountering installation issues with Xen, refer to the host system's two logs to assist with troubleshooting.
  • Page 367: Para-Virtualized Guest Console Access

    Para-virtualized guest console access console. The parameters "console=ttyS0" and "console=tty" means that kernel errors get logged with on both the normal VGA console and on the serial console. Then you can install and set up ttywatch to capture the data on a remote host connected by a standard null-modem cable. For example, on the remote host you could type: Itanium serial console troubleshooting To access the hypervisor via a serial console on the Itanium®...
  • Page 368: Guest Creation Errors

    Chapter 33. Troubleshooting Xen Traceback (most recent call last:) File -"/usr/sbin/xend/", line 33 in -? from xen.xend.server. import SrvDaemon File -"/usr/lib/python2.4/site-packages/xen/xend/server/SrvDaemon.py" -, line 26 in -? from xen.xend import XendDomain File -"/usr//lib/python2.4/site-packages/xen/xend/XendDomain.py" -, line 33, in -? from xen.xend import XendDomainInfo File -"/usr/lib/python2.4/site-packages/xen/xend/image.py"...
  • Page 369: Xen Serial Console Output From Para-Virtualized Guests

    Xen serial console output from para-virtualized guests If your serial console is on com2, modify /boot/grub/grub.conf by inserting the lines com2=115200,8n1 console=com2L, console=tty0 and console=ttyS0,115200 where shown. title Red Hat Enterprise Linux 5 i386 Xen (2.6.18-92.el5xen) root (hd0, 8) kernel -/boot/xen.gz-2.6.18-92.el5 com2=115200,8n1 console=com2L module -/boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=VG_i386 console=tty0 console=ttyS0,115200 module -/boot/initrd-2.6.18-92.el5xen.img...
  • Page 370: Serial Console Output From Fully Virtualized Guests

    Chapter 33. Troubleshooting Xen Logs from the guest serial consoles are stored in the /var/log/xen/console file. 33.11.3. Serial console output from fully virtualized guests This section covers how to enable serial console output for fully virtualized guests. Fully virtualized guest serial console output can be viewed with the "virsh console" command. Be aware fully virtualized guest serial consoles have some limitations.
  • Page 371: Interpreting Xen Error Messages

    Interpreting Xen error messages "type=ieomu, mac=00:16:3e:09:f0:13 -] vnc = 1 vncunused = 1 uuid = -"302bd9ce-4f60-fc67-9e40-7a77d9b4e1ed" bootloader = -"/usr/bin/pygrub" vcpus=2 on_reboot = -"restart" on_crash = -"restart" Note that the serial="pty" is the default for the configuration file. This configuration file example is for a fully-virtualized guest: name = -"rhel5u5-86_64"...
  • Page 372 Chapter 33. Troubleshooting Xen wrong kernel image: non-PAE kernel on a PAE This message indicates that you are trying to run an unsupported guest kernel image on your hypervisor. This happens when you try to boot a non-PAE, para-virtualized guest kernel on a Red Hat Enterprise Linux 5 host.
  • Page 373 Interpreting Xen error messages localhost.localdomain. localhost You receive the following error (in the xen-xend.logfile ): Bridge xenbr1 does not exist! This happens when the guest's bridge is incorrectly configured and this forces the Xen hotplug scripts to timeout. If you move configuration files between hosts, you must ensure that you update the guest configuration files to reflect network topology and configuration modifications.
  • Page 374: The Layout Of The Log Directories

    Chapter 33. Troubleshooting Xen execfile (defconfig, globs, locs,) Error: invalid syntax 9win2k3xen12, line1) Python generates these messages when an invalid (or incorrect) configuration file. To resolve this problem, you must modify the incorrect configuration file, or you can generate a new one. 33.14.
  • Page 375: After Rebooting Xen-Based Guests The Console Freezes

    Chapter 34. Troubleshooting This chapter covers common problems and solutions with Red Hat Enterprise Linux virtualization. 34.1. Identifying available storage and partitions Verify the block driver is loaded and the devices and partitions are available to the guest. This can be done by executing "cat /proc/partitions"...
  • Page 376: Failed Domain Creation Caused By A Memory Shortage

    Chapter 34. Troubleshooting options loop max_loop=64 This example uses 64 but you can specify another number to set the maximum loop value. You may also have to implement loop device backed guests on your system. To employ loop device backed guests for a para-virtualized guest, use the phy: block device or tap:aio commands.
  • Page 377: Wrong Kernel Image Error - Non-Pae Kernel On A Pae Platform

    Wrong kernel image error - non-PAE kernel on a PAE platform The numbering starts at '0' so if your kernel-xen entry is the second entry you would enter '1' as the default,for example “default=1”. 34.7. Wrong kernel image error - non-PAE kernel on a PAE platform If you to boot a non-PAE kernel, para-virtualized guest the error message below will display.
  • Page 378: Microcode Error During Guest Boot

    Chapter 34. Troubleshooting # that require network functionality will fail. localhost.localdomain localhost The correct entry should look similar to the following: # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost localhost.localdomain localhost 34.10.
  • Page 379: Kvm Networking Performance

    KVM networking performance The virtualization extensions are sometimes disabled in BIOS, usually by laptop manufacturers. Section 34.12, “Enabling Intel VT and AMD-V virtualization hardware extensions in BIOS” Refer to instructions on enabling disabled virtualization extensions. Verify the virtualization extensions are enabled in BIOS. The BIOS settings for Intel® VT or AMD- V are usually in the Chipset or Processor menus.
  • Page 380 Chapter 34. Troubleshooting A workaround is to switch to a different type of virtualized NIC. For example, Intel PRO/1000 (e1000) or virtio (the para-virtualized network driver). To switch to the e1000 driver: Shutdown the guest operating system. Edit the guest's configuration file with the virsh command (where GUEST is the guest's name): # virsh edit GUEST The virsh edit command uses the $EDITOR shell variable to determine which editor to use.
  • Page 381 KVM networking performance Create the new virtual machine: # virsh define -/tmp/new-guest.xml # virsh start new-guest The network performance should be better with the e1000 or virtio driver. (BZ#517181 https://bugzilla.redhat.com/show_bug.cgi?id=517181...
  • Page 383: Troubleshooting The Xen Para-Virtualized Drivers

    Chapter 35. Troubleshooting the Xen para- virtualized drivers This chapter deals with issues you may encounter with Xen hosts and fully virtualized Red Hat Enterprise Linux guests using the para-virtualized drivers. 35.1. Red Hat Enterprise Linux 5 Virtualization log file and directories Red Hat Enterprise Linux 5 Virtualization related log file In Red Hat Enterprise Linux 5, the log file written by the xend daemon and the qemu-dm process are...
  • Page 384: Operating System

    Chapter 35. Troubleshooting the Xen para-virtualized drivers Note The logfile is overwritten every time you start virt-manager. If you are troubleshooting a problem with virt-manager make sure you save the logfile before you restart virt- manager after an error has occurred. Red Hat Enterprise Linux 5 Virtualization related directories There are a few other directories and files which may be of interest when troubleshooting a Red Hat Enterprise Linux 5 Virtualization environment:...
  • Page 385: Red Hat Enterprise Linux 3

    A warning message is displayed while installing the para-virtualized drivers on Red Hat Enterprise Linux 3 Warning: kernel-module version mismatch xen-platform-pci.o was compiled for kernel version 2.4.21-52.EL while this kernel is version 2.4.21-50.EL xen-platform-pci.o: unresolved symbol __ioremap_R9eac042a xen-platform-pci.o: unresolved symbol flush_signals_R50973be2 xen-platform-pci.o: unresolved symbol pci_read_config_byte_R0e425a9e xen-platform-pci.o: unresolved symbol __get_free_pages_R9016dd82 [...]...
  • Page 386: Verifying The Para-Virtualized Drivers Have Successfully Loaded

    Chapter 35. Troubleshooting the Xen para-virtualized drivers 35.5. Verifying the para-virtualized drivers have successfully loaded One of the first tasks you will want to do is to verify that the drivers have actually been loaded into your system. After the para-virtualized drivers have been installed and the guest has been rebooted you can verify that the drivers have loaded.
  • Page 387: A. Additional Resources

    • The Xen Community website http://www.xen.org/ http://www.libvirt.org/ • is the official website for the libvirt virtualization API. http://virt-manager.et.redhat.com/ is the project website for the Virtual Machine Manager (virt- • manager), the graphical application for managing virtual machines. • Open Virtualization Center http://www.openvirtualization.com...
  • Page 388 Appendix A. Additional resources • /usr/share/doc/python-virtinst-<version-number> — Provides documentation on the virt-install command that helps in starting installations of Fedora and Red Hat Enterprise Linux related distributions inside of virtual machines. • /usr/share/doc/virt-manager-<version-number> — Provides documentation on the Virtual Machine Manager, which provides a graphical tool for administering virtual machines.
  • Page 389: Glossary

    Glossary This glossary is intended to define the terms used in this Installation Guide. Bare-metal The term bare-metal refers to the underlying physical architecture of a computer. Running an operating system on bare-metal is another way of referring to running an unmodified version of the operating system on the physical hardware.
  • Page 390 Glossary Short for input/output (pronounced "eye-oh"). The term I/O describes any program, operation or device that transfers data to or from a computer and to or from a peripheral device. Every transfer is an output from one device and an input into another. Devices such as keyboards and mouses are input-only devices while devices such as printers are output-only.
  • Page 391 • Energy saving - guests can be redistributed to other hosts and host systems powered off to save energy and cut costs in low usage periods. • Geographic migration - guests can be moved to another location for lower latency or in serious circumstances. Shared, networked storage is used for storing guest images.
  • Page 392 Glossary Para-virtualized drivers Para-virtualized drivers are device drivers that operate on fully virtualized Linux guests. These drivers greatly increase performance of network and block device I/O for fully virtualized guests. PCI passthrough KVM and Xen hypervisors support attaching PCI devices on the host system to virtualized guests.
  • Page 393 • Hardware-assisted virtualization is the technique used for full Full virtualization) virtualization with Xen and KVM (definition: • Para-virtualization is a technique used by Xen to run Linux guests (definition: Para-virtualization) • Software virtualization or emulation. Software virtualization uses binary translation and other emulation techniques to run unmodified operating systems.
  • Page 394 Glossary...
  • Page 395: B. Revision History

    Appendix B. Revision History Revision Tue Apr 20 2010 Christopher Curran ccurran@redhat.com 5.5-114 BZ#573558 Fixes , and expands SR-IOV content. Revision Fri Apr 09 2010 Christopher Curran ccurran@redhat.com 5.5-110 BZ#559052 Fixes , expands the KVM para-virtualized drivers chapter. Revision Thu Apr 01 2010 Christopher Curran ccurran@redhat.com...
  • Page 396 Appendix B. Revision History Revision Thu Dec 11 2009 Christopher Curran ccurran@redhat.com 5.4-77 BZ#449696 Fixes Revision Tue Nov 17 2009 Christopher Curran ccurran@redhat.com 5.4-73 BZ#536709 Fixes Revision Fri Nov 06 2009 Christopher Curran ccurran@redhat.com 5.4-72 Fixes errors reported by translators.
  • Page 397 Updated the KVM para-virtualized drivers section. Revision Thu Aug 06 2009 Christopher Curran ccurran@redhat.com 5.4-44 32 bugs fixed. Revision Tue Aug 04 2009 Christopher Curran ccurran@redhat.com 5.4-42 New Red Hat Enterprise Linux installation chapter. Revision Mon Aug 03 2009 Christopher Curran ccurran@redhat.com...
  • Page 398 Appendix B. Revision History Resolves 487407 and minor copy edits. Revision Mon Feb 23 2009 Christopher Curran ccurran@redhat.com 5.3-19 Resolves 486294 and minor copy edits. Revision Tue Jan 20 2009 Christopher Curran ccurran@redhat.com 5.2-18 Resolves various bugs and other documentation fixes including:...
  • Page 399 Resolves: BZ #449679 Resolves: BZ #449680 Revision Wed May 14 2008 Christopher Curran ccurran@redhat.com 5.2-10 New or rewritten sections for troubleshooting, networking and installation Various updates for spelling, grammar and language Formatting and layout issues resolved Updated terminology and word usage to enhance usability and readability Revision 5.2-9...
  • Page 401: C. Colophon

    Appendix C. Colophon This manual was written in the DocBook XML v4.3 format. This book is based on the work of Jan Mark Holzer and Chris Curran. Other writing credits go to: • Don Dutile contributed technical editing for the para-virtualized drivers section. •...
  • Page 402 Appendix C. Colophon • Leticia de Lima • Spanish • Angela Garcia • Gladys Guerrero • Russian • Yuliya Poyarkova...

Table of Contents