| Virtualization Host Configuration and Guest Installation GuideInstalling and configuring your virtual environmentEdition 4 Red Hat Engineering Content ServicesLegal NoticeCopyright © 2012 Red Hat, Inc. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution-Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux® is the registered trademark of Linus Torvalds in the United States and other countries. Java® is a registered trademark of Oracle and/or its affiliates. XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries. All other trademarks are the property of their respective owners. 1801 Varsity Drive Raleigh, NC 27606-2072 USA Phone: +1 919 754 3700 Phone: 888 733 4281 Fax: +1 919 754 3701
Daftar IsiAbstract This guide covers KVM packages, compatibility and restrictions. Also included are host configuration details and instructions for installing guest virtual machines of different types, PCI device configuration and SR-IOV. This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default. 1.1. Typographic ConventionsFour typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows. Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight keys and key combinations. For example: To see the contents of the file my_next_bestselling_novel in your current working directory, enter the cat my_next_bestselling_novel command at the shell prompt and press Enter to execute the command.
The above includes a file name, a shell command and a key, all presented in mono-spaced bold and all distinguishable thanks to context. Key combinations can be distinguished from an individual key by the plus sign that connects each part of a key combination. For example: Press Enter to execute the command. Press Ctrl+Alt+F2 to switch to a virtual terminal.
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.
Proportional Bold This denotes words or phrases encountered on a system, including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example: Choose ⤍ ⤍ from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse check box and click Close to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand). To insert a special character into a gedit file, choose ⤍ ⤍ from the main menu bar. Next, choose ⤍ from the Character Map menu bar, type the name of the character in the Search field and click Next. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the Copy button. Now switch back to your document and choose ⤍ from the gedit menu bar.
The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context. Mono-spaced Bold Italic or Proportional Bold Italic
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example: To connect to a remote machine using ssh, type ssh username @domain.name at a shell prompt. If the remote machine is example.com and your username on that machine is john, type ssh [email protected] . The mount -o remount file-system command remounts the named file system. For example, to remount the /home file system, the command is mount -o remount /home . To see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release .
Note the words in bold italics above - username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system. Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example: Publican is a DocBook publishing system.
1.2. Pull-quote ConventionsTerminal output and source code listings are set off visually from the surrounding text. Output sent to a terminal is set in mono-spaced roman and presented thus: books Desktop documentation drafts mss photos stuff svnbooks_tests Desktop1 downloads images notes scripts svgs Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows: package org.jboss.book.jca.ex1;import javax.naming.InitialContext;public class ExClient{ public static void main(String args[]) throws Exception { InitialContext iniCtx = new InitialContext(); Object ref = iniCtx.lookup("EchoBean"); EchoHome home = (EchoHome) ref; Echo echo = home.create(); System.out.println("Created Echo"); System.out.println("Echo.echo('Hello') = " + echo.echo("Hello")); }} Finally, we use three visual styles to draw attention to information that might otherwise be overlooked. Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier. Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled 'Important' will not cause data loss but may cause irritation and frustration. Warnings should not be ignored. Ignoring warnings will most likely cause data loss. 2. Getting Help and Giving FeedbackIf you experience difficulty with a procedure described in this documentation, visit the Red Hat Customer Portal at http://access.redhat.com. Through the customer portal, you can: search or browse through a knowledgebase of technical support articles about Red Hat products. submit a support case to Red Hat Global Support Services (GSS). access other product documentation.
Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and technology. You can find a list of publicly available mailing lists at https://www.redhat.com/mailman/listinfo. Click on the name of any mailing list to subscribe to that list or to access the list archives. 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! Please submit a report in Bugzilla: http://bugzilla.redhat.com/ against the product Red Hat Enterprise Linux 6.When submitting a bug report, be sure to mention the manual's identifier: doc-Virtualization_Host_Configuration_and_Guest_Installation_Gui If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily. 1.1. What is in this guide?This guide provides information on installing virtualization software and configuring guest machines on a Red Hat Enterprise Linux virtualization host. The initial chapters in this guide outline the prerequisites to enable a Red Hat Enterprise Linux host machine to deploy virtualization. System requirements, compatible hardware, support and product restrictions are covered in detail. Guest virtual machine installation is covered in detail starting from Chapter 6, Guest virtual machine installation overview, with procedures for installing fully virtualized Red Hat Enterprise Linux guests and Windows para-virtualized guests using virt-manager and virsh. More detailed information on networking, PCI device configuration, SR-IOV, KVM guest timing management, and troubleshooting help for libvirt and SR-IOV is included later in the guide. This book provides guidance for virtualization host configuration and guest installation. For more detailed system configuration information, refer to the Red Hat Enterprise Linux Virtualization Administration Guide. In addition to this guide, the following titles cover virtualization with Red Hat Enterprise Linux: Virtualization Getting Started Guide: This guide provides an introduction to virtualization concepts, advantages, and tools, and an overview of Red Hat virtualization documentation and products. Virtualization Administration Guide: This guide covers administration of hosts, networking, storage, device and guest management using either virt-manager or virsh, a libvirt and QEMU reference, and troubleshooting information. Virtualization Security Guide: This guide provides an overview of virtualization security technologies provided by Red Hat. Also included are recommendations for securing hosts, guests, and shared infrastructure and resources in virtualized environments. Virtualization Tuning and Optimization Guide: This guide provides tips, tricks and suggestions for making full use of virtualization performance features and options for your systems and guest virtual machines.
Chapter 2. System requirementsThis chapter lists system requirements for successfully running virtual machines, referred to as VMs on Red Hat Enterprise Linux 6. Virtualization is available for Red Hat Enterprise Linux 6 on the Intel 64 and AMD64 architecture. The KVM hypervisor is provided with Red Hat Enterprise Linux 6. Minimum system requirements 6 GB free disk space. 2 GB of RAM.
Recommended system requirements One processor core or hyper-thread for the maximum number of virtualized CPUs in a guest virtual machine and one for the host. 2 GB of RAM plus additional RAM for virtual machines. 6 GB disk space for the host, plus the required disk space for each virtual machine. Most guest operating systems will require at least 6GB of disk space, but the additional storage space required for each guest depends on its image format. For guest virtual machines using raw images, the guest's total required space (total for raw format) is equal to or greater than the sum of the space required by the guest's raw image files (images) , the 6GB space required by the host operating system (host) , and the swap space that guest will require (swap) . Equation 2.1. Calculating required space for guest virtual machines using raw images total for raw format = images + host + swap
For qcow images, you must also calculate the expected maximum storage requirements of the guest (total for qcow format) , as qcow and qcow2 images grow as required. To allow for this expansion, first multiply the expected maximum storage requirements of the guest (expected maximum guest storage) by 1.01, and add to this the space required by the host (host) , and the necessary swap space (swap) . Equation 2.2. Calculating required space for guest virtual machines using qcow images total for qcow format = (expected maximum guest storage * 1.01) + host + swap
Guest virtual machine requirements are further outlined in the Red Hat Enterprise Linux 6 Virtualization Administration Guide in Chapter 6. Overcommitting with KVM. an Intel processor with the Intel VT-x and Intel 64 extensions for x86-based systems, or an AMD processor with the AMD-V and the AMD64 extensions.
Refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide to determine if your processor has the virtualization extensions. files on local storage, physical disk partitions, locally connected physical LUNs, LVM partitions, NFS shared file systems, iSCSI, GFS2 clustered file systems, Fibre Channel-based LUNs, and Fibre Channel over Ethernet (FCoE).
Chapter 3. KVM guest virtual machine compatibilityTo verify whether your processor supports the virtualization extensions and for information on enabling the virtualization extensions if they are disabled, refer to the Red Hat Enterprise Linux Virtualization Administration Guide. 3.1. Red Hat Enterprise Linux 6 support limitsRed Hat Enterprise Linux 6 servers have certain support limits. The following URLs explain the processor and memory amount limitations for Red Hat Enterprise Linux: The following URL is a complete reference showing supported operating systems and host and guest combinations: 3.2. Supported CPU ModelsRed Hat Enterprise Linux 6 supports the use of the following QEMU CPU model definitions: Opteron_G4 AMD Opteron 62xx (Gen 4 Class Opteron) Opteron_G3 AMD Opteron 23xx (Gen 3 Class Opteron) Opteron_G2 AMD Opteron 22xx (Gen 2 Class Opteron) Opteron_G1 AMD Opteron 240 (Gen 1 Class Opteron) SandyBridge Intel Xeon E312xx (Sandy Bridge) Nehalem Intel Core i7 9xx (Nehalem Class Core i7) Penryn Intel Core 2 Duo P9xxx (Penryn Class Core 2) Conroe Intel Celeron_4x0 (Conroe/Merom Class Core 2) Westmere Westmere E56xx/L56xx/X56xx (Nehalem-C) cpu64-rhel5 Red Hat Enterprise Linux 5 supported QEMU Virtual CPU version (cpu64-rhel5) cpu64-rhel6 Red Hat Enterprise Linux 6 supported QEMU Virtual CPU version (cpu64-rhel6)
Historically, CPU model definitions were hard-coded in qemu. This method of defining CPU models was inflexible, and made it difficult to create virtual CPUs with feature sets that matched existing physical CPUs. Typically, users modified a basic CPU model definition with feature flags in order to provide the CPU characteristics required by a virtual machine. Unless these feature sets were carefully controlled, safe migration - which requires feature sets between current and prospective hosts to match - was difficult to support. qemu-kvm has now replaced most hard-wired definitions with configuration file based CPU model definitions. Definitions for a number of current processor models are now included by default, allowing users to specify features more accurately and migrate more safely. A list of supported guest CPU models can be viewed with the /usr/libexec/qemu-kvm -cpu ?model command. This command outputs the name used to select the CPU model at the command line, and a model identifier that corresponds to a commercial instance of that processor class. Configuration details for all of these CPU models can be viewed with the /usr/libexec/qemu-kvm -cpu ?dump command, but they are also stored in the /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf file by default. Each CPU model definition begins with [cpudef] , as shown: [cpudef] name = "Nehalem" level = "2" vendor = "GenuineIntel" family = "6" model = "26" stepping = "3" feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca \ pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" feature_ecx = "popcnt x2apic sse4.2 sse4.1 cx16 ssse3 sse3" extfeature_edx = "i64 syscall xd" extfeature_ecx = "lahf_lm" xlevel = "0x8000000A" model_id = "Intel Core i7 9xx (Nehalem Class Core i7)" The four CPUID fields, feature_edx , feature_ecx , extfeature_edx and extfeature_ecx , accept named flag values from the corresponding feature sets listed by the /usr/libexec/qemu-kvm -cpu ?cpuid command, as shown: # /usr/libexec/qemu-kvm -cpu ?cpuidRecognized CPUID flags: f_edx: pbe ia64 tm ht ss sse2 sse fxsr mmx acpi ds clflush pn \ pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc \ pse de vme fpu f_ecx: hypervisor avx osxsave xsave aes popcnt movbe x2apic \ sse4.2|sse4_2 sse4.1|sse4_1 dca pdcm xtpr cx16 fma cid \ ssse3 tm2 est smx vmx ds_cpl monitor dtes64 pclmuldq \ pni|sse3 extf_edx: 3dnow 3dnowext lm rdtscp pdpe1gb fxsr_opt fxsr mmx \ mmxext nx pse36 pat cmov mca pge mtrr syscall apic cx8 \ mce pae msr tsc pse de vme fpu extf_ecx: nodeid_msr cvt16 fma4 wdt skinit xop ibs osvw \ 3dnowprefetch misalignsse sse4a abm cr8legacy extapic svm \ cmp_legacy lahf_lm These feature sets are described in greater detail in the appropriate Intel and AMD specifications. It is important to use the check flag to verify that all configured features are available. # /usr/libexec/qemu-kvm -cpu Nehalem,checkwarning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]warning: host cpuid 0000_0001 lacks requested flag 'popcnt' [0x00800000] If a defined feature is not available, those features will fail silently by default. Chapter 4. Virtualization restrictionsThis chapter covers additional support and product restrictions of the virtualization packages in Red Hat Enterprise Linux 6. The following restrictions apply to the KVM hypervisor: - Maximum vCPUs per guest
Guest virtual machines support up to a maximum of 160 virtual CPUs in Red Hat Enterprise Linux 6. - Constant TSC bit
Systems without a Constant Time Stamp Counter require additional configuration. Refer to Chapter 14, KVM guest timing management for details on determining whether you have a Constant Time Stamp Counter and configuration steps for fixing any related issues. - Memory overcommit
KVM supports memory overcommit and can store the memory of guest virtual machines in swap. A virtual machine will run slower if it is swapped frequently. Red Hat Knowledgebase has an article on safely and efficiently determining the size of the swap partition, available here: https://access.redhat.com/knowledge/solutions/15244. When KSM is used for memory overcommitting, make sure that the swap size follows the recommendations described in this article. When device assignment is in use, all virtual machine memory must be statically pre-allocated to enable DMA with the assigned device. Memory overcommit is therefore not supported with device assignment. - CPU overcommit
It is not recommended to have more than 10 virtual CPUs per physical processor core. Customers are encouraged to use a capacity planning tool in order to determine the CPU overcommit ratio. Estimating an ideal ratio is difficult as it is highly dependent on each workload. For instance, a guest virtual machine may consume 100% CPU on one use case, and multiple guests may be completely idle on another. Red Hat does not support running more vCPUs to a single guest than the amount of overall physical cores that exist on the system. While Hyperthreads can be considered as cores, their performance can also vary from one scenario to the next, and they should not be expected to perform as well as regular cores. Refer to the Red Hat Enterprise Linux Virtualization Administration Guide for tips and recommendations on overcommitting CPUs. - Virtualized SCSI devices
SCSI emulation is not supported with KVM in Red Hat Enterprise Linux. - Virtualized IDE devices
KVM is limited to a maximum of four virtualized (emulated) IDE devices per guest virtual machine. - Para-virtualized devices
Para-virtualized devices are also known as Virtio devices. They are purely virtual devices designed to work optimally in a virtual machine. Red Hat Enterprise Linux 6 supports 32 PCI device slots per virtual machine, and 8 PCI functions per device slot. This gives a theoretical maximum of 256 PCI functions per guest when multi-function capabilities are enabled. However, this theoretical maximum is subject to the following limitations: Each virtual machine supports a maximum of 8 assigned device functions. 4 PCI device slots are configured with emulated devices by default. However, users can explicitly remove 2 of the emulated devices that are configured by default (the video adapter device in slot 2, and the memory balloon driver device in slot 3). This gives users a supported functional maximum of 30 PCI device slots per virtual machine.
- Migration restrictions
Device assignment refers to physical devices that have been exposed to a virtual machine, for the exclusive use of that virtual machine. Because device assignment uses hardware on the specific host where the virtual machine runs, migration and save/restore are not supported when device assignment is in use. If the guest operating system supports hot-plugging, assigned devices can be removed prior to the migration or save/restore operation to enable this feature. Live migration is only possible between hosts with the same CPU type (that is, Intel to Intel or AMD to AMD only). For live migration, both hosts must have the same value set for the No eXecution (NX) bit, either on or off . For migration to work, cache=none must be specified for all block devices opened in write mode. Failing to include the cache=none option can result in disk corruption. - Storage restrictions
There are risks associated with giving guest virtual machines write access to entire disks or block devices (such as /dev/sdb ). If a guest virtual machine has access to an entire block device, it can share any volume label or partition table with the host machine. If bugs exist in the host system's partition recognition code, this can create a security risk. Avoid this risk by configuring the host machine to ignore devices assigned to a guest virtual machine. Failing to adhere to storage restrictions can result in risks to security. - SR-IOV restrictions
SR-IOV is only thoroughly tested with the following devices (other SR-IOV devices may work but have not been tested at the time of release): Intel® 82576NS Gigabit Ethernet Controller (igb driver) Intel® 82576EB Gigabit Ethernet Controller (igb driver) Intel® 82599ES 10 Gigabit Ethernet Controller (ixgbe driver) Intel® 82599EB 10 Gigabit Ethernet Controller (ixgbe driver)
- Core dumping restrictions
Because core dumping is currently implemented on top of migration, it is not supported when device assignment is in use. - PCI device assignment restrictions
PCI device assignment (attaching PCI devices to virtual machines) requires host systems to have AMD IOMMU or Intel VT-d support to enable device assignment of PCI-e devices. For parallel/legacy PCI, only single devices behind a PCI bridge are supported. Multiple PCIe endpoints connected through a non-root PCIe switch require ACS support in the PCIe bridges of the PCIe switch. To disable this restriction, edit the /etc/libvirt/qemu.conf file and insert the line: relaxed_acs_check=1 Red Hat Enterprise Linux 6 has limited PCI configuration space access by guest device drivers. This limitation could cause drivers that are dependent on PCI configuration space to fail configuration. Red Hat Enterprise Linux 6.2 introduces interrupt remapping as a requirement for PCI device assignment. If your platform does not provide support for interrupt remapping, circumvent the KVM check for this support with the following command as the root user at the command line prompt: # echo 1 > /sys/module/kvm/parameters/allow_unsafe_assigned_interrupts
4.2. Application restrictionsThere are aspects of virtualization which make it unsuitable for certain types of applications. Applications with high I/O throughput requirements should use the para-virtualized drivers for fully-virtualized guests. Without the para-virtualized drivers certain applications may be unpredictable under heavy I/O loads. The following applications should be avoided due to high I/O requirements: kdump server netdump server
You should carefully evaluate applications and tools that heavily utilize I/O or those that require real-time performance. Consider the para-virtualized drivers or PCI device assignment for increased I/O performance. Refer to Chapter 10, KVM Para-virtualized Drivers for more information on the para-virtualized drivers for fully virtualized guests. Refer to Chapter 12, PCI device configuration for more information on PCI device assignment. Applications suffer a small performance loss from running in virtualized environments. The performance benefits of virtualization through consolidating to newer and faster hardware should be evaluated against the potential application performance issues associated with using virtualization. For the list of all other restrictions and issues affecting virtualization read the Red Hat Enterprise Linux 6 Release Notes. The Red Hat Enterprise Linux 6 Release Notes cover the present new features, known issues and restrictions as they are updated or discovered. Chapter 5. Installing the virtualization packagesBefore you can use virtualization, the virtualization packages must be installed on your computer. Virtualization packages can be installed either during the host installation sequence or after host installation using the yum command and the Red Hat Network (RHN). The KVM hypervisor uses the default Red Hat Enterprise Linux kernel with the kvm kernel module. 5.1. Configuring a Virtualization Host installationThis section covers installing virtualization tools and virtualization packages as part of a fresh Red Hat Enterprise Linux installation. Procedure 5.1. Installing the virtualization package group Launch the Red Hat Enterprise Linux 6 installation program Start an interactive Red Hat Enterprise Linux 6 installation from the Red Hat Enterprise Linux Installation CD-ROM, DVD or PXE. Continue installation up to package selection Complete the other steps up to the package selection step.
Select the Virtualization Host server role to install a platform for guest virtual machines. Alternatively, ensure that the Customize Now radio button is selected before proceeding, to specify individual packages. Select the Virtualization package group. This selects the qemu-kvm emulator, virt-manager , libvirt and virt-viewer for installation.
If you wish to create virtual machines in a graphical user interface (virt-manager) later, you should also select the General Purpose Desktop package group. Customize the packages (if required) Customize the Virtualization group if you require other virtualization packages.
Click on the Close button, then the Next button to continue the installation.
When the installation is complete, reboot the system. You require a valid RHN virtualization entitlement to receive updates for the virtualization packages. In the %packages section of your Kickstart file, append the following package groups: @virtualization@virtualization-client@virtualization-platform@virtualization-tools 5.2. Installing virtualization packages on an existing Red Hat Enterprise Linux systemThis section describes the steps for installing the KVM hypervisor on a working Red Hat Enterprise Linux 6 or newer system. To install the packages, your machines must be registered. There are two methods of registering an unregistered installation of Red Hat Enterprise Linux: To register via RHN Classic, run the rhn_register command and follow the prompts. To register via Red Hat Subscription Manager, run the subscription-manager register command and follow the prompts.
To install the qemu-kvm and qemu-img packages, run the following command: # yum install qemu-kvm qemu-img Several additional virtualization management packages are also available: Recommended virtualization packages - python-virtinst
Provides the virt-install command for creating virtual machines. - libvirt
The libvirt package provides the server and host side libraries for interacting with hypervisors and host systems. The libvirt package provides the libvirtd daemon that handles the library calls, manages virtual machines and controls the hypervisor. - libvirt-python
The libvirt-python package contains a module that permits applications written in the Python programming language to use the interface supplied by the libvirt API. - virt-manager
virt-manager , also known as Virtual Machine Manager, provides a graphical tool for administering virtual machines. It uses libvirt-client library as the management API.
- libvirt-client
The libvirt-client package provides the client-side APIs and libraries for accessing libvirt servers. The libvirt-client package includes the virsh command line tool to manage and control virtual machines and hypervisors from the command line or a special virtualization shell.
Install all of these recommended virtualization packages with the following command: # yum install virt-manager libvirt libvirt-python python-virtinst libvirt-client Note that the qemu-img package is installed as a dependency of the Virtualization package group if it is not already installed on the system. It can also be installed manually with the yum install qemu-img command as described previously. Table 5.1. Virtualization Package Groups Package Group | Description | Mandatory Packages | Optional Packages |
---|
Virtualization | Provides an environment for hosting virtual machines | qemu-kvm | qemu-guest-agent, qemu-kvm-tools | Virtualization Client | Clients for installing and managing virtualization instances | python-virtinst, virt-manager, virt-viewer | virt-top | Virtualization Platform | Provides an interface for accessing and controlling virtual machines and containers | libvirt, libvirt-client, virt-who, virt-what | fence-virtd-libvirt, fence-virtd-multicast, fence-virtd-serial, libvirt-cim, libvirt-java, libvirt-qmf, libvirt-snmp, perl-Sys-Virt | Virtualization Tools | Tools for offline virtual image management | libguestfs | libguestfs-java, libguestfs-tools, virt-v2v |
To install a package group, run the yum groupinstall <groupname> command. For instance, to install the Virtualization Tools package group, run the yum groupinstall "Virtualization Tools" command. Chapter 6. Guest virtual machine installation overviewAfter you have installed the virtualization packages on the host system you can create guest operating systems. This chapter describes the general processes for installing guest operating systems on virtual machines. You can create guest virtual machines using the New button in virt-manager or use the command line interface virt-install . Both methods are covered by this chapter. Detailed installation instructions are available in the following chapters for specific versions of Red Hat Enterprise Linux and Microsoft Windows. 6.1. Guest virtual machine prerequisites and considerationsVarious factors should be considered before creating any guest virtual machines. Not only should the role of a virtual machine be considered before deployment, but regular ongoing monitoring and assessment based on variable factors (load, amount of clients) should be performed. Some factors include: - Performance
Guest virtual machines should be deployed and configured based on their intended tasks. Some guest systems (for instance, guests running a database server) may require special performance considerations. Guests may require more assigned CPUs or memory based on their role and projected system load. - Input/Output requirements and types of Input/Output
Some guest virtual machines may have a particularly high I/O requirement or may require further considerations or projections based on the type of I/O (for instance, typical disk block size access, or the amount of clients). - Storage
Some guest virtual machines may require higher priority access to storage or faster disk types, or may require exclusive access to areas of storage. The amount of storage used by guests should also be regularly monitored and taken into account when deploying and maintaining storage. - Networking and network infrastructure
Depending upon your environment, some guest virtual machines could require faster network links than other guests. Bandwidth or latency are often factors when deploying and maintaining guests, especially as requirements or load changes. - Request requirements
SCSI requests can only be issued to guest virtual machines on virtio drives if the virtio drives are backed by whole disks, and the disk device parameter is set to lun , as shown in the following example: <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='block' device='lun'>
6.2. Creating guests with virt-installYou can use the virt-install command to create guest virtual machines from the command line. virt-install is used either interactively or as part of a script to automate the creation of virtual machines. Using virt-install with Kickstart files allows for unattended installation of virtual machines. The virt-install tool provides a number of options that can be passed on the command line. To see a complete list of options run the following command: # virt-install --help Note that you need root privileges in order for virt-install commands to complete successfully. The virt-install man page also documents each command option and important variables. qemu-img is a related command which may be used before virt-install to configure storage options.
An important option is the --graphics option which allows graphical installation of a virtual machine. Example 6.1. Using virt-install to install a Red Hat Enterprise Linux 5 guest virtual machine This example creates a Red Hat Enterprise Linux 5 guest: virt-install \ --name=guest1-rhel5-64 \ --file=/var/lib/libvirt/images/guest1-rhel5-64.dsk \ --file-size=8 \ --nonsparse --graphics spice \ --vcpus=2 --ram=2048 \ --location=http://example1.com/installation_tree/RHEL5.6-Server-x86_64/os \ --network bridge=br0 \ --os-type=linux \ --os-variant=rhel5.4 Ensure that you select the correct os-type for your operating system when running this command. Refer to man virt-install for more examples. When installing a Windows guest with virt-install , the --os-type=windows option is recommended. This option prevents the CD-ROM from disconnecting when rebooting during the installation procedure. The --os-variant option further optimizes the configuration for a specific guest operating system. 6.3. Creating guests with virt-managervirt-manager , also known as Virtual Machine Manager, is a graphical tool for creating and managing guest virtual machines.
Procedure 6.1. Creating a guest virtual machine with virt-manager Open virt-manager Start virt-manager . Launch the application from the menu and submenu. Alternatively, run the virt-manager command as root. Optional: Open a remote hypervisor Select the hypervisor and press the Connect button to connect to the remote hypervisor. Create a new virtual machine
The wizard breaks down the virtual machine creation process into five steps: Naming the guest virtual machine and choosing the installation type Locating and configuring the installation media Configuring memory and CPU options Configuring the virtual machine's storage Configuring networking, architecture, and other hardware settings
Ensure that virt-manager can access the installation media (whether locally or over the network) before you continue. Specify name and installation type The guest virtual machine creation process starts with the selection of a name and installation type. Virtual machine names can have underscores (_ ), periods (. ), and hyphens (- ).
Type in a virtual machine name and choose an installation type: - Local install media (ISO image or CDROM)
This method uses a CD-ROM, DVD, or image of an installation disk (for example, .iso ). - Network Install (HTTP, FTP, or NFS)
Network installing involves the use of a mirrored Red Hat Enterprise Linux or Fedora installation tree to install a guest. The installation tree must be accessible through either HTTP, FTP, or NFS. - Network Boot (PXE)
This method uses a Preboot eXecution Environment (PXE) server to install the guest virtual machine. Setting up a PXE server is covered in the Deployment Guide. To install via network boot, the guest must have a routable IP address or shared network device. For information on the required networking configuration for PXE installation, refer to Section 6.4, "Installing guest virtual machines with PXE". - Import existing disk image
This method allows you to create a new guest virtual machine and import a disk image (containing a pre-installed, bootable operating system) to it.
Click Forward to continue. Configure installation Next, configure the and of the installation. Ensure that you select the appropriate OS type for your virtual machine. Depending on the method of installation, provide the install URL or existing storage path.
Configure CPU and memory The next step involves configuring the number of CPUs and amount of memory to allocate to the virtual machine. The wizard shows the number of CPUs and amount of memory you can allocate; configure these settings and click Forward.
Configure storage Assign storage to the guest virtual machine.
If you chose to import an existing disk image during the first step, virt-manager will skip this step. Assign sufficient space for your virtual machine and any applications it requires, then click Forward to continue. Final configuration Verify the settings of the virtual machine and click Finish when you are satisfied; doing so will create the virtual machine with default networking settings, virtualization type, and architecture.
If you prefer to further configure the virtual machine's hardware first, check the box first before clicking Finish. Doing so will open another wizard that will allow you to add, remove, and configure the virtual machine's hardware settings. After configuring the virtual machine's hardware, click Apply. virt-manager will then create the virtual machine with your specified hardware settings.
6.4. Installing guest virtual machines with PXEBy default, if no network is found, the guest virtual machine attempts to boot from alternative bootable devices. If there is no other bootable device found, the guest pauses. You can use the qemu-kvm boot parameter reboot-timeout to allow the guest to retry booting if no bootable device is found, like so: # qemu-kvm -boot reboot-timeout=1000 Example 6.2. Fully-virtualized PXE installation with virt-install # virt-install --hvm --connect qemu:///system \--network=bridge:installation --pxe --graphics spice \--name rhel6-machine --ram=756 --vcpus=4 \--os-type=linux --os-variant=rhel6 \--disk path=/var/lib/libvirt/images/rhel6-machine.img,size=10 Note that the command above cannot be executed in a text-only environment. A fully-virtualized (--hvm ) guest can only be installed in a text-only environment if the --location and --extra-args "console=console_type " are provided instead of the --graphics spice parameter. Procedure 6.2. PXE installation with virt-manager Select PXE Select PXE as the installation method and follow the rest of the steps to configure the OS type, memory, CPU and storage settings.
Start the installation The installation is ready to start.
A DHCP request is sent and if a valid PXE server is found the guest virtual machine's installation processes will start. |
| |