Red Hat Enterprise Linux 5 Virtualization Guide Virtualization Documentation Scott Radvan Jan Mark Holzer Dayle Parker Christopher Curran
Red Hat Enterprise Linux 5 Virtualization Guide Virtualization Documentation Sco tt Radvan Red Hat Engineering Co ntent Services sradvan@redhat.co m Dayle Parker Red Hat Engineering Co ntent Services dayleparker@redhat.co m Christo pher Curran Red Hat Engineering Co ntent Services ccurran@redhat.
Legal Notice Co pyright © 20 0 8–20 14 Red Hat, Inc. This do cument is licensed by Red Hat under the Creative Co mmo ns Attributio n-ShareAlike 3.0 Unpo rted License. If yo u distribute this do cument, o r a mo dified versio n o f it, yo u must pro vide attributio n to Red Hat, Inc. and pro vide a link to the o riginal. If the do cument is mo dified, all Red Hat trademarks must be remo ved.
T able of Cont ent s T able of Contents .Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6. . . . . . . . . . 1. Ab o ut this b o o k 6 1.1. O verview 6 2 . Do c ument Co nventio ns 6 2 .1. Typ o g rap hic Co nventio ns 6 2 .2. Pull-q uo te Co nventio ns 8 2 .3. No tes and Warning s 3 . We need yo ur feed b ac k 3 .1. Tec hnic al review req ues ts 4 .
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 8 .5. Ins talling Wind o ws Server 20 0 8 as a fully virtualiz ed g ues t 116 . .art P . . .III. . . Configurat . . . . . . . . . .ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.2. 8. . . . . . . . . . . . . . . . . . . . . Virt Configuring . . . .ualiz . . . .at . .ion . . .in . . Red . . . . Hat . . . .Ent . . .erprise . . . . . . Linux . . . . . . . . . . . .
T able of Cont ent s 16 .1. Intro d uc tio n 20 4 16 .2. Us ing SR-IO V 20 4 16 .3. Tro ub les ho o ting SR-IO V 20 8 . .hapt C . . . .er . .1. 7. .. KVM . . . . .guest . . . . . t. iming . . . . . management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.0. 9. . . . . . . . . . . .art P . . .IV. . . Administ . . . . . . . . rat . . .ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 2 7.6 . Res to ring a s aved mac hine 271 2 7.7. Dis p laying g ues t d etails 272 2 7.8 . Status mo nito ring 276 2 7.9 . Dis p laying g ues t id entifiers 2 7.10 . Dis p laying a g ues t' s s tatus 277 278 2 7.11. Dis p laying virtual CPUs 279 2 7.12. Dis p laying CPU us ag e 28 0 2 7.13. Dis p laying memo ry us ag e 28 1 2 7.14. Manag ing a virtual netwo rk 2 7.15. Creating a virtual netwo rk 28 2 28 3 . .hapt C . . . .er . .
T able of Cont ent s 3 5.2. Lo g files o verview 333 3 5.3. Lo g file d es c rip tio ns 334 3 5.4. Imp o rtant d irec to ry lo c atio ns 3 5.5. Tro ub les ho o ting with the lo g s 334 335 3 5.6 . Tro ub les ho o ting with the s erial c o ns o le 335 3 5.7. Para-virtualiz ed g ues t c o ns o le ac c es s 336 3 5.8 . Fully virtualiz ed g ues t c o ns o le ac c es s 336 3 5.9 . Co mmo n Xen p ro b lems 3 5.10 . G ues t c reatio n erro rs 336 337 3 5.11.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Preface The Red Hat Enterprise Linux Virtualization Guide covers all aspects of using and managing virtualization products included with Red Hat Enterprise Linux. 1. About t his book 1.1. Overview This book is divided into 8 parts: Requirements and Limitations Installation Configuration Administration Storage Reference Tips and Tricks Troubleshooting 2.
Preface The first example highlights a particular key to press. The second example highlights a key combination: a set of three keys pressed simultaneously. If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in mono-spaced bold. For example: File-related classes include filesystem for file systems, file for files, and dir for directories. Each class has its own associated set of permissions.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 2.2. Pull-quot e Convent ions Terminal output and source code listings are set off visually from the surrounding text.
Preface Warning Warnings should not be ignored. Ignoring warnings will most likely cause data loss. 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 better, we would love to hear from you. Submit a report in Bugzilla: http://bugzilla.redhat.com/ against R ed H at En t erp rise Lin u x 5 with the Virt u aliz at io n _G u id e component.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Virtualization is a broad computing term for running software, usually operating systems, concurrently and isolated from other programs on one system. Most existing implementations of virtualization use a hypervisor, a software layer that controls hardware and provides guest operating systems with access to underlying hardware devices.
Preface In essence, virtualization increases flexibility by decoupling an operating system and the services and applications supported by that system from a specific physical hardware platform. It allows the establishment of multiple virtual environments on a shared hardware platform.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide complementary workloads in your organization, you can dynamically allocate resources to the applications which are currently experiencing the greatest demand. If you have peak workloads that you are currently provisioning inside your organization, you may be able to buy capacity on demand externally and implement it efficiently using virtual technology. Cost savings from server consolidation can be compelling.
P art I. Requirement s and Limit at ions for Virt ualiz at ion wit h Red Hat Ent erprise 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 1. System requirements This chapter lists system requirements for successfully running virtualization with Red Hat Enterprise Linux. The requirements for virtualization vary depending on the type of hypervisor. The Kernel-based Virtual Machine (KVM) and Xen hypervisors are provided with Red Hat Enterprise Linux 5. Both support Full virtualization. The Xen hypervisor also supports Para-virtualization.
Chapt er 1 . Syst em requirement s K VM req u iremen t s 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 AMD 64 extensions. See Section 33.6, “ Verifying virtualization extensions” to determine if your processor has the virtualization extensions.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 2. Xen restrictions and support Red Hat Enterprise Linux 5 supports various combinations for hosts and guests. Processor and memory limitations exist and can be viewed at the following URLs: For host systems: http://www.redhat.com/products/enterprise-linux/server/compare.html For hypervisors: http://www.redhat.
Chapt er 3. KVM rest rict ions and support Chapter 3. KVM restrictions and support The KVM hypervisor requires a processor with the Intel-VT or AMD -V virtualization extensions. To verify the presence of the extensions in your system, see Section 33.6, “ Verifying virtualization extensions” . The following URLs explain the processor and memory amount limitations for Red Hat Enterprise Linux: For host systems: http://www.redhat.com/products/enterprise-linux/server/compare.html For hypervisors: http://www.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 4. Hyper-V restrictions and support Certification of guests running under the Microsoft Hyper-V server is conducted by Microsoft. Red Hat Enterprise Linux 5 is fully certified to run under the Microsoft Hyper-V server. 4 .1. Hyper-V drivers For enhanced performance, Red Hat Enterprise Linux 5 provides support for Hyper-V para-virtualized drivers.
Chapt er 5. Virt ualiz at ion limit at ions Chapter 5. Virtualization limitations This chapter covers additional limitations of the virtualization packages in Red Hat Enterprise Linux. 5.1. General limit at ions for virt ualiz at ion C o n vert in g b et ween h yp erviso rs There is no support for converting Xen-based guests to KVM or KVM-based guests to Xen. O t h er limit at io n s See the Red Hat Enterprise Linux Release Notes at https://access.redhat.com/site/documentation/ for your version.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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. The default, required devices are: the host bridge, the ISA bridge and usb bridge (the usb and ISA bridges are the same device), the graphics card (using either the Cirrus or qxl driver), and the memory balloon device.
Chapt er 5. Virt ualiz at ion limit at ions Note There are two methods for working around the para-virtualized device limit: using phy devices (devices using the physical access mode) or using LVM on the guest. A host has no limit to the number of phy devices it can have if it has sufficient resources. LVM, or a similar logical partitioning tool, can be used on a block device to create additional logical partitions on a single para-virtualized block device.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide A limit of 254 para-virtualized block devices per host. The total number of block devices (using the tap:aio driver) attached to guests cannot exceed 254 devices. A maximum of 254 block devices using the para-virtualized drivers per guest. A maximum of 15 network devices per guest. A maximum of 15 virtualized SCSI devices per guest.
P art II. Inst allat ion Part II. Installation Virtualization installation topics These chapters describe setting up the host and installing guests with Red Hat Enterprise Linux.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 6. Installing the virtualization packages Before you can use virtualization, the virtualization packages must be installed on Red Hat Enterprise Linux. These can be installed either during installation, or after installation using the yum command. You can install both the KVM and Xen hypervisors on a single system.
Chapt er 6 . Inst alling t he virt ualiz at ion packages Select the Virtualization package group and the Customize Now radio button. 4. Select the Virtualization package group. The Virtualization package group selects the Xen hypervisor, virt-manager, libvirt and virt-viewer and all dependencies for installation. 5.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide C u st o miz e t h e p ackag es ( if req u ired ) Customize the Virtualization group if you require other virtualization packages. Press the Close button then the Forward button to continue the installation. Important You require a valid Red Hat account with the virtualization entitlement to receive updates for the virtualization packages.
Chapt er 6 . Inst alling t he virt ualiz at ion packages Note Fully virtualized guests on the Itanium® architecture require the guest firmware image package (xen-ia64-guest-firmware). Append the following package to your kickstart file: xen-ia64-guest-firmware More information on Kickstart is available in the Installation Guide at access.redhat.com 6.2.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide virt-manager virt-manager, also known as Virt u al Mach in e Man ag er, provides a graphical tool for administering virtual machines. It uses libvirt library as the management API. Install the other recommended virtualization packages: # yum install virt-manager libvirt libvirt-python python-virtinst 6.3.
Chapt er 6 . Inst alling t he virt ualiz at ion packages Select the Virtualization package group and the Customize Now radio button. 4. Select the KVM package group. D eselect the Virtualization package group. This selects the KVM hypervisor, virt-manager, libvirt and virt-viewer for installation. 5.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Customize the Virtualization group if you require other virtualization packages. Press the Close button then the Forward button to continue the installation. Important You require a valid virtualization entitlement to receive updates for the virtualization packages. In st allin g K VM p ackag es wit h K ickst art f iles This section describes how to use a Kickstart file to install Red Hat Enterprise Linux with the KVM hypervisor packages.
Chapt er 6 . Inst alling t he virt ualiz at ion packages Ad d in g p ackag es t o yo u r list o f R ed H at acco u n t en t it lemen t s This section describes how to enable entitlements in your Red Hat account for the virtualization packages. You need these entitlements enabled to install and update the virtualization packages on Red Hat Enterprise Linux. You require a valid Red Hat account in order to install virtualization packages on Red Hat Enterprise Linux.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 7. Guest installation overview After you have installed the virtualization packages on the host system you can create guest operating systems. You can create guests using the New button in virt - man ag er or use the command line interface virt-install. Both methods are covered by this chapter. D etailed installation instructions are available for specific versions of Red Hat Enterprise Linux, other Linux distributions and Windows.
Chapt er 7 . G uest inst allat ion overview Pro ced u re 7.1. C reat in g a g u est wit h virt - man ag er 1. O p en virt - man ag er Start virt-manager. Launch the Virt u al Mach in e Man ag er application from the Ap p licat io n s menu and Syst em T o o ls submenu. Alternatively, run the virt-manager command as root. 2. O p t io n al: O p en a remo t e h yp erviso r Open the File -> Add Connection. The dialog box below appears. Select a hypervisor and click the Connect button: 3.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 4.
Chapt er 7 . G uest inst allat ion overview Review the information for your installation and click the Forward button. 5. N ame t h e virt u al mach in e Provide a name for your 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 6. C h o o se virt u aliz at io n met h o d The Choosing a virtualization method window appears. Choose between Paravirtualized 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.
Chapt er 7 . G uest inst allat ion overview Choose the virtualization type and click the Forward button. 7. Select t h e in st allat io n met h o d The Installation Method window asks for the type of installation you selected. Guests can be installed using one of the following methods: Lo cal med ia in st allat io n This method uses a CD -ROM or D VD or an image of an installation CD -ROM or D VD (an .iso file).
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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. See Chapter 10, Network Configuration for information on the required networking configuration for PXE installation. Set the OS type and OS variant. Choose the installation method and click Forward to proceed.
Chapt er 7 . G uest inst allat ion overview If Local install media was selected in the previous step this screen is called Install Media. Select the location of an ISO image or select a D VD or CD -ROM from the dropdown list. Click the Forward button to proceed. b. N et wo rk in st all t ree in st allat io n If Network install tree was selected in the previous step this screen is called Installation Source.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click the Forward button to proceed. c. N et wo rk b o o t ( PXE) PXE installation does not have an additional step. 9. St o rag e set u p The Storage window displays. Choose a disk partition, LUN or create a file-based image for the guest storage. All image files are stored in the /var/lib/libvirt/images/ directory by default. In the default configuration, other directory locations for file-based images are prohibited by SELinux.
Chapt er 7 . G uest inst allat ion overview 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/. If you are using a different location (such as /images/ in this example) make sure it is labeled according to SELinux policy before you continue with the installation. See Section 19.2, “ SELinux and virtualization” for details. 10.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 11. Memo ry an d C PU allo cat io n 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. Choose a memory value which suits your guest operating system and application requirements.
Chapt er 7 . G uest inst allat ion overview Press Forward to continue. 12. Verif y an d st art g u est in st allat io n The Finish Virtual Machine Creation window presents a summary of all configuration information you entered. Review the information presented and use the Back button to make changes, if necessary. Once you are satisfied click the Finish button and to start the installation process.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide A VNC window opens showing the start of the guest operating system installation process. This concludes the general process for creating guests with virt-manager. Chapter 8, Guest operating system installation procedures contains step-by-step instructions to installing a variety of common operating systems. 7.3. Inst alling guest s wit h PXE This section covers the steps required to install guests with PXE.
Chapt er 7 . G uest inst allat ion overview TYPE=Bridge BOOTPROTO=dhcp ONBOOT=yes Warning The line, TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'. Important Prior to the release of Red Hat Enterprise Linux 5.9, a segmentation fault can occur when the bridge name contains only uppercase characters. Please upgrade to 5.9 or newer if uppercase names are required. b. Start the new bridge by restarting the network service.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # brctl show bridge name installation virbr0 bridge id 8000.001320f76e8e 8000.000000000000 STP enabled no yes interfaces eth1 3. Secu rit y co n f ig u rat io n 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 Note Alternatively, prevent bridged traffic from being processed by iptables rules. In /etc/sysctl.
Chapt er 7 . G uest inst allat ion overview PXE in st allat io n wit h virt - man ag er The steps below are the steps that vary from the standard virt-manager installation procedures. For the standard installations rsee Chapter 8, Guest operating system installation procedures. 1. Select PXE Select PXE as the installation method. 2. Select t h e b rid g e Select Shared physical device and select the bridge created in the previous procedure.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 3. St art t h e in st allat io n The installation is ready to start.
Chapt er 7 . G uest inst allat ion overview A D HCP request is sent and if a valid PXE server is found the guest installation processes will start.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 8. Guest operating system installation procedures This chapter covers how to install various guest operating systems in a virtualized environment on Red Hat Enterprise Linux. To understand the basic processes, see Chapter 7, Guest installation overview. Important When installing a Red Hat Enterprise Linux guest, the installer will ask to perform an integrity check on your installation source (CD /D VD media, or ISO file).
Chapt er 8 . G uest operat ing syst em inst allat ion procedures # virt-install -n rhel5PV -r 500 \ -f /var/lib/libvirt/images/rhel5PV.dsk -s 3 --vnc -p \ -l ftp://10.1.1.1/trees/RHEL5-B2-Server-i386/ Note Red Hat Enterprise Linux can be installed without a graphical interface or manual input. Use Kickstart files to automate the installation process.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 2. Select the keyboard layout and click OK.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 3. Assign the guest's network address.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 4.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 5. If you chose a static IP address for your guest this prompt appears. Enter the details on the guest's networking configuration: a. Enter a valid IP address. Ensure the IP address you enter can reach the server with the installation tree. b. Enter a valid Subnet mask, default gateway and name server address. Select the language and click OK.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 6.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 7.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Once the initial steps are complete the graphical installation process starts.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures If you are installing a Beta or early release distribution confirm that you want to install the operating system.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Pro ced u re 8.2. T h e g rap h ical in st allat io n p ro cess 1. Enter a valid registration code.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Note If you skip the registration step, confirm your Red Hat account details after the installation with the rhn_register command. The rhn_register command requires root access. 2.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click Yes to continue. 3. 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. Make your selections then click Forward. 4. Confirm the selected storage for the installation. Click Yes to continue.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 5. Configure networking and hostname settings. These settings are populated with the data entered earlier in the installation process. Change these settings if necessary. Click OK to continue. 6. Select the appropriate time zone for your environment.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 7. Enter the root password for the guest.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Click Forward to continue. 8. 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click Forward. 9. D ependencies and space requirements are calculated.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 10. After the installation dependencies and space requirements have been verified click Forward to start the actual installation.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 11. All of the selected software packages are installed automatically.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 12.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 13. The guest will not reboot, instead it will shutdown..
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 14. Boot the guest. The guest's name was chosen when you used the virt-install in Section 8.1, “ Installing Red Hat Enterprise Linux 5 as a para-virtualized guest” . If you used the default example the name is rhel5PV. Use virsh to reboot the guest: # virsh reboot rhel5PV Alternatively, open virt-manager, select the name of your guest, click Open, then click Run. A VN C window displaying the guest's boot processes now opens.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 72
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 15. Booting the guest starts the First Boot configuration screen. This wizard prompts you for some basic configuration choices for your guest. 16. Read and agree to the license agreement.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click Forward on the license agreement windows. 17. Configure the firewall.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Click Forward to continue. a. 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Click Forward to continue. a. If you choose to disable SELinux this warning displays. Click Yes to disable SELinux.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 19. D isable kdump. The use of kdump is unsupported on para-virtualized guests.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click Forward to continue. 21. Set up software updates. If you have a Red Hat account or want to trial one use the screen below to register your newly installed guest.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Click Forward to continue. a. Confirm your choices for RHN.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide b. 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.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click the Forward button. 23. If a sound device is detected and you require sound, calibrate it. Complete the process and click Forward.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 24. You can install additional packages from a CD or another repository using this screen. It is often more efficient to not install any additional software at this point but add packages later using the yum command or RHN. Click Finish.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 25. The guest now configure any settings you changed and continues the boot process.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 26. The Red Hat Enterprise Linux 5 login screen displays. Log in using the username created in the previous steps.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 27. You have now successfully installed a para-virtualized Red Hat Enterprise Linux guest.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 8.2. Inst alling Red Hat Ent erprise Linux as a fully virt ualiz ed 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. The KVM hypervisor requires Red Hat Enterprise Linux 5.4 or newer. Pro ced u re 8.3.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Connect to a hypervisor if you have not already done so. Open the File menu and select the Add Connection... option. See Section 27.1, “ The Add Connection window” . Once a hypervisor connection is selected the New button becomes available. Press the New button. 3. St art t h e n ew virt u al mach in e wiz ard Pressing the New button starts the virtual machine creation wizard. Press Forward to continue. 4.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. 5. C h o o se a virt u aliz at io n met h o d Choose the virtualization method for the guest. Note you can only select an installed virtualization method. If you selected KVM or Xen earlier (Step 4) you must use the hypervisor you selected. This example uses the KVM hypervisor.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 6. Select t h e in st allat io n met h o d Red Hat Enterprise Linux can be installed using one of the following methods: local install media, either an ISO image or physical optical media. Select Network install tree if you have the installation tree for Red Hat Enterprise Linux hosted somewhere on your network via HTTP, FTP or NFS.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. 7. Lo cat e in st allat io n med ia Select ISO image location or CD -ROM or D VD device. This example uses an ISO file image of the Red Hat Enterprise Linux installation D VD . a. Press the Browse button. b. Search to the location of the ISO file and select the ISO image. Press Open to confirm your selection. c. The file is selected and ready to install.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. Warning For ISO image files and guest storage images the recommended directory is /var/lib/libvirt/images/. Any other location may require additional configuration for SELinux, see Section 19.2, “ SELinux and virtualization” for details. 8. St o rag e set u p Assign a physical storage device (Block device) or a file-based image (File). File-based images must be stored in the /var/lib/libvirt/images/ directory.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. Note Live and offline migrations require guests to be installed on shared network storage. For information on setting up shared storage for guests see Part V, “ Virtualization Storage Topics” . 9. N et wo rk set u p 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 guest.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 10. Memo ry an d C PU allo cat io n 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. Choose a memory value which suits your guest operating system and application requirements. Remember, guests use physical RAM.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. 11. Verif y an d st art g u est in st allat io n Verify the configuration.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Finish to start the guest installation procedure. 12. In st allin g R ed H at En t erp rise Lin u x Complete the Red Hat Enterprise Linux 5 installation sequence. The installation sequence is covered by the Installation Guide, see Red Hat D ocumentation for the Red Hat Enterprise Linux Installation Guide. A fully virtualized Red Hat Enterprise Linux 5 Guest is now installed. 8.3.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Important 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. 1. St art in g virt - man ag er Open Ap p licat io n s > Syst em T o o ls > Virt u al Mach in e Man ag er. Open a connection to a host (click File > Ad d C o n n ect io n ).
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide If you selected KVM or Xen earlier (step Step 1 ) you must use the hypervisor you selected. This example uses the KVM hypervisor. Windows can only be installed using full virtualization. 4. C h o o sin g an in st allat io n met h o d This screen enables you to specify the installation method and the type of operating system. Select Windows from the OS Type list and Microsoft Windows XP from the OS Variant list.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Warning For ISO image files and guest storage images it is recommended to use the /var/lib/libvirt/images/ directory. Any other location will require additional configuration for SELinux, see Section 19.2, “ SELinux and virtualization” for details. Press Forward to continue. 5. C h o o se in st allat io n imag e Choose the installation image or CD -ROM.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 6. The Storage window displays. Choose a disk partition, LUN or create a file-based image for the guest's storage. All image files are stored in the /var/lib/libvirt/images/ directory by default. In the default configuration, other directory locations for file-based images are prohibited by SELinux. If you use a different directory you must label the new directory according to SELinux policy. See Section 19.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 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/.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 8. 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. Choose a memory value which suits your guest operating system and application requirements. Most operating system require at least 512MB of RAM to work responsively.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 9. Before the installation continues you will see the summary screen.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 10. You must make a hardware selection so open a console window quickly after the installation starts. Click Finish then switch to the virt - man ag er summary window and select your newly started Windows guest. D ouble 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.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 11. The installation continues with the standard Windows installation.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 12. Partition the hard drive when prompted.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 13. After the drive is formatted, Windows starts copying the files to the hard drive.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 17. If your installation seems to get stuck during the setup phase, restart the guest with virsh reboot WindowsGuestName.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 18. After setup has finished you will see the Windows boot screen: 19.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 20. The setup process is complete.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 8.4 . Inst alling Windows Server 2003 as a fully virt ualiz ed guest This chapter describes installing a fully virtualized Windows Server 2003 guest with the virtinstall command. virt-install can be used instead of virt-manager This process is similar to the Windows XP installation covered in Section 8.3, “ Installing Windows XP as a fully virtualized guest” .
Chapt er 8 . G uest operat ing syst em inst allat ion procedures 3. Complete the rest of the installation.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 4. Windows Server 2003 is now installed as a fully guest. 8.5. Inst alling Windows Server 2008 as a fully virt ualiz ed guest This section covers installing a fully virtualized Windows Server 2008 guest. This procedure covers both the KVM and the Xen hypervisors; the steps are interchangeable and different steps are noted. The KVM hypervisor requires Red Hat Enterprise Linux 5.4 or newer. Pro ced u re 8.4 .
Chapt er 8 . G uest operat ing syst em inst allat ion procedures O p en virt - man ag er Start virt-manager. Launch the Virt u al Mach in e Man ag er application from the Ap p licat io n s menu and Syst em T o o ls submenu. Alternatively, run the virt-manager command as root. 2. Select t h e h yp erviso r Select the hypervisor. If installed, select Xen or KVM. For this example, select KVM. Note that presently KVM is named qemu. Once the option is selected the New button becomes available.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Provide a name for your 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. Press Forward to continue. 5. C h o o se a virt u aliz at io n met h o d Choose the virtualization method for the guest. Note you can only select an installed virtualization method.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. 6. Select t h e in st allat io n met h o d 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. Set OS Type to Windows and OS Variant to Microsoft Windows 2008 as shown in the screenshot.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 7. Lo cat e in st allat io n med ia Select ISO image location or CD -ROM or D VD device. This example uses an ISO file image of the Windows Server 2008 installation CD . a. Press the Browse button. b. Search to the location of the ISO file and select it.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Open to confirm your selection. c. The file is selected and ready to install.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. Warning For ISO image files and guest storage images, the recommended directory to use is the /var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, see Section 19.2, “ SELinux and virtualization” for details. 8. St o rag e set u p Assign a physical storage device (Block device) or a file-based image (File).
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. 9. N et wo rk set u p 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 guest. Use the virtual network option for wireless networks. The shared physical device option uses a network bond to give the guest full access to a network device.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Forward to continue. 10. Memo ry an d C PU allo cat io n 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. Choose a memory value which suits your guest operating system and application requirements. Remember, guests use physical RAM.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Press Forward to continue. 11. Verif y an d st art g u est in st allat io n Verify the configuration.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Finish to start the guest installation procedure. 12.
Chapt er 8 . G uest operat ing syst em inst allat ion procedures Complete the Windows Server 2008 installation sequence. The installation sequence is not covered by this guide, see Microsoft's documentation for information on installing Windows.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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 the Para-virtualized drivers on fully virtualized guests.
Chapt er 9 . Virt ualiz ed st orage devices Chapter 9. Virtualized storage devices This chapter covers installing and configuring storage devices in virtual machines. The term block devices refers to various forms of storage devices. All the procedures in this chapter work with both Xen and KVM hypervisors.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # 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 configuration files, see Chapter 34, Creating custom libvirt scripts. 2. Create a floppy disk image for the guest. # dd if=/dev/zero of=/var/lib/libvirt/images/rhel5FV-floppy.img bs=512 count=2880 3.
Chapt er 9 . Virt ualiz ed st orage devices a. 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. # dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M seek=4096 count=0 b. Non-sparse, pre-allocated files are recommended for file-based storage images.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # fdisk /dev/sdb Command (m for help): b. Press p for a primary partition. Command action e extended p primary partition (1-4) c. Choose an available partition number. In this example the first partition is chosen by entering 1. Partition number (1-4): 1 d. Enter the default first cylinder by pressing Enter. First cylinder (1-400, default 1): e. Select the size of the partition. In this example the entire disk is allocated by pressing Enter.
Chapt er 9 . Virt ualiz ed st orage devices System administrators use additional hard drives for to provide more storage space or to separate system data from user data. This procedure, Procedure 9.1, “ Adding physical block devices to virtual machines” , describes how to add a hard drive on the host to a guest. The procedure works for all physical block devices, this includes CD -ROM, D VD and floppy devices.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Systems which are not running multipath must use Single path configuration. Systems running multipath can use Multiple path configuration. Sin g le p at h co n f ig u rat io n This procedure implements LUN device persistence using udev. Only use this procedure for hosts which are not using multipath. 1. Edit the /etc/scsi_id.config file. a. Ensure the options=-b is line commented out. # options=-b b.
Chapt er 9 . Virt ualiz ed st orage devices /sbin/start_udev Networked storage devices with configured rules now have persistent names on all hosts where the files were updated This means you can migrate guests between hosts using the shared storage and the guests can access the storage devices in their configuration files. Mu lt ip le p at h co n f ig u rat io n The multipath package is used for systems with more than one physical path from the computer to storage devices.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 10. 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 lib virt network architecture documentation. The two common setups are " virtual network" or " shared physical device" . The former is identical across all distributions and available out-of-the-box.
Chapt er 1 0 . Net work Configurat ion 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: net.ipv4.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # # # # chkconfig NetworkManager off chkconfig network on service NetworkManager stop service network start Note As an alternative to turning off NetworkManager, add " NM_CONTROLLED=no" to the ifcfg-* scripts used in the examples. If yo u d o n o t eit h er set t h is p aramet er o r d isab le N et wo rkMan ag er en t irely, an y b rid g e co n f ig u rat io n will b e o verwrit t en an d lo st wh en N et wo rkMan ag er n ext st art s.
Chapt er 1 0 . Net work Configurat ion Note IP address configuration, be it dynamic or static, should be configured on the bridge itself (for example, in the ifcfg-br0 file). Network access will not function as expected if IP address details are configured on the physical interface that twehe bridge is connected to. Warning The line, TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'. After configuring, restart networking or reboot.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 11. 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 the installation process, Chapter 7, Guest installation overview.
Chapt er 1 1 . Pre- Red Hat Ent erprise Linux 5.4 Xen net working Below is the commented out line and the new line, containing the network-xen-multibridge parameter to enable multiple network bridges: #network-script network-bridge network-script network-xen-multi-bridge 4. 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Important 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" adapters when creating guests in virt-manager. N et wo rkMan ag er works with virtual network devices by default in Red Hat Enterprise Linux 5.1 and newer.
Chapt er 1 1 . Pre- Red Hat Ent erprise Linux 5.4 Xen net working 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 3. Bind xenbr0 to dummy0, so you can use networking even when not connected to a physical network. Edit /etc/xen/xend-config.sxp to include the netdev=dummy0 entry: (network-script 'network-bridge bridge=xenbr0 netdev=dummy0') 4.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide echo "IP forwarding set to `cat /proc/sys/net/ipv4/ip_forward`" echo "done." ;; *) echo "Usage: $0 {start|restart|status}" ;; esac C o n f ig u rin g d n smasq f o r t h e D N S, D H C P an d t f t p b o o t services One of the challenges in running virtualization on a laptop (or any other computer which is not connected by a single or stable network connection) is the change in network interfaces and availability.
Chapt er 1 1 . Pre- Red Hat Ent erprise Linux 5.4 Xen net working range=10.1.1.10,10.1.1.50,255.255.255.0,12h Modify dhcp-option to override the default route supplied by dnsmasq, which assumes the router is the same machine as the one running dnsmasq. An example would be dhcpoption=3,10.1.1.1 After configuring dnsmasq you can copy the script below as xenDNSmasq to /etc/init.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 12. 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. Note There are other para-virtualized drivers for Windows for both Xen and KVM hypervisors.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers drivers bring many of the performance advantages of para-virtualized guest operating systems to unmodified 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Red Hat Enterprise Linux 5 requires: kmod-xenpv. Red Hat Enterprise Linux 4 requires: kmod-xenpv, modules-init-tools (for versions prior to Red Hat Enterprise Linux 4.6z you require modules-init-tools-3.1-0.pre5.3.4.el4_6.1 or greater), and modversions. Red Hat Enterprise Linux 3 requires: kmod-xenpv. You require at least 50MB of free disk space in the /lib file system. 12.2.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers K ern el Arch it ect u re i686-PAE i686-SMP i686-HUGEMEM x86_64 x86_64-SMP x86_64-LARGESMP Itanium (IA64) R ed H at En t erp rise Lin u x 3 R ed H at En t erp rise Lin u x 4 R ed H at En t erp rise Lin u x 5 Supported Supported Supported Supported Supported (Intel) (Intel) (AMD ) (AMD ) Supported Supported Supported Supported Supported Supported Supported Important The host system requires Red Hat Enterprise Linux 5.1 or newer.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide For Red Hat Enterprise Linux 3 based guest operating systems you must use the processor specific kernel and para-virtualized driver RPMs as seen in the tables below. If you fail to install the matching para-virtualized driver package, loading of the xen-pci-platform module will fail. The table below shows which host kernel is required to run a Red Hat Enterprise Linux 3 guest, if the guest was compiled for an Intel processor. T ab le 12.2.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers Note If you are installing a new guest system, in order to gain maximal benefit from the paravirtualized block device drivers, you should create the guest with at least two disks. Using the para-virtualized drivers for the disk that contains the MBR and the boot loader (GRUB), and for the /boot partition. This partition can be very small, as it only needs to have enough capacity to hold the /boot partition.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Modify each disk entry, as desired, to use the para-virtualized by changing the driver elements as shown below. 10. Add any additional storage entities you want to use for the para-virtualized block device driver. 11.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers 4. Use the commands below load the para-virtualized driver modules. %kvariant is the kernel variant the para-virtualized drivers have been build against and %release corresponds to the release version of the para-virtualized drivers. [root@rhel3]# mkdir -p /lib/modules/'uname -r'/extra/xenpv [root@rhel3]# cp -R /lib/modules/2.4.21-52.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Modify each disk entry, as desired, to use the para-virtualized by changing the driver elements as shown below. Once complete, save the modified configuration file and restart the guest. 8.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers # mknod /dev/xvdd b $major 32 # mknod /dev/xvdd1 b $major 33 Now you should verify the partitions which you have created are available. [root@rhel3]# cat /proc/partitions major minor #blocks name 3 3 3 202 202 202 253 253 0 1 2 16 17 18 0 1 10485760 104391 10377990 64000 32000 32000 8257536 2031616 hda hda1 hda2 xvdb xvdb1 xvdb2 dm-0 dm-1 In the above output, you can observe that the partitioned device “ xvdb” is available to the system.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Important The Itanium (ia64) binary RPM packages and builds are not presently available. 12.3.3. Inst allat ion and Configurat ion of Para-virt ualiz ed Drivers on Red Hat Ent erprise Linux 4 This section contains detailed instructions for the para-virtualized drivers in a Red Hat Enterprise 4 guest operating system. Note These packages do not support booting from a para-virtualized disk.
Chapt er 1 2 . Xen Para- virt ualiz ed 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 additional physical device, LUN, partition or volume add an entry similar to the one shown below to the “ disk=” section in the guest configuration file. The original “ disk=” entry might also look like the entry below. disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide In the above output, you can see the partitioned device “ xvdb” is available to the system. The procedure below adds the new device to the guest and makes it persistent after rebooting. All these commands are executed on the guest. 1. Create directories to mount the block device image in. [root@rhel4]# mkdir /mnt/pvdisk_p1 [root@rhel4]# mkdir /mnt/pvdisk_p2 2. Mount the devices to the new folders.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers Note These packages do not support booting from a para-virtualized disk. Booting the guest operating system kernel still requires the use of the emulated ID E driver, while any other (nonsystem) user-space applications and data can use the para-virtualized block device drivers. The procedure below covers the steps to enable the para-virtualized drivers for a Red Hat Enterprise Linux 5 guest. Pro ced u re 12.1.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 3 3 202 202 202 253 253 1 2 0 1 2 0 1 104391 10377990 64000 32000 32000 8257536 2031616 hda1 hda2 xvdb xvdb1 xvdb2 dm-0 dm-1 In the above output, you can see the partitioned device “ xvdb” is available to the system. The procedure below adds the new device to the guest and makes it persistent after rebooting. All these commands are executed on the guest. 1. Create directories to mount the block device image in.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers 8139cp 8139too e1000 2. Remove the old network scripts from the /etc/sysconfig/network-scripts directory. 3. Reboot the guest. The default network interface should now use the para-virtualized drivers. 12.3.5. Xen Para-virt ualiz ed Drivers on Red Hat Ent erprise Linux 6 This section describes the use of para-virtualized drivers in a Red Hat Enterprise Linux 6 guest. The para-virtualized drivers are enabled by default for a Red Hat Enterprise Linux 6 guest.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 5. Select the 'Xen Virt u al Et h ern et C ard ( et h 0) ' entry and click 'Forward'. Configure the network settings as required.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers 6. Complete the configuration by pressing the 'Apply' button. 7. Press the 'Activate' button to apply the new settings and restart the network.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 8. You should now see the new network interface with an IP address assigned. ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:16:3E:49:E4:E0 inet addr:192.168.78.180 Bcast:192.168.79.255 Mask:255.255.252.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:630150 errors:0 dropped:0 overruns:0 frame:0 TX packets:501209 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:109336431 (104.2 MiB) TX bytes:46265452 (44.
Chapt er 1 2 . Xen Para- virt ualiz ed Drivers Add an additional entry to the “ vif=” section of the configuration file similar to the one seen below. vif = [ "mac=00:16:3e:2e:c5:a9,bridge=xenbr0", "mac=00:16:3e:2f:d5:a9,bridge=xenbr0" ] Make sure you generate a unique MAC address for the new interface. You can use the command below. # echo 'import virtinst.util ; print virtinst.util.randomMAC()' | python After the guest has been rebooted perform the following step in the guest operating system.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers Chapter 13. 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 package is only available on hosts running Red Hat Enterprise Linux 5.4 and newer.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide using a virtualized CD -ROM device of the driver installation disk .iso file, or using a virtualized floppy device to install the drivers during boot time (for Windows guests). This guide describes installation from the para-virtualized installer disk as a virtualized CD -ROM device. 1. D o wn lo ad t h e d rivers The virtio-win package contains the para-virtualized block and network drivers for all supported Windows guests.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers 3. Select t h e d evice t yp e This opens a wizard for adding the new device. Select Storage from the dropdown menu.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Click the Forward button to proceed. 4. Select t h e ISO f ile 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/virtiowin.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. 5.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers 6. R eb o o t Reboot or start the guest to add the new device. Virtualized ID E 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 13.2, “ Windows installation” . Pro ced u re 13.2. Win d o ws in st allat io n 1. O p en My C o mp u t er On the Windows guest, open My C o mp u t er and select the CD -ROM drive.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 2. Select t h e co rrect in st allat io n f iles 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 RHEVBlock64.msi for 64-bit guests), the para-virtualized network device driver (RHEV-Network.msi for 32-bit guests or RHEV-Block64.msi for 64-bit guests), or both the block and network device drivers.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers Press Next to continue. b. C o n f irm t h e excep t io n Windows may prompt for a security exception. Press Yes if it is correct. c.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Press Finish to complete the installation. 4. In st all t h e n et wo rk d evice d river a. St art t h e n et wo rk d evice d river in st allat io n D ouble click RHEV-Network.msi or RHEV-Network64.msi.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers Press Next to continue. b. Perf o rman ce set t in g 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. TCP window scaling is covered by IETF RFC 1323.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Windows may prompt for a security exception. Press Yes if it is correct. d. Fin ish Press Finish to complete the installation. 5. R eb o o t Reboot the guest to complete the driver installation.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers Change the device configuration to use the para-virtualized drivers (Section 13.3, “ Using KVM paravirtualized drivers for existing devices” ) or install a new device which uses the para-virtualized drivers (Section 13.4, “ Using KVM para-virtualized drivers for new devices” ). 13.2. Inst alling drivers wit h a virt ualiz ed floppy disk This procedure covers installing the para-virtualized drivers during a Windows installation.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Install the drivers first Ensure the drivers have been installed on the Windows guest before proceeding to install new devices. If the drivers are unavailable the device will not be recognized and will not work. 1. Open the guest by double clicking on the name of the guest in virt-manager. 2. Open the Hardware tab. 3. Press the Add Hardware button. 4. In the Adding Virtual Hardware tab select Storage or Network for the type of device. a.
Chapt er 1 3. KVM Para- virt ualiz ed Drivers 5. Press Finish to save the device.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 6. Reboot the guest. The device may not be recognized until the Windows guest restarts.
Chapt er 1 4 . Inst alling Red Hat Ent erprise Linux 6 as a Xen guest on Red Hat Ent erprise Linux 5 Chapter 14. Installing Red Hat Enterprise Linux 6 as a Xen guest on Red Hat Enterprise Linux 5 This chapter describes the installation of Red Hat Enterprise Linux 6 as a Xen guest on a Red Hat Enterprise Linux 5 host, both as para-virtualizaed and fully virtualized. 14 .1.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Note Red Hat Enterprise Linux can be installed without a graphical interface or manual input. Use a Kickstart file to automate the installation process. This example extends the previous example with a Kickstart file, located at http://example.com/kickstart/ks.cfg, to fully automate the installation. # virt-install --name=rhel6pv-64 \ --disk path=/var/lib/xen/images/rhel6pv-64.
Chapt er 1 4 . Inst alling Red Hat Ent erprise Linux 6 as a Xen guest on Red Hat Ent erprise Linux 5 Fig u re 14 .1. T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 4. N ame t h e virt u al mach in e Provide a name for your virtualized guest. The following punctuation and whitespace characters are permitted: '_', '.' and '-' characters.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 14 .2. T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 5. Select t h e virt u aliz at io n met h o d Select the appropriate virtualization method. The following example uses Paravirtualization.
Chapt er 1 4 . Inst alling Red Hat Ent erprise Linux 6 as a Xen guest on Red Hat Ent erprise Linux 5 Fig u re 14 .3. T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 6. Select t h e in st allat io n met h o d an d t yp e Select the appropriate installation method. In this example, use the Network install tree method. Set the OS Type and OS Variant. In this case, we set OS Type to Linux and OS Variant to Red Hat Enterprise Linux 6.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 14 .4 . T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 7. Lo cat e in st allat io n med ia Enter the location of the installation tree.
Chapt er 1 4 . Inst alling Red Hat Ent erprise Linux 6 as a Xen guest on Red Hat Ent erprise Linux 5 Fig u re 14 .5. T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 8. St o rag e set u p Important Xen file-based images should be stored in the /var/lib/xen/images/ directory. Any other location may require additional configuration for SELinux. See the Red Hat Enterprise Linux 6 Virtualization Administration Guide for more information on configuring SELinux.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 14 .6 . T h e virt u al mach in e creat io n wiz ard Click Forward to continue. Note Live and offline migrations require guests to be installed on shared network storage. For information on setting up shared storage for guests, see the Red Hat Enterprise Linux 6 Virtualization Administration Guide chapter on Storage Pools. 9. N et wo rk set u p Select either Virtual network or Shared physical device.
Chapt er 1 4 . Inst alling Red Hat Ent erprise Linux 6 as a Xen guest on Red Hat Ent erprise Linux 5 Fig u re 14 .7. T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 10. Memo ry an d C PU allo cat io n 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 14 .8. T h e virt u al mach in e creat io n wiz ard Click Forward to continue. 11. Verif y an d st art g u est in st allat io n Verify the configuration.
Chapt er 1 4 . Inst alling Red Hat Ent erprise Linux 6 as a Xen guest on Red Hat Ent erprise Linux 5 Fig u re 14 .9 . T h e virt u al mach in e creat io n wiz ard Click Finish to start the guest installation procedure. 12. In st allin g R ed H at En t erp rise Lin u x Complete the Red Hat Enterprise Linux installation sequence. See the Red Hat Enterprise Linux 6 Installation Guide for detailed installation instructions. 14 .2.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 15. 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 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.
Chapt er 1 5. PCI passt hrough En ab le AMD IO MMU ext en sio n s 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. AMD systems only require that the IOMMU is enabled in the BIOS. The system is ready for PCI passthrough once the IOMMU is enabled. Important Xen and KVM require different kernel arguments to enable PCI passthrough.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Each PCI device is identified by a string in the following format (where 8086 is a variable that in this case represents Intel equipment, and **** is a four digit hexadecimal code specific to each device): pci_8086_**** Note Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code. Record the PCI device number; the number is needed in other steps. 2.
Chapt er 1 5. PCI passt hrough Run virsh edit (or virsh attach device) and add a device entry in the 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 6.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Each PCI device is identified by a string in the following format (where 8086 is a variable that in this case represents Intel equipment, and **** is a four digit hexadecimal code specific to each device): pci_8086_**** Note Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code. Record the PCI device number; the number is needed in other steps. 2.
Chapt er 1 5. PCI passt hrough 5. Ad d t h e n ew d evice Select Ph ysical H o st D evice from the Hardware type list. The Ph ysical H o st D evice represents PCI devices. Click Forward to continue.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 6. Select a PC I d evice Select an unused PCI device. Note that selecting PCI devices presently in use on the host causes errors. In this example a PCI to USB interface device is used.
Chapt er 1 5. PCI passt hrough 7. C o n f irm t h e n ew d evice Click the Finish button to confirm the device setup and add the device to the guest.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide The setup is complete and the guest can now use the PCI device. 15.3. PCI passt hrough wit h virt -inst all To use PCI passthrough with the virt-install parameter, use the additional --host-device parameter. 1. Id en t if y t h e PC I d evice Identify the PCI device designated for passthrough to the guest. The virsh nodedev-list command lists all devices attached to the system.
Chapt er 1 5. PCI passt hrough Note Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code. 2. Ad d t h e d evice Use the PCI identifier output from the virsh nodedev command as the value for the -host-device parameter. # virt-install \ -n hostdev-test -r 1024 --vcpus 2 \ --os-variant fedora11 -v --accelerate \ -l http://download.fedoraproject.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # virsh nodedev-reattach pci_8086_3a6c 15.5. PCI passt hrough for para-virt ualiz ed Xen guest s on Red Hat Ent erprise Linux PCI passthrough is used to allow a Xen guest exclusive access to a PCI device, rather than sharing with other guests or with dom0.
Chapt er 1 5. PCI passt hrough Warning D ue to interrupt tracking, repeatedly hotplugging or hotunplugging an assigned device more than 512 times in a brief period of time can cause a kernel error. Please do not repeatedly hotplug/hotunplug an assigned device. Note When running Red Hat Enterprise Linux 5 as a KVM guest, the acpiphp kernel module must be loaded in the guest to support dynamic addition and removal of PCI devices.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 16. SR-IOV 16.1. Int roduct ion The PCI-SIG (PCI Special Interest Group) developed the Single Root I/O Virtualization (SR-IOV) specification. The PCI-SIG Single Root 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 D MA streams for guests.
Chapt er 1 6 . SR- IO V This section covers attaching Virtual Function to a guest as an additional network device. SR-IOV requires Intel VT-d support. Important Xen requires additional kernel arguments to use SR-IOV. Modify the /boot/grub/grub.conf file to enable SR-IOV. To enable SR-IOV with Xen for Intel systems append the pci_pt_e820_access=on parameter to the kernel. default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux Server (2.6.18-192.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # modprobe igb [
Chapt er 1 6 . SR- IO V The pci_8086_10c9 is one of the Physical Functions and pci_8086_10ca_0 is the first corresponding Virtual Function for that Physical Function. Use the virsh nodedevdumpxml command to get advanced output for both devices.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide d. 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. e. Save the configuration. 9. R est art Restart the guest to complete the installation.
Chapt er 1 7 . KVM guest t iming management Chapter 17. 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Important These instructions are for AMD revision F cpus only. If the CPU lacks the constant_tsc bit, disable all power management features (BZ #513138). Each system has several timers it uses to keep time. The TSC is not stable on the host, which is sometimes caused by cpufreq changes, deep C state, or migration to a host with a faster TSC. D eep C sleep states can stop the TSC. To prevent the kernel using deep C states append " processor.
Chapt er 1 7 . KVM guest t iming management Warning The divider kernel parameter was previously recommended for Red Hat Enterprise Linux 4 and 5 guests that did not have high responsiveness requirements, or exist on systems with high guest density. It is no longer recommended for use with guests running Red Hat Enterprise Linux 4, or Red Hat Enterprise Linux 5 versions prior to version 5.8. divider can improve throughput on Red Hat Enterprise Linux 5 versions equal to or later than 5.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Note The boot.ini file is no longer used in Windows Vista and newer. As shown in this procedure, Windows Vista, Windows Server 2008 and Windows 7 use the B o o t C o n f ig u rat io n D at a Ed it o r (bcdedit.exe) application to modify this boot parameter.
P art IV. Administ rat ion Part IV. Administration Administering virtualized systems These chapters contain information for administering host and guests using tools included in Red Hat Enterprise Linux.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 18. 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 Remove or disable any unnecessary services such as AutoFS, NFS, FTP, HTTP, NIS, telnetd, sendmail and so on.
Chapt er 1 9 . Securit y for virt ualiz at ion Chapter 19. 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. There are several ways to enhance security on systems using virtualization.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Pro ced u re 19 .1. C reat in g an d mo u n t in g a lo g ical vo lu me o n a g u est wit h SELin u x en ab led 1. 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 2. Format the NewVolumeName logical volume with a file system that supports extended attributes, such as ext3. # mke2fs -j /dev/volumegroup/NewVolumeName 3.
Chapt er 1 9 . Securit y for virt ualiz at ion 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. K VM an d SELin u x There are several SELinux booleans which affect KVM. These booleans are listed below for your convenience.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Enabling IP forwarding (net.ipv4.ip_forward = 1) is required for virtual bridge devices. Note that installing libvirt enables this variable so it will be enabled when the virtualization packages are installed unless it was manually disabled. Note Note that enabling IP forwarding is n o t required for physical bridge devices.
Chapt er 2 0 . Managing guest s wit h xend Chapter 20. Managing guests with xend The xen d node control daemon performs certain system management functions that relate to virtual machines. This daemon controls the virtualized resources, and xen d must be running to interact with virtual machines. Before you start xen d , you must specify the operating parameters by editing the xen d configuration file /etc/xen/xend-config.sxp. Here are the parameters you can enable or disable in the xend-config.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide It em D escrip t io n ( xen d - relo cat io n - ad d ress) D etermines the host addresses allowed for migration. The default value is the value of xend-address. D etermines the address that the domain socket server binds to. The default value allows all connections. ( xen d - ad d ress) After setting these operating parameters, you should verify that xend is running and if not, initialize the daemon.
Chapt er 2 1 . Xen live migrat ion Chapter 21. Xen live migration The Xen hypervisor supports Virtualization Migration 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 guest on the original host, transfers it to the destination host and then resumes it once the guest is fully transferred. Offline migration uses the virsh migrate command.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide (xend-relocation-server yes) The default value, which disables migration, is no. Change the value of xendrelocation-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.
Chapt er 2 1 . Xen live migrat ion Below is an example of how to setup a simple environment for live migration. This configuration is using N FS for the shared storage. N FS is suitable for demonstration environments but for a production environment a more robust shared storage configuration using Fibre Channel or iSCSI and G FS is recommended.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide [et-virt07 ~]# brctl show bridge name bridge id xenbr1 8000.feffffffffff vif0.1 STP enabled no interfaces peth1 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.
Chapt er 2 1 . Xen live migrat ion 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 0m0.188s sys 0m0.044s [et-virt07 images]# ls -lrt testvm1.sav -rwxr-xr-x 1 root root 1075657716 Jan 12 06:46 testvm1.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Create the following script inside the virtual machine to log date and hostname during the migration. This script performs I/O tasks on the guest's file system. #!/bin/bash while true do touch /var/tmp/$$.log echo `hostname` >> /var/tmp/$$.log echo `date` >> /var/tmp/$$.log cat /var/tmp/$$.log df /var/tmp ls -l /var/tmp/$$.
Chapt er 2 1 . Xen live migrat ion 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 Fri Jan 12 06:55:00 EST 2007 dhcp78-218.lab.boston.redhat.com Fri Jan 12 06:55:03 EST 2007 Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 2983664 2043120 786536 73% / -rw-r--r-- 1 root root 744 Jan 12 06:55 /var/tmp/2279.log dhcp78-218.lab.boston.redhat.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fri Jan 12 06:57:53 EST 2007 dhcp78-218.lab.boston.redhat.com Fri Jan 12 06:57:56 EST 2007 dhcp78-218.lab.boston.redhat.com Fri Jan 12 06:58:00 EST 2007 Filesystem 1K-blocks Used Available Use% Mounted /dev/mapper/VolGroup00-LogVol00 2983664 2043120 786536 73% / -rw-r--r-- 1 root root 186 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 Fri Jan 12 06:57:56 EST 2007 dhcp78-218.
Chapt er 2 1 . Xen live migrat ion [et-virt08 ~]# time virsh migrate --live testvm1 et-virt07 real 0m10.378s user 0m0.068s sys 0m0.052s At this point you have successfully performed an offline and a live migration test. 21.2. Configuring guest live migrat ion This section covers offline migration of Xen guests to other servers running Red Hat Enterprise Linux. Further, migration is performed in an offline method (using the xm migrate command). Live migration can be done from the same command.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 22. KVM live migration This chapter covers migrating guests running on a KVM hypervisor to another KVM host. Migration is the process of moving a guest from one host to another. Migration is a key feature of virtualization as software is completely separated from hardware. Migration is useful for: Load balancing - guests can be moved to hosts with lower usage when a host becomes overloaded.
Chapt er 2 2 . KVM live migrat ion iSCSI 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. Shared storage must mount at the same location on source and destination systems. The mounted directory name must be identical.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 3. Mo u n t t h e sh ared st o rag e o n t h e d est in at io n On the destination system, mount the /var/lib/libvirt/images directory: # mount sourceURL:/var/lib/libvirt/images /var/lib/libvirt/images Warning 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. 22.3.
Chapt er 2 2 . KVM live migrat ion Execute the following command to live migrate the guest to the destination, test2.example.com. Append /system to the end of the destination URL to tell libvirt that you need full access. # virsh migrate --live RHEL4test qemu+ssh://test2.example.com/system Once the command is entered you will be prompted for the root password of the destination system. 3. Wait The migration may take some time depending on load and the size of the guest. virsh only reports errors.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide The Virtual Machine Manager displays a list of connected hosts. 2. Add a storage pool with the same NFS to the source and target hosts. On the Ed it menu, click H o st D et ails, the Host D etails window appears. Click the Storage tab.
Chapt er 2 2 . KVM live migrat ion 3. 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. Type: Select n et f s: N et wo rk Exp o rt ed D irect o ry. Click Forward. 4.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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. Click Finish. 5. Create a new volume in the shared storage pool, click New Volume. 6. Enter the details, then click Create Volume.
Chapt er 2 2 . KVM live migrat ion 7. Create a virtual machine with the new volume, then run the virtual machine. The Virtual Machine window appears.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 8. In the Virtual Machine Manager window, right-click on the virtual machine, select Mig rat e, then click the migration location.
Chapt er 2 2 . KVM live migrat ion 9. Click Yes to confirm migration. The Virtual Machine Manager displays the virtual machine in its new location. The VNC connection displays the remote host's address in its title bar.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 24 0
Chapt er 2 3. Remot e management of guest s Chapter 23. Remote management of guests This section explains how to remotely manage your guests using ssh or TLS and SSL. 23.1. Remot e management wit h SSH The ssh package provides an encrypted network protocol which can securely send management functions to remote virtualization servers. The method described uses the libvirt management connection securely tunneled over an SSH connection to manage the remote machines.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Generate a public key pair on the machine virt-manager is used. This example uses the default key location, in the ~/.ssh/ directory. $ ssh-keygen -t rsa 3. C o p in g t h e keys t o t h e remo t e h o st s 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).
Chapt er 2 3. Remot e management of guest s the same technology used by web browsers for secure connections. The libvirt management connection opens a TCP port for incoming connections, which is securely encrypted and authenticated 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide libvirt-vnc or clientkey.pem - The client private key. 23.3. T ransport modes For remote management, libvirt supports the following transport modes: T ran sp o rt Layer Secu rit y ( T LS) 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.
Chapt er 2 3. Remot e management of guest s xen+ssh://ccurran@towada/ 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 Connect to a remote KVM hypervisor on host towada using SSH. qemu+ssh://towada/system T est in g examp les Connect to the local KVM hypervisor with a non-standard UNIX socket.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide N ame T ran sp o rt mo d e D escrip t io n Examp le u sag e command ssh and ext command=/opt/openss h/bin/ssh socket unix and ssh The external command. For ext transport this is required. For ssh the default is ssh. The PATH is searched for the command. The path to the UNIX domain socket, which overrides the default. For ssh transport, this is passed to the remote netcat command (see netcat).
Chapt er 2 3. Remot e management of guest s N ame T ran sp o rt mo d e D escrip t io n Examp le u sag e no_tty ssh If set to a non-zero value, this stops ssh from asking for a 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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. You cannot migrate guests without shared storage.
Chapt er 2 4 . Using shared st orage wit h virt ual disk images Chapter 24. Using shared storage with virtual disk images This chapter covers the use of shared and network storage devices for virtual disks. 24 .1. Using iSCSI for st oring virt ual disk images This section demonstrates how to set up an iSCSI target on Red Hat Enterprise Linux and how to configure iSCSI on a libvirt KVM host using virsh, and finally how to provision a guest on iSCSI using virt-install.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 3. Exp o rt t h e iSC SI t arg et an d LU N s For Red Hat Enterprise Linux 5, several tgtadm commands are required to create a target and associate the storage volumes created earlier. First, the following command adds a target using an iSCSI Qualified Name (IQN): # tgtadm --lld iscsi --op new --mode target --tid 1 --targetname \ iqn.2004-04.rhel:rhel5:iscsi.
Chapt er 2 4 . Using shared st orage wit h virt ual disk images Removable media: No Readonly: No Backing store type: rdwr Backing store path: /var/lib/tgtd/kvmguest/shareddata.img Backing store flags: Account information: ACL information: 4.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide /dev/disk/by-path Save this XML code to a file named iscsirhel5.xml and load it into libvirt using the pooldefine command: # virsh pool-define iscsirhel5.xml Pool kvmguest defined from iscsirhel5.xml # virsh pool-list --all Name State Autostart ----------------------------------------default active yes kvmguest inactive no 2.
Chapt er 2 4 . Using shared st orage wit h virt ual disk images 04.rhel:rhel5:iscsi.kvmguest-lun-2 0660 0 6 4. Act ivat in g t h e st o rag e at b o o t t ime Once correctly configured, the pool can be set to start automatically upon booting of the host: # virsh pool-autostart kvmguest Pool kvmguest marked as autostarted 5.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide
Chapt er 2 6 . Managing guest s wit h virsh and network I/O does not occur while the guest is suspended. This operation is immediate and the guest can be restarted with the resume (Resuming a guest) option. R esu min g a g u est Restore a suspended guest with virsh using the resume option: # virsh resume {domain-id, domain-name or domain-uuid} This operation is immediate and the guest parameters are preserved for suspend and resume operations.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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 unresponsive. For para-virtualized guests, use the shutdown option(Shut down a guest) instead.
Chapt er 2 6 . Managing guest s wit h virsh # virsh nodeinfo CPU model CPU (s) CPU frequency CPU socket(s) Core(s) per socket Threads per core: Numa cell(s) Memory size: x86_64 8 2895 Mhz 2 2 2 1 1046528 kb This displays the node information and the machines that support the virtualization process.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # virsh vcpuinfo {domain-id, domain-name or domain-uuid} An example of virsh vcpuinfo output: # virsh vcpuinfo r5b2-mySQL01 VCPU: 0 CPU: 0 State: blocked CPU time: 0.0s CPU Affinity: yy C o n f ig u rin g virt u al C PU af f in it y To configure the affinity of virtual CPUs with physical CPUs: # virsh vcpupin domain-id vcpu cpulist The domain-id parameter is the guest's ID number or name.
Chapt er 2 6 . Managing guest s wit h virsh D isp layin g g u est n et wo rk d evice in f o rmat io n Use virsh domifstat to display network interface statistics for a running guest. # virsh domifstat GuestName interface-device Mig rat in g g u est s wit h virsh A guest can be migrated to another host with virsh. Migrate domain to another host. Add --live for live migration.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Other virsh commands used in managing virtual networks are: virsh net-autostart network-name — Autostart a network specified as network-name. virsh net-create XMLfile — generates and starts a new network using an existing XML file. virsh net-define XMLfile — generates a new network device from an existing XML file without starting it.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Chapter 27. 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. You can use virt-manager to define both para-virtualized and fully virtualized guests.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 27.2. T he Virt ual Machine Manager main window This main window displays all the running guests and resources used by guests. Select a guest by double clicking the guest's name. Fig u re 27.2. Virt u al Mach in e Man ag er main win d o w 27.3. T he guest Overview t ab The Overview tab displays graphs and statistics of a guest's live resource utilization data available from virt-manager.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.3. T h e Overview t ab 27.4 . Virt ual 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 VN C to make them available to the Virtual Machine Manager's console window.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.4 . G rap h ical co n so le win d o w Note 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. The guest machines only listen to the local host (dom0)'s loopback address (127.0.0.1). This ensures only those with shell privileges on the host can access virt-manager and the virtual machine through VNC.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) The virt-manager main window appears. Fig u re 27.5. St art in g 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 Using ssh to manage virtual machines and hosts is discussed further in Section 23.1, “ Remote management with SSH” . 27.6.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.6 . R est o rin g a virt u al mach in e 2. The Restore Virtual Machine main window appears. 3. Navigate to correct directory and select the saved session file. 4. Click Open. The saved virtual system appears in the Virtual Machine Manager main window. Fig u re 27.7. A rest o red virt u al mach in e man ag er sessio n 27.7.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) 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: 1. In the Virtual Machine Manager main window, highlight the virtual machine that you want to view. Fig u re 27.8. Select in g a virt u al mach in e t o d isp lay 2.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide On the Virtual Machine window, click the Overview tab. The Overview tab summarizes CPU and memory usage for the guest you specified. Fig u re 27.10. D isp layin g g u est d et ails o verview 3. On the Virtual Machine window, click the Hardwaretab. Fig u re 27.11.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) 4. On the Hardware tab, click on Processor to view or change the current processor allocation. Fig u re 27.12. Pro cesso r allo cat io n p an el 5. On the Hardware tab, click on Memory to view or change the current RAM memory allocation. Fig u re 27.13. D isp layin g memo ry allo cat io n 6. On the Hardware tab, click on Disk to view or change the current hard disk configuration.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.14 . D isp layin g d isk co n f ig u rat io n 7. On the Hardware tab, click on NIC to view or change the current network configuration. Fig u re 27.15. D isp layin g n et wo rk co n f ig u rat io n 27.8. St at us monit oring Status status monitoring preferences can be modified with virt-manager's preferences window. To configure status monitoring: 1. From the Edit menu, select Preferences.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.16 . Mo d if yin g g u est p ref eren ces The Preferences window appears. 2. From the Stats tab specify the time in seconds or stats polling options. Fig u re 27.17. C o n f ig u rin g st at u s mo n it o rin g 27.9. Displaying guest ident ifiers To view the guest ID s for all virtual machines on your system: 1. From the View menu, select the Domain ID check box.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.18. Viewin g g u est ID s 2. The Virtual Machine Manager lists the D omain ID s for all domains on your system. Fig u re 27.19 . D isp layin g d o main ID s 27.10. Displaying a guest 's st at us To view the status of all virtual machines on your system: 1. From the View menu, select the Status check box.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.20. Select in g a virt u al mach in e' s st at u s 2. The Virtual Machine Manager lists the status of all virtual machines on your system. Fig u re 27.21. D isp layin g a virt u al mach in e' s st at u s 27.11. Displaying virt ual CPUs To view the amount of virtual CPUs for all virtual machines on your system: 1. From the View menu, select the Virtual CPUs check box.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.22. Select in g t h e virt u al C PU s o p t io n 2. The Virtual Machine Manager lists the Virtual CPUs for all virtual machines on your system. Fig u re 27.23. D isp layin g Virt u al C PU s 27.12. Displaying CPU usage To view the CPU usage for all virtual machines on your system: 1. From the View menu, select the CPU Usage check box.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.24 . Select in g C PU u sag e 2. The Virtual Machine Manager lists the percentage of CPU in use for all virtual machines on your system. Fig u re 27.25. D isp layin g C PU u sag e 27.13. Displaying memory usage To view the memory usage for all virtual machines on your system: 1. From the View menu, select the Memory Usage check box.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.26 . Select in g Memo ry U sag e 2. The Virtual Machine Manager lists the percentage of memory in use (in megabytes) for all virtual machines on your system. Fig u re 27.27. D isp layin g memo ry u sag e 27.14 . Managing a virt ual net work To configure a virtual network on your system: 1. From the Edit menu, select Host Details.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.28. Select in g a h o st ' s d et ails 2. This will open the H o st D et ails menu. Click the Virtual Networks tab. Fig u re 27.29 . Virt u al n et wo rk co n f ig u rat io n 3. 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. 27.15.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide To create a virtual network on your system: 1. Open the Host Details menu (see Section 27.14, “ Managing a virtual network” ) and click the Add button. Fig u re 27.30. Virt u al n et wo rk co n f ig u rat io n This will open the C reat e a n ew virt u al n et wo rk menu. Click Forward to continue.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.31. C reat in g a n ew virt u al n et wo rk 2. Enter an appropriate name for your virtual network and click Forward.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.32. N amin g yo u r virt u al n et wo rk 3. Enter an IPv4 address space for your virtual network and click Forward.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.33. C h o o sin g an IPv4 ad d ress sp ace 4. D efine the D HCP range for your virtual network by specifying a Start and End range of IP addresses. Click Forward to continue.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.34 . Select in g t h e DHCP ran g e 5. Select how the virtual network should connect to the physical network.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.35. C o n n ect in g t o p h ysical n et wo rk 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. 6. You are now ready to create the network. Check the configuration of your network and click Finish.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Fig u re 27.36 . R ead y t o creat e n et wo rk 7. The new virtual network is now available in the Virt u al N et wo rk tab of the H o st D et ails menu.
Chapt er 2 7 . Managing guest s wit h t he Virt ual Machine Manager (virt - manager) Fig u re 27.37.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 28. The xm command quick reference The xm command can manage the Xen hypervisor. Most operations can be performed with the libvirt tools, virt - man ag er 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 - man ag er.
Chapt er 2 8 . T he xm command quick reference 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 Domain-0 Domain-0 r5b2-mySQL01 ID 0 0 13 VCPUs 0 1 0 CPU State 0 r-1 -b1 -b- Time(s) 708.9 572.1 16.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 29. 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.
Chapt er 2 9 . Configuring t he Xen kernel boot paramet ers /* /* "acpi=ht": "acpi=noirq": Limits ACPI from boot-time to enable HT. Disables ACPI interrupt routing. */ */ noacpi This disables ACPI for interrupt delivery.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 30. 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.
Chapt er 30 . Configuring ELILO To customize the hypervisor, insert parameters before the --. An example of the hypervisor memory (mem) parameter and the quiet parameter for the kernel: append="dom0_mem=2G -- quiet" ELILO h yp erviso r p aramet ers Paramet er D escrip t io n mem= The mem parameter defines the hypervisor maximum RAM usage. Any additional RAM in the system is ignored.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Additionally this example removes the kernel parameters " rhgb quiet" so that kernel and initscript output are generated on the console. Note the double-dash remains so that the append line is correctly interpreted as hypervisor arguments.
Chapt er 31 . libvirt configurat ion reference Chapter 31. libvirt configuration reference This chapter provides is a references for various parameters of libvirt XML configuration files T ab le 31.1. lib virt co n f ig u rat io n f iles It em D escrip t io n pae memory Specifies the physical address extension configuration data. Specifies the advanced programmable interrupt controller configuration data. Specifies the memory size in megabytes. vcpus Specifies the numbers of virtual CPUs.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 32. 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. The table below, Table 32.1, “ Xen configuration file reference” , is formatted output from xm create --help_config.
Chapt er 32 . Xen configurat ion files Paramet er D escrip t io n on_poweroff =destroy | restart | preserve | destroy Behavior when a domain exits with reason ' poweroff '. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - renamerestart: the old domain is not cleaned up, but is renamed and a new domain started in its place.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Paramet er D escrip t io n vfb=type={vnc,sdl}, vncunused=1, vncdisplay=N, Make the domain a framebuffer backend. The backend type should be either sdl or vnc . For type=vnc , connect an external vncviewer. The server will listen on ADDR (default 127.0.0.1) on port N+5900. N defaults to the domain id. If vncunused=1 , the server will try to find an arbitrary unused port above 5900.
Chapt er 32 . Xen configurat ion files Paramet er D escrip t io n extra =ARGS Set extra arguments to append to the kernel command line. Set the kernel IP interface address. ip =IPADDR gateway =IPADDR Set the kernel IP gateway. netmask =MASK hostname =NAME Set the kernel IP netmask. interface =INTF dhcp =off|dhcp Set the kernel IP interface name. nfs_server =IPADDR nfs_root =PATH Set the address of the NFS server for NFS root. device_model =FILE fda =FILE Path to device model program.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Parser f u n ct io n Valid arg u men t s set_bool Accepted values: yes y no yes Accepts a floating point number with Python's float(). For example: set_float 3.14 10. .001 1e100 3.14e-10 set_int Accepts an integer with Python's int(). set_value accepts any Python value. append_value accepts any Python value, and appends it to the previous value which is stored in an array. T ab le 32.3.
Chapt er 32 .
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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.
P art VII. T ips and T ricks Chapter 33. Tips and tricks This chapter contain useful hints and tips to improve virtualization performance, scale and stability. 33.1. Aut omat ically st art ing guest s This section covers how to make 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # yum install kvm 2. Verif y wh ich kern el is in u se 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. a. C h an g in g t h e Xen kern el t o t h e d ef au lt kern el The grub.conf file determines which kernel is booted.
Chapt er 33. T ips and t ricks R eb o o t t o lo ad t h e n ew kern el Reboot the system. The computer will restart with the default kernel. The KVM module should be automatically loaded with the kernel. Verify KVM is running: $ lsmod | grep kvm kvm_intel kvm 85992 222368 1 2 ksm,kvm_intel The kvm module and either the kvm_intel module or the kvm_amd module are present if everything worked. 33.2.2. KVM t o Xen The following procedure covers changing from the KVM hypervisor to the Xen hypervisor.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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 Notice the d ef au lt = 0 parameter. This is instructing the GRUB boot loader to boot the first entry, the default kernel. Change the default to 1 (or the number for the Xen kernel): default=1 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux Server (2.6.18-159.
Chapt er 33. T ips and t ricks Command format: # qemu-img convert [-c] [-e] [-f format] filename [-O output_format] output_filename Convert the disk image filename to disk image output_filename using format output_format. The disk image can be optionally encrypted with the -e option or compressed with the -c option. Only the format " qcow" supports encryption or compression. the compression is read-only. it means that if a compressed sector is rewritten, then it is rewritten as uncompressed data.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Linux Compressed Loop image, useful only to reuse directly compressed CD -ROM images present for example in the Knoppix CD -ROMs. 33.4 . Overcommit t ing Resources The KVM hypervisor supports overcommitting CPUs and memory. Overcommitting is the process of allocating more virtualized CPUs or memory than there are physical resources on the system.
Chapt er 33. T ips and t ricks Overcommitting guests by swapping out temporarily unused guest memory can be very slow, due to the IO latency introduced by disk seek times. However, Red Hat Enterprise Linux virtualization with KVM can often avoid this disk IO penalty by merging multiple pages with identical content into the same physical pages. This is done by the KSM (Kernel Samepage Merging) kernel process, which scans memory to find identical pages. The KSM kernel process uses CPU time to avoid disk IO.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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 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 Note Your grub.conf could look very different if it has been manually edited before or copied from an example.
Chapt er 33.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Warning Guests must be offline before their files can be read. Editing or reading files of an active guest is not possible and may cause data loss or damage. Pro ced u re 33.1. Accessin g g u est imag e d at a 1. Install the kpartx package. # yum install kpartx 2. Use kpartx to list partition device mappings attached to a file-based storage image. This example uses a image file named guest1.img. # kpartx -l /var/lib/libvirt/images/guest1.
Chapt er 33. T ips and t ricks Many Linux guests use Logical Volume Management (LVM) volumes. Additional steps are required to read data on LVM volumes on virtual storage images. 1. Add the partition mappings for the guest1.img to the recognized devices in the /dev/mapper/ directory. # kpartx -a /var/lib/libvirt/images/guest1.img 2. In this example the LVM volumes are on a second partition. The volumes require a rescan with the vgscan command to find the new volume groups.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide By default, libvirt provisions guests using the hypervisor's default policy. For most hypervisors, the policy is to run guests on any available processing core or CPU. There are times when an explicit policy may be better, in particular for systems with a NUMA (Non-Uniform Memory Access) architecture. A guest on a NUMA system should be pinned to a processing core so that its memory allocations are always local to the node it is running on.
Chapt er 33. T ips and t ricks selinux 0 [ Additional XML removed ] The output shows two NUMA nodes (also know as NUMA cells), each containing four logical CPUs (four processing cores). This system has two sockets, therefore we can infer that each socket is a separate NUMA node.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 2. Observe that the node 1, , has physical CPUs 4 to 7. 3. The guest can be locked to a set of CPUs by appending the cpuset attribute to the configuration file. a. While the guest is offline, open the configuration file with virsh edit. b. Locate where the guest's virtual CPU count is specified. Find the vcpus element. 4 The guest in this example has four CPUs. c. |
Chapt er 33. T ips and t ricks CPU: State: CPU Affinity: VCPU: CPU: State: CPU Affinity: 1 running yyyyyyyy 3 2 running yyyyyyyy The virsh vcpuinfo output (the yyyyyyyy value of CPU Affinity) shows that the guest can presently run on any CPU. To lock the virtual CPUs to the second NUMA node (CPUs four to seven), run the following commands.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide mac = [ 0x00, 0x16, 0x3e, random.randint(0x00, 0x7f), random.randint(0x00, 0xff), random.randint(0x00, 0xff) ] return ':'.join(map(lambda x: "%02x" % x, mac)) # print randomMAC() An o t h er met h o d t o g en erat e a n ew MAC f o r yo u r g u est You can also use the built-in modules of python-virtinst to generate a new MAC address and UUID for use in a guest configuration file: # echo 'import virtinst.util ; print\ virtinst.util.uuidToString(virtinst.
Chapt er 33. T ips and t ricks rate=10Mb/s Limit the outgoing network traffic from the guest to 10MB/s. rate=250KB/s Limit the outgoing network traffic from the guest to 250KB/s. rate=10MB/s@50ms Limit bandwidth to 10MB/s and provide the guest with a 50KB chunk every 50ms.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide root (hd0, 0) kernel /xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1 module /vmlinuz-2.6.17-1.2519.4.21el5xen ro root=/dev/VolGroup00/LogVol00 module /initrd-2.6.17-1.2519.4.21.el5xen.img For example, to change the memory entry on your hypervisor (dom0) to 256MB at boot time, edit the 'xen' line and append it with this entry: 'dom0_mem=256M'. This example is the grub.conf with the hypervisor's memory entry modified.
Chapt er 33. T ips and t ricks 33.14 . Configuring LUN Persist ence This section covers how to implement LUN persistence in guests and on the host machine with and without multipath. Imp lemen t in g LU N p ersist en ce wit h o u t mu lt ip at h If your system is not using multipath, you can use udev to implement LUN persistence. Before implementing LUN persistence in your system, ensure that you acquire the proper UUID s.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide } multipath } multipath { wwid alias 3600a0b80001327510000015427b625e oramp3 wwid alias 3600a0b80001327510000015427b625e oramp4 { } 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. 33.15.
Chapt er 33. T ips and t ricks echo "D-BUS per-session daemon address is: \ $DBUS_SESSION_BUS_ADDRESS" fi exec gnome-session 33.18. Cloning guest configurat ion 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. You must generate an all new UUID as well by using the uuidgen command.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Now, adjust the system configuration settings on your guest: /etc/sysconfig/network Modify the HOSTNAME entry to the guest's new hostname. /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.
Chapt er 33. T ips and t ricks Chapter 34. Creating custom libvirt scripts This section provides some information which may be useful to programmers and system administrators intending to write custom scripts to make their lives easier by using libvirt. Chapter 33, Tips and tricks is recommended reading for programmers thinking of writing new applications which use libvirt. 34 .1. Using XML configurat ion files wit h virsh virsh can handle XML configuration files.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Part VIII. Troubleshooting Introduction to Troubleshooting and Problem Solving The following chapters provide information to assist you in troubleshooting issues you may encounter using virtualization. Note Your particular problem may not appear in this book due to ongoing development which creates and fixes bugs.
P art VIII. T roubleshoot ing Chapter 35. 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide These networking tools can assist with troubleshooting virtualization networking problems: 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.
Chapt er 35. T roubleshoot ing Xen When deploying Red Hat Enterprise Linux 5 with Virtualization into your network infrastructure, the host's Virtualization software uses many specific directories for important configuration, log files, and other utilities. All the Xen logs files are standard ASCII files, and accessible with a text editor: The Xen configuration directory is /etc/xen/. This directory contains the xend daemon and other virtual machine configuration files.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide The /etc/xen directory contains the configuration files that you use to manage system resources. The xend daemon configuration file is /etc/xen/xend-config.sxp. This file can be edited to implement system-wide changes and configure the networking. However, manually editing files in the /etc/xen/ folder is not advised. The proc folders are another resource that allows you to gather system information.
Chapt er 35. T roubleshoot ing Xen module /vmlinuz-2.618-8.el5xen ro root=LABEL=/rhgb quiet console=xvc console=tty xencons=xvc module /initrd-2.6.18-8.el5xen.img The sync_console can help determine a problem that causes hangs with asynchronous hypervisor console output, and the "pnpacpi=off" works around a problem that breaks input on the serial 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Error: Error connecting to xend: Connection refused. Is xend running? Try to run xend start manually and receive more errors: Error: Could not obtain handle on privileged command interfaces (2 = No such file or directory) 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.
Chapt er 35. T roubleshoot ing Xen 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 com1=115200,8n1 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 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # Log all guest console output (cf xm console) XENCONSOLED_LOG_GUESTS=yes Reboot the host to activate logging the guest serial console output. Logs from the guest serial consoles are stored in the /var/log/xen/console file. 35.11.3. Serial console out put from fully virt ualiz ed guest s This section covers how to enable serial console output for fully virtualized guests.
Chapt er 35. T roubleshoot ing Xen The example below is a typical a para-virtualized guest configuration file: name = "rhel5vm01" memory = "2048" disk = ['tap:aio:/var/lib/libvirt/images/rhel5vm01.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide You can check the amount of memory in use by domain0 by using the xm list domain0 command. If dom0 is not ballooned down, you can use the command virsh setmem dom0 NewMemSize to check memory. You receive the following error: 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.
Chapt er 35. T roubleshoot ing Xen # 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 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide declared; see http://www.python.org/peps/pep-0263.html for details 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. 35.14 .
Chapt er 35. T roubleshoot ing Xen Chapter 36. Troubleshooting This chapter covers common problems and solutions with Red Hat Enterprise Linux virtualization. 36.1. Ident ifying available st orage and part it ions 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" as seen below. # cat /proc/partitions major minor #blocks name 202 16 104857600 xvdb 3 0 8175688 hda 36.2.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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. To employ loop device backed guests for a full virtualized system, use the phy: device or file: file commands. 36.5.
Chapt er 36 . T roubleshoot ing “ default=X” (where X is a number starting at '0') to correspond to the entry with your kernel-xen line. 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” . 36.7. Wrong kernel image error - non-PAE kernel on a PAE plat form If you to boot a non-PAE kernel, para-virtualized guest the error message below will display.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide # Do not remove the following line, or various programs # 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 36.10.
Chapt er 36 . T roubleshoot ing The virtualization extensions are sometimes disabled in BIOS, usually by laptop manufacturers. See Section 36.12, “ Enabling Intel VT and AMD -V virtualization hardware extensions in BIOS” for 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 C h ip set or Pro cesso r menus.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide 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: 1. Shutdown the guest operating system. 2. 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. 3.
Chapt er 36 . T roubleshoot ing 3. 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Chapter 37. 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. 37.1.
Chapt er 37 . T roubleshoot ing t he Xen para- virt ualiz ed drivers Note The logfile is overwritten every time you start virt - man ag er. If you are troubleshooting a problem with virt - man ag er make sure you save the logfile before you restart virt - man ag er after an error has occurred.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide displayed. A shortened excerpt of the error can be seen below. # insmod xen-platform-pci.o 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.
Chapt er 37 . T roubleshoot ing t he Xen para- virt ualiz ed drivers 37.5. Verifying t he para-virt ualiz ed 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.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Additional resources To learn more about virtualization and Red Hat Enterprise Linux, see the following resources. A.1. Online resources http://www.cl.cam.ac.uk/research/srg/netos/xen/ The project website of the Xen™ paravirtualization machine manager from which the Red Hat kernel-xen package is derived.
Addit ional resources create programs that interface with the libvirt virtualization management library. /usr/share/doc/python-virtinst- — 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- — Provides documentation on the Virtual Machine Manager, which provides a graphical tool for administering virtual machines.
Red Hat Ent erprise Linux 5 Virt ualiz at ion G uide Colophon This manual was written in the D ocBook XML v4.3 format. This book is based on the work of Jan Mark Holzer, Chris Curran and Scott Radvan. Other writing credits go to: D on D utile contributed technical editing for the para-virtualized drivers section. Barry D onahue contributed technical editing for the para-virtualized drivers section. Rick Ring contributed technical editing for the Virtual Machine Manager Section.
Colophon Spanish Angela Garcia Gladys Guerrero Russian Yuliya Poyarkova 357