Cari di RHE Linux 
    RHE Linux User Manual
Daftar Isi
(Sebelumnya) 26 : Virtualization Host Confi ...26 : Chapter 12. PCI device co ... (Berikutnya)

Virtualization Host Configuration and Guest Installation Guide

Chapter 7. Installing a Red Hat Enterprise Linux 6 guest virtual machine on a Red Hat Enterprise Linux 6 host

This chapter covers how to install a Red Hat Enterprise Linux 6 guest virtual machine on a Red Hat Enterprise Linux 6 host.
These procedures assume that the KVM hypervisor and all other required packages are installed and the host is configured for virtualization.

Note

For more information on installing the virtualization packages, refer to Chapter 5, Installing the virtualization packages.

7.1. Creating a Red Hat Enterprise Linux 6 guest with local installation media

This procedure covers creating a Red Hat Enterprise Linux 6 guest virtual machine with a locally stored installation DVD or DVD image. DVD images are available from http://access.redhat.com for Red Hat Enterprise Linux 6.

Procedure 7.1. Creating a Red Hat Enterprise Linux 6 guest virtual machine with virt-manager

  1. Optional: Preparation

    Prepare the storage environment for the virtual machine. For more information on preparing storage, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.

    Important

    Various storage types may be used for storing guest virtual machines. However, for a virtual machine to be able to use migration features the virtual machine must be created on networked storage.
    Red Hat Enterprise Linux 6 requires at least 1GB of storage space. However, Red Hat recommends at least 5GB of storage space for a Red Hat Enterprise Linux 6 installation and for the procedures in this guide.
  2. Open virt-manager and start the wizard

    Open virt-manager by executing the virt-manager command as root or opening ApplicationsSystem ToolsVirtual Machine Manager.
    The Virtual Machine Manager window

    Figure 7.1. The Virtual Machine Manager window


    Click on the Create a new virtual machine button to start the new virtualized guest wizard.
    The Create a new virtual machine button

    Figure 7.2. The Create a new virtual machine button


    The New VM window opens.
  3. Name the virtual machine

    Virtual machine names can contain letters, numbers and the following characters: '_', '.' and '-'. Virtual machine names must be unique for migration and cannot consist only of numbers.
    Choose the Local install media (ISO image or CDROM) radio button.
    The New VM window - Step 1

    Figure 7.3. The New VM window - Step 1


    Click Forward to continue.
  4. Select the installation media

    Select the appropriate radio button for your installation media.
    Locate your install media

    Figure 7.4. Locate your install media


    • If you wish to install from a CD-ROM or DVD, select the Use CDROM or DVD radio button, and select the appropriate disk drive from the drop-down list of drives available.
    • If you wish to install from an ISO image, select Use ISO image, and then click the Browse... button to open the Locate media volume window.
      Select the installation image you wish to use, and click Choose Volume.
      If no images are displayed in the Locate media volume window, click on the Browse Local button to browse the host machine for the installation image or DVD drive containing the installation disk. Select the installation image or DVD drive containing the installation disk and click Open; the volume is selected for use and you are returned to the Create a new virtual machine wizard.

      Important

      For ISO image files and guest storage images, the recommended location to use is /var/lib/libvirt/images/. Any other location may require additional configuration by SELinux. Refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide for more details on configuring SELinux.
    Select the operating system type and version which match the installation media you have selected.
    The New VM window - Step 2

    Figure 7.5. The New VM window - Step 2


    Click Forward to continue.
  5. Set RAM and virtual CPUs

    Choose appropriate values for the virtual CPUs and RAM allocation. These values affect the host's and guest's performance. Memory and virtual CPUs can be overcommitted. For more information on overcommitting, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
    Virtual machines require sufficient physical memory (RAM) to run efficiently and effectively. Red Hat supports a minimum of 512MB of RAM for a virtual machine. Red Hat recommends at least 1024MB of RAM for each logical core.
    Assign sufficient virtual CPUs for the virtual machine. If the virtual machine runs a multithreaded application, assign the number of virtual CPUs the guest virtual machine will require to run efficiently.
    You cannot assign more virtual CPUs than there are physical processors (or hyper-threads) available on the host system. The number of virtual CPUs available is noted in the Up to X available field.
    The new VM window - Step 3

    Figure 7.6. The new VM window - Step 3


    Click Forward to continue.
  6. Storage

    Enable and assign storage for the Red Hat Enterprise Linux 6 guest virtual machine. Assign at least 5GB for a desktop installation or at least 1GB for a minimal installation.

    Note

    Live and offline migrations require virtual machines to be installed on shared network storage. For information on setting up shared storage for virtual machines, refer to the Red Hat Enterprise Linux Virtualization Administration Guide.
    1. With the default local storage

      Select the Create a disk image on the computer's hard drive radio button to create a file-based image in the default storage pool, the /var/lib/libvirt/images/ directory. Enter the size of the disk image to be created. If the Allocate entire disk now check box is selected, a disk image of the size specified will be created immediately. If not, the disk image will grow as it becomes filled.
      The New VM window - Step 4

      Figure 7.7. The New VM window - Step 4


      Click Forward to create a disk image on the local hard drive. Alternatively, select Select managed or other existing storage, then select Browse to configure managed storage.
    2. With a storage pool

      If you selected Select managed or other existing storage in the previous step to use a storage pool and clicked Browse, the Locate or create storage volume window will appear.
      The Locate or create storage volume window

      Figure 7.8. The Locate or create storage volume window


      1. Select a storage pool from the Storage Pools list.
      2. Optional: Click on the New Volume button to create a new storage volume. The Add a Storage Volume screen will appear. Enter the name of the new storage volume.
        Choose a format option from the Format dropdown menu. Format options include raw, cow, qcow, qcow2, qed, vmdk, and vpc. Adjust other fields as desired.
        The Add a Storage Volume window

        Figure 7.9. The Add a Storage Volume window


    Click Finish to continue.
  7. Verify and finish

    Verify there were no errors made during the wizard and everything appears as expected.
    Select the Customize configuration before install check box to change the guest's storage or network devices, to use the para-virtualized drivers or to add additional devices.
    Click on the Advanced options down arrow to inspect and modify advanced options. For a standard Red Hat Enterprise Linux 6 installation, none of these options require modification.
    The New VM window - local storage

    Figure 7.10. The New VM window - local storage


    Click Finish to continue into the Red Hat Enterprise Linux installation sequence. For more information on installing Red Hat Enterprise Linux 6 refer to the Red Hat Enterprise Linux 6 Installation Guide.
A Red Hat Enterprise Linux 6 guest virtual machine is now created from an ISO installation disc image.

7.2. Creating a Red Hat Enterprise Linux 6 guest with a network installation tree

Procedure 7.2. Creating a Red Hat Enterprise Linux 6 guest with virt-manager

  1. Optional: Preparation

    Prepare the storage environment for the guest virtual machine. For more information on preparing storage, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.

    Important

    >Various storage types may be used for storing guest virtual machines. However, for a virtual machine to be able to use migration features the virtual machine must be created on networked storage.
    Red Hat Enterprise Linux 6 requires at least 1GB of storage space. However, Red Hat recommends at least 5GB of storage space for a Red Hat Enterprise Linux 6 installation and for the procedures in this guide.
  2. Open virt-manager and start the wizard

    Open virt-manager by executing the virt-manager command as root or opening ApplicationsSystem ToolsVirtual Machine Manager.
    The main virt-manager window

    Figure 7.11. The main virt-manager window


    Click on the Create a new virtual machine button to start the new virtual machine wizard.
    The Create a new virtual machine button

    Figure 7.12. The Create a new virtual machine button


    The Create a new virtual machine window opens.
  3. Name the virtual machine

    Virtual machine names can contain letters, numbers and the following characters: '_', '.' and '-'. Virtual machine names must be unique for migration and cannot consist only of numbers.
    Choose the installation method from the list of radio buttons.
    The New VM window - Step 1

    Figure 7.13. The New VM window - Step 1


    Click Forward to continue.
  4. Provide the installation URL, and the Kickstart URL and Kernel options if required.
    The New VM window - Step 2

    Figure 7.14. The New VM window - Step 2


    Click Forward to continue.
  5. The remaining steps are the same as the ISO installation procedure. Continue from Step 5 of the ISO installation procedure.

7.3. Creating a Red Hat Enterprise Linux 6 guest with PXE

Procedure 7.3. Creating a Red Hat Enterprise Linux 6 guest with virt-manager

  1. Optional: Preparation

    Prepare the storage environment for the virtual machine. For more information on preparing storage, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.

    Important

    Various storage types may be used for storing guest virtual machines. However, for a virtual machine to be able to use migration features the virtual machine must be created on networked storage.
    Red Hat Enterprise Linux 6 requires at least 1GB of storage space. However, Red Hat recommends at least 5GB of storage space for a Red Hat Enterprise Linux 6 installation and for the procedures in this guide.
  2. Open virt-manager and start the wizard

    Open virt-manager by executing the virt-manager command as root or opening ApplicationsSystem ToolsVirtual Machine Manager.
    The main virt-manager window

    Figure 7.15. The main virt-manager window


    Click on the Create new virtualized guest button to start the new virtualized guest wizard.
    The create new virtualized guest button

    Figure 7.16. The create new virtualized guest button


    The New VM window opens.
  3. Name the virtual machine

    Virtual machine names can contain letters, numbers and the following characters: '_', '.' and '-'. Virtual machine names must be unique for migration and cannot consist only of numbers.
    Choose the installation method from the list of radio buttons.
    The New VM window - Step 1

    Figure 7.17. The New VM window - Step 1


    Click Forward to continue.
  4. The remaining steps are the same as the ISO installation procedure. Continue from Step 5 of the ISO installation procedure. From this point, the only difference in this PXE procedure is on the final New VM screen, which shows the Install: PXE Install field.
    The New VM window - Step 5 - PXE Install

    Figure 7.18. The New VM window - Step 5 - PXE Install


Chapter 8. Virtualizing Red Hat Enterprise Linux on Other Platforms

This chapter contains useful reference material for customers running Red Hat Enterprise Linux 6 as a virtualized operating system on other virtualization hosts.

8.1. On VMWare

Red Hat Enterprise Linux 6.3 and onward provide the vmxnet3 driver, a para-virtualized network adapter used when running Red Hat Enterprise Linux on VMWare hosts. For further information about this driver, refer to http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1001805.
Red Hat Enterprise Linux 6.4 and onward provide the vmw_pvscsi driver, a para-virtualized SCSI adapter used when running Red Hat Enterprise Linux on VMWare hosts. For further information about this driver, refer to http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1010398.

8.2. On Hyper-V

Red Hat Enterprise Linux 6.4 and onward provide Microsoft's Linux Integration Services, a set of drivers that enable synthetic device support in supported virtualized operating systems. Red Hat Enterprise Linux 6 is a supported virtualized operating system under Linux Integration Services version 3.4. Further details about the drivers provided are available from http://www.microsoft.com/en-us/download/details.aspx?id=34603.

Chapter 9. Installing a fully-virtualized Windows guest

This chapter describes how to create a fully-virtualized Windows guest using the command-line (virt-install), launch the operating system's installer inside the guest, and access the installer through virt-viewer.
To install a Windows operating system on the guest, use the virt-viewer tool. This tool allows you to display the graphical console of a virtual machine (via the VNC protocol). In doing so, virt-viewer allows you to install a fully-virtualized guest's operating system with that operating system's installer (for example, the Windows XP installer).
Installing a Windows operating system involves two major steps:
  1. Creating the guest virtual machine, using either virt-install or virt-manager.
  2. Installing the Windows operating system on the guest virtual machine, using virt-viewer.
Refer to Chapter 6, Guest virtual machine installation overview for details about creating a guest virtual machine with virt-install or virt-manager.
Note that this chapter does not describe how to install a Windows operating system on a fully-virtualized guest. Rather, it only covers how to create the guest and launch the installer within the guest. For information on how to install a Windows operating system, refer to the relevant Microsoft installation documentation.

9.1. Using virt-install to create a guest

The virt-install command allows you to create a fully-virtualized guest from a terminal, for example, without a GUI.

Important

Before creating the guest, consider first if the guest needs to use KVM Windows para-virtualized drivers. If it does, keep in mind that you can do so during or after installing the Windows operating system on the guest. For more information about para-virtualized drivers, refer to Chapter 10, KVM Para-virtualized Drivers.
For instructions on how to install KVM para-virtualized drivers, refer to Section 10.1, "Installing the KVM Windows para-virtualized drivers".
It is possible to create a fully-virtualized guest with only a single command. To do so, run the following program (replace the values accordingly):
# virt-install \   --name=guest-name \   --os-type=windows \   --network network=default \   --disk path=path-to-disk,size=disk-size \   --cdrom=path-to-install-disk \   --graphics spice --ram=1024
The path-to-disk must be a device (e.g. /dev/sda3) or image file (/var/lib/libvirt/images/name.img). It must also have enough free space to support the disk-size.

Important

All image files are stored in /var/lib/libvirt/images/ by default. Other directory locations for file-based images are possible, but may require SELinux configuration. If you run SELinux in enforcing mode, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide for more information on SELinux.
You can also run virt-install interactively. To do so, use the --prompt command, as in:
# virt-install --prompt
Once the fully-virtualized guest is created, virt-viewer will launch the guest and run the operating system's installer. Refer to to the relevant Microsoft installation documentation for instructions on how to install the operating system.

Chapter 10. KVM Para-virtualized Drivers

Para-virtualized drivers are available for Windows guest virtual machines running on KVM hosts. These para-virtualized drivers are included in the virtio package. The virtio package supports block (storage) devices and network interface controllers.
Para-virtualized drivers enhance the performance of fully virtualized guests. With the para-virtualized drivers guest I/O latency decreases and throughput increases to near bare-metal levels. It is recommended to use the para-virtualized drivers for fully virtualized guests running I/O heavy tasks and applications.
The KVM para-virtualized drivers are automatically loaded and installed on the following:
  • Red Hat Enterprise Linux 4.8 and newer
  • Red Hat Enterprise Linux 5.3 and newer
  • Red Hat Enterprise Linux 6 and newer
  • Some versions of Linux based on the 2.6.27 kernel or newer kernel versions.
Versions of Red Hat Enterprise Linux in the list above detect and install the drivers, additional installation steps are not required.
In Red Hat Enterprise Linux 3 (3.9 and above), manual installation is required.

Note

PCI devices are limited by the virtualized system architecture. Refer to Chapter 12, PCI device configuration for additional limitations when using assigned devices.
Using KVM para-virtualized drivers, the following Microsoft Windows versions are expected to run similarly to bare-metal-based systems.
  • Windows XP Service Pack 3 and newer (32-bit only)
  • Windows Server 2003 (32-bit and 64-bit versions)
  • Windows Server 2008 (32-bit and 64-bit versions)
  • Windows Server 2008 R2 (64-bit only)
  • Windows 7 (32-bit and 64-bit versions)

10.1. Installing the KVM Windows para-virtualized drivers

This section covers the installation process for the KVM Windows para-virtualized drivers. The KVM para-virtualized drivers can be loaded during the Windows installation or installed after the guest is installed.
You can install the para-virtualized drivers on a guest virtual machine using one of the following methods:
  • hosting the installation files on a network accessible to the virtual machine,
  • 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.
This guide describes installation from the para-virtualized installer disk as a virtualized CD-ROM device.
  1. Download the drivers

    The virtio-win package contains the para-virtualized block and network drivers for all supported Windows guest virtual machines.

    Note

    The virtio-win package can be found here in RHN: https://rhn.redhat.com/rhn/software/packages/details/Overview.do?pid=602010. It requires access to one of the following channels:
    • RHEL Client Supplementary (v. 6)
    • RHEL Server Supplementary (v. 6)
    • RHEL Workstation Supplementary (v. 6)
    Download and install the virtio-win package on the host with the yum command.
     # yum install virtio-win
    The list of virtio-win packages that are supported on Windows operating systems, and the current certified package version, can be found at the following URL: windowsservercatalog.com.
    Note that the Red Hat Enterprise Virtualization Hypervisor and Red Hat Enterprise Linux are created on the same code base so the drivers for the same version (for example, Red Hat Enterprise Virtualization Hypervisor 3.0 and Red Hat Enterprise Linux 6) are supported for both environments.
    The virtio-win package installs a CD-ROM image, virtio-win.iso, in the /usr/share/virtio-win/ directory.
  2. Install the para-virtualized drivers

    It is recommended to install the drivers on the virtual machine before attaching or modifying a device to use the para-virtualized drivers.
    For block devices storing root file systems or other block devices required for booting the virtual machine, the drivers must be installed before the device is modified. If the drivers are not installed on the virtual machine and the driver is set to the virtio driver the virtual machine will not boot.

10.2. Installing the drivers on an installed Windows guest virtual machine

This procedure covers installing the para-virtualized drivers with a virtualized CD-ROM after Windows is installed.
Follow Procedure 10.1, "Installing from the driver CD-ROM image with virt-manager" to add a CD-ROM image with virt-manager and then install the drivers.

Procedure 10.1. Installing from the driver CD-ROM image with virt-manager

  1. Open virt-manager and the guest virtual machine

    Open virt-manager, then open the guest virtual machine from the list by double-clicking the guest name.
  2. Open the hardware window

    Click the lightbulb icon on the toolbar at the top of the window to view virtual hardware details.
    The Show virtual hardware details button.

    Figure 10.1. The virtual hardware details button


    Then click the Add Hardware button at the bottom of the new view that appears.
    The Add Hardware button.

    Figure 10.2. The virtual machine hardware information window


    This opens a wizard for adding the new device.
  3. Select the device type - for Red Hat Enterprise Linux 6 versions prior to 6.2

    Skip this step if you are using Red Hat Enterprise Linux 6.2 or later.
    On Red Hat Enterprise Linux 6 versions prior to version 6.2, you must select the type of device you wish to add. In this case, select Storage from the dropdown menu.
    The Add new virtual hardware wizard window in Red Hat Enterprise Linux 6.1 with Storage selected as the hardware type.

    Figure 10.3. The Add new virtual hardware wizard in Red Hat Enterprise Linux 6.1


    Click the Finish button to proceed.
  4. Select the ISO file

    Ensure that the Select managed or other existing storage radio button is selected, and browse to the para-virtualized driver's .iso image file. The default location for the latest version of the drivers is /usr/share/virtio-win/virtio-win.iso.
    Change the Device type to IDE cdrom and click the Forward button to proceed.
    Selecting the ISO file in the Add new virtual hardware wizard window.

    Figure 10.4. The Add new virtual hardware wizard


  5. Finish adding virtual hardware - for Red Hat Enterprise Linux 6 versions prior to 6.2

    If you are using Red Hat Enterprise Linux 6.2 or later, skip this step.
    On Red Hat Enterprise Linux 6 versions prior to version 6.2, click on the Finish button to finish adding the virtual hardware and close the wizard.
    The final screen of the Add new virtual hardware wizard in Red Hat Enterprise Linux 6.1.

    Figure 10.5. The Add new virtual hardware wizard in Red Hat Enterprise Linux 6.1


  6. Reboot

    Reboot or start the virtual machine to begin using the driver disc. Virtualized IDE devices require a restart to for the virtual machine to recognize the new device.
Once the CD-ROM with the drivers is attached and the virtual machine has started, proceed with Procedure 10.2, "Windows installation on a Windows 7 virtual machine".

Procedure 10.2. Windows installation on a Windows 7 virtual machine

This procedure installs the drivers on a Windows 7 virtual machine as an example. Adapt the Windows installation instructions to your guest's version of Windows.
  1. Open the Computer Management window

    On the desktop of the Windows virtual machine, click the Windows icon at the bottom corner of the screen to open the Start menu.
    Right-click on Computer and select Manage from the pop-up menu.
    A menu window opens on the Computer Management window when right-clicking D the My Computer icon on the desktop.

    Figure 10.6. The Computer Management window


  2. Open the Device Manager

    Select the Device Manager from the left-most pane. This can be found under Computer Management > System Tools.
    Opening the Device Manager on the right hand side of the Computer Management window.

    Figure 10.7. The Computer Management window


  3. Start the driver update wizard

    1. View available system devices

      Expand System devices by clicking on the arrow to its left.
      Detail of viewing available system devices from the Computer Management window.

      Figure 10.8. Viewing available system devices in the Computer Management window


    2. Locate the appropriate device

      There are up to four drivers available: the balloon driver, the serial driver, the network driver, and the block driver.
      • Balloon, the balloon driver, affects the PCI standard RAM Controller in the System devices group.
      • vioserial, the serial driver, affects the PCI Simple Communication Controller in the System devices group.
      • NetKVM, the network driver, affects the Network adapters group. This driver is only available if a virtio NIC is configured. Configurable parameters for this driver are documented in Appendix A, NetKVM Driver Parameters.
      • viostor, the block driver, affects the Disk drives group. This driver is only available if a virtio disk is configured.
      Right-click on the device whose driver you wish to update, and select Update Driver... from the pop-up menu.
      This example installs the balloon driver, so right-click on PCI standard RAM Controller.
      Locate the appropriate device under the expanded System Devices entry in the Computer Management window.

      Figure 10.9. The Computer Management window


    3. Open the driver update wizard

      From the drop-down menu, select Update Driver Software... to access the driver update wizard.
      Open the driver update wizard by right-clicking the device to be updated and selecting the first menu option, Update Driver Software, in the Computer Management window.

      Figure 10.10. Opening the driver update wizard


  4. Specify how to find the driver

    The first page of the driver update wizard asks how you want to search for driver software. Click on the second option, Browse my computer for driver software.
    The driver update wizard provides two options for searching for driver software.

    Figure 10.11. The driver update wizard


  5. Select the driver to install

    1. Open a file browser

      Click on Browse...
      The driver update wizard.

      Figure 10.12. The driver update wizard


    2. Browse to the location of the driver

      A separate driver is provided for each of the various combinations of operating system and architecture. The drivers are arranged hierarchically according to their driver type, the operating system, and the architecture on which they will be installed: driver_type/os/arch/. For example, the Balloon driver for a Windows 7 operating system with an x86 (32-bit) architecture, resides in the Balloon/w7/x86 directory.
      The Browse For Folder window, which pops up after choosing "Browse" to search for driver software on your computer. Select the folder that contains drivers for your hardware from this window.

      Figure 10.13. The Browse for driver software pop-up window


      Once you have navigated to the correct location, click OK.
    3. Click Next to continue

      The Update Driver Software wizard, with the specified location to search for driver software selected, with the Browse button on the right, and the Next and Cancel buttons at the bottom right of the window.

      Figure 10.14. The Update Driver Software wizard


      The following screen is displayed while the driver installs:
      As the driver software installs, a flashing bar in the Update Driver Software wizard window shows the system is busy.

      Figure 10.15. The Update Driver Software wizard


  6. Close the installer

    The following screen is displayed when installation is complete:
    After the driver software installs, the Update Driver Software wizard window read "Windows has successfully updated your driver software".

    Figure 10.16. The Update Driver Software wizard


    Click Close to close the installer.
  7. Reboot

    Reboot the virtual machine to complete the driver installation.

10.3. Installing drivers during the Windows installation

This procedure covers installing the para-virtualized drivers during a Windows installation.
This method allows a Windows guest virtual machine to use the para-virtualized (virtio) drivers for the default storage device.

Procedure 10.3. Installing para-virtualized drivers during the Windows installation

  1. Install the virtio-win package:
    # yum install virtio-win

    Note

    The virtio-win package can be found here in RHN: https://rhn.redhat.com/rhn/software/packages/details/Overview.do?pid=602010. It requires access to one of the following channels:
    • RHEL Client Supplementary (v. 6)
    • RHEL Server Supplementary (v. 6)
    • RHEL Workstation Supplementary (v. 6)
  2. Creating the guest virtual machine

    Important

    Create the virtual machine, as normal, without starting the virtual machine. Follow one of the procedures below.
    Select one of the following guest-creation methods, and follow the instructions.
    1. Creating the guest virtual machine with virsh

      This method attaches the para-virtualized driver floppy disk to a Windows guest before the installation.
      If the virtual machine is created from an XML definition file with virsh, use the virsh define command not the virsh create command.
      1. Create, but do not start, the virtual machine. Refer to the Red Hat Enterprise Linux Virtualization Administration Guide for details on creating virtual machines with the virsh command.
      2. Add the driver disk as a virtualized floppy disk with the virsh command. This example can be copied and used if there are no other virtualized floppy devices attached to the guest virtual machine. Note that vm_name should be replaced with the name of the virtual machine.
        # virsh attach-disk vm_name /usr/share/virtio-win/virtio-win.vfd fda --type floppy
        You can now continue with Step 3.
    2. Creating the guest virtual machine with virt-manager and changing the disk type

      1. At the final step of the virt-manager guest creation wizard, check the Customize configuration before install checkbox.
        Step 5 of 5 of creating a new virtual machine with virt-manager, with a checkbox selected under Storage to customize configuration before install.

        Figure 10.17. The virt-manager guest creation wizard


        Click on the Finish button to continue.
      2. Open the Add Hardware wizard

        Click the Add Hardware button in the bottom left of the new panel.
        The Add Hardware button.

        Figure 10.18. The Add Hardware button


      3. Select storage device

        Storage is the default selection in the Hardware type list.
        The Add new virtual hardware wizard with Storage selected in the Hardware type field.

        Figure 10.19. The Add new virtual hardware wizard


        Ensure the Select managed or other existing storage radio button is selected. Click Browse....
        The Add new virtual hardware wizard with Storage selected in the Hardware type field, and the Select managed or other existing storage radio button selected.

        Figure 10.20. Select managed or existing storage


        In the new window that opens, click Browse Local. Navigate to /usr/share/virtio-win/virtio-win.vfd, and click Select to confirm.
        Change Device type to Floppy disk, and click Finish to continue.
        The Device type field, set to Floppy Disk.

        Figure 10.21. Change the Device type


      4. Confirm settings

        Review the device settings.
        The virtual machine hardware information window with the target device (Floppy 1) selected.

        Figure 10.22. The virtual machine hardware information window


        You have now created a removable device accessible by your virtual machine.
      5. Change the hard disk type

        To change the hard disk type from IDE Disk to Virtio Disk, we must first remove the existing hard disk, Disk 1. Select the disk and click on the Remove button.
        The virtual machine hardware information window with virtual disk Disk 1 selected, with the Remove button available at the bottom right corner of the window.

        Figure 10.23. The virtual machine hardware information window


        Add a new virtual storage device by clicking Add Hardware. Then, change the Device type from IDE disk to Virtio Disk. Click Finish to confirm the operation.
        The virtual machine hardware information window with the Floppy 1 target device selected, and the Add Hardware on the left bottom corner of the window.

        Figure 10.24. The virtual machine hardware information window


      6. Ensure settings are correct

        Review the settings for VirtIO Disk 1.
        The virtual machine hardware information window with the Overview option selected, showing Basic Details, Hypervisor Details, plus expandable headings Machine Setting and Security, in the right part of the window.

        Figure 10.25. The virtual machine hardware information window


        When you are satisfied with the configuration details, click the Begin Installation button.
        The Begin Installation button.

        Figure 10.26. The Begin Installation button


        You can now continue with Step 3.
    3. Creating the guest virtual machine with virt-install

      Append the following parameter exactly as listed below to add the driver disk to the installation with the virt-install command:
      --disk path=/usr/share/virtio-win/virtio-win.vfd,device=floppy

      Important

      If the device you wish to add is a disk (that is, not a floppy or a cdrom), you will also need to add the bus=virtio option to the end of the --disk parameter, like so:
      --disk path=/usr/share/virtio-win/virtio-win.vfd,device=disk,bus=virtio
      According to the version of Windows you are installing, append one of the following options to the virt-install command:
      --os-variant winxp
      --os-variant win2k3
      --os-variant win7
      You can now continue with Step 3.
  3. Additional steps for driver installation

    During the installation, additional steps are required to install drivers, depending on the type of Windows guest.
    1. Windows Server 2003 and Windows XP

      Before the installation blue screen repeatedly press F6 for third party drivers.
      The Windows pre-installation blue screen reads Window Setup at the top in plain text, and "Press F6 if you need to install a third party SCSI or RAID driver..." at the bottom.

      Figure 10.27. The Windows Setup screen


      Press S to install additional device drivers.
      The next Windows pre-installation blue screen reads Window Setup at the top in plain text and details the option to install an additional device. Options at the bottom of the screen include S to "Specify Additional Device", ENTER to continue, or F3 to exit.

      Figure 10.28. The Windows Setup screen


      The next Windows blue screen reads Window Setup at the top in plain text and provides options to select the SCSI Adapter to be installed. Options at the bottom of the screen include ENTER to select, or F3 to exit.

      Figure 10.29. The Windows Setup screen


      Press Enter to continue the installation.
    2. Windows Server 2008

      Follow the same procedure for Windows Server 2003, but when the installer prompts you for the driver, click on Load Driver, point the installer to Drive A: and pick the driver that suits your guest operating system and architecture.

10.4. Using the para-virtualized drivers with Red Hat Enterprise Linux 3.9 guests

Para-virtualized drivers for Red Hat Enterprise Linux 3.9 consist of five kernel modules: virtio, virtio_blk, virtio_net, virtio_pci and virtio_ring. All five modules must be loaded to use both the para-virtualized block and network devices drivers.

Important

For Red Hat Enterprise Linux 3.9 guests, the kmod-virtio package is a requirement for the virtio module.

Note

To use the network device driver only, load the virtio, virtio_net and virtio_pci modules. To use the block device driver only, load the virtio, virtio_ring, virtio_blk and virtio_pci modules.

Important

The virtio package modifies the initrd RAM disk file in the /boot directory. The original initrd file is saved to /boot/initrd-kernel-version.img.virtio.orig. The original initrd file is replaced with a new initrd RAM disk containing the virtio driver modules. The initrd RAM disk is modified to allow the virtual machine to boot from a storage device using the para-virtualized drivers. To use a different initrd file, you must ensure that drivers are loaded with the sysinit script (Loading the para-virtualized drivers with the sysinit script) or when creating new initrd RAM disk (Adding the para-virtualized drivers to the initrd RAM disk).
Loading the para-virtualized drivers with the sysinit script
This procedure covers loading the para-virtualized driver modules during the boot sequence on a Red Hat Enterprise Linux 3.9 or newer guest with the sysinit script. Note that the guest virtual machine cannot use the para-virtualized drivers for the default boot disk if the modules are loaded with the sysinit script.
The drivers must be loaded in the following order:
  1. virtio
  2. virtio_ring
  3. virtio_pci
  4. virtio_blk
  5. virtio_net
virtio_net and virtio_blk are the only drivers whose order can be changed. If other drivers are loaded in a different order, they will not work.
Next, configure the modules. Locate the following section of the /etc/rc.d/rc.sysinit file.
if [ -f /etc/rc.modules ]; then   /etc/rc.modulesfi
Append the following lines after that section:
if [ -f /etc/rc.modules ]; then  /etc/rc.modulesfimodprobe virtiomodprobe virtio_ring # Comment this out if you do not need block drivermodprobe virtio_blk  # Comment this out if you do not need block drivermodprobe virtio_net  # Comment this out if you do not need net drivermodprobe virtio_pci
Reboot the guest virtual machine to load the kernel modules.
Adding the para-virtualized drivers to the initrd RAM disk
This procedure covers loading the para-virtualized driver modules with the kernel on a Red Hat Enterprise Linux 3.9 or newer guest by including the modules in the initrd RAM disk. The mkinitrd tool configures the initrd RAM disk to load the modules. Specify the additional modules with the --with parameter for the mkinitrd command. Append following set of parameters, in the exact order, when using the mkinitrd command to create a custom initrd RAM disk:
--with virtio --with virtio_ring --with virtio_blk --with virtio_net --with virtio_pci
AMD64 and Intel 64 issues
Use the x86_64 version of the virtio package for AMD64 systems.
Use the ia32e version of the virtio package for Intel 64 systems. Using the x86_64 version of the virtio may cause a 'Unresolved symbol' error during the boot sequence on Intel 64 systems.
Network performance issues
If you experience low performance with the para-virtualized network drivers, verify the setting for the GSO and TSO features on the host system. The para-virtualized network drivers require that the GSO and TSO options are disabled for optimal performance.
Verify the status of the GSO and TSO settings, use the command on the host (replacing interface with the network interface used by the guest):
# ethtool -k interface
Disable the GSO and TSO options with the following commands on the host:
# ethtool -K interface gso off# ethtool -K interface tso off
Para-virtualized driver swap partition issue
After activating the para-virtualized block device driver the swap partition may not be available. This issue is may be caused by a change in disk device name. To fix this issue, open the /etc/fstab file and locate the lines containing swap partitions, for example:
/dev/hda3   swap swapdefaults0 0
The para-virtualized drivers use the /dev/vd* naming convention, not the /dev/hd* naming convention. To resolve this issue modify the incorrect swap entries in the /etc/fstab file to use the /dev/vd* convention, for the example above:
/dev/vda3swap swapdefaults0 0
Save the changes and reboot the guest virtual machine. The virtual machine should now have swap partitions.

10.5. Using KVM para-virtualized drivers for existing devices

You can modify an existing hard disk device attached to the guest to use the virtio driver instead of the virtualized IDE driver. The example shown in this section edits libvirt configuration files. Note that the guest virtual machine does not need to be shut down to perform these steps, however the change will not be applied until the guest is completely shut down and rebooted.

Procedure 10.4. Using KVM para-virtualized drivers for existing devices

  1. Ensure that you have installed the appropriate driver (viostor), as described in Section 10.1, "Installing the KVM Windows para-virtualized drivers", before continuing with this procedure.
  2. Run the virsh edit <guestname> command as root to edit the XML configuration file for your device. For example, virsh edit guest1. The configuration files are located in /etc/libvirt/qemu.
  3. Below is a file-based block device using the virtualized IDE driver. This is a typical entry for a virtual machine not using the para-virtualized drivers.
    <disk type='file' device='disk'>   <source file='/var/lib/libvirt/images/disk1.img'/>   <target dev='hda' bus='ide'/></disk>
  4. Change the entry to use the para-virtualized device by modifying the bus= entry to virtio. Note that if the disk was previously IDE it will have a target similar to hda, hdb, or hdc and so on. When changing to bus=virtio the target needs to be changed to vda, vdb, or vdc accordingly.
    <disk type='file' device='disk'>   <source file='/var/lib/libvirt/images/disk1.img'/>   <target dev='vda' bus='virtio'/></disk>
  5. Remove the address tag inside the disk tags. This must be done for this procedure to work. Libvirt will regenerate the address tag appropriately the next time the virtual machine is started.
Alternatively, virt-manager, virsh attach-disk or virsh attach-interface can add a new device using the para-virtualized drivers.
Refer to the libvirt website for more details on using Virtio: http://www.linux-kvm.org/page/Virtio

10.6. Using KVM para-virtualized drivers for new devices

This procedure covers creating new devices using the KVM para-virtualized drivers with virt-manager.
Alternatively, the virsh attach-disk or virsh attach-interface commands can be used to attach devices using the para-virtualized drivers.

Important

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.

Procedure 10.5. Starting the new device wizard

  1. Open the guest virtual machine by double clicking on the name of the guest in virt-manager.
  2. Open the Show virtual hardware details tab by clicking the lightbulb button.
    The Show virtual hardware details tab

    Figure 10.30. The Show virtual hardware details tab


  3. In the Show virtual hardware details tab, click on the Add Hardware button.
  4. In the Adding Virtual Hardware tab select Storage or Network for the type of device. The storage and network device wizards are covered in procedures Procedure 10.6, "Adding a storage device using the para-virtualized storage driver" and Procedure 10.7, "Adding a network device using the para-virtualized network driver".

Procedure 10.6. Adding a storage device using the para-virtualized storage driver

  1. Open the guest virtual machine by double clicking on the name of the guest in virt-manager.
  2. Open the Show virtual hardware details tab by clicking the lightbulb button.
    The Show virtual hardware details tab

    Figure 10.31. The Show virtual hardware details tab


  3. In the Show virtual hardware details tab, click on the Add Hardware button.
  4. Select hardware type

    Select Network as the Hardware type.
    The Add new virtual hardware wizard with Storage selected as the hardware type.

    Figure 10.32. The Add new virtual hardware wizard


  5. Select the network device and driver

    Create a new disk image or select a storage pool volume.
    Set the Device type to Virtio Disk to use the para-virtualized drivers. Choose the desired Host device.
    The Add new virtual hardware wizard Storage window, with "Select managed or other existing storage" selected and specified in the field below.

    Figure 10.33. The Add new virtual hardware wizard


    Click Finish to complete the procedure.

Procedure 10.7. Adding a network device using the para-virtualized network driver

  1. Select hardware type

    Select Network as the Hardware type.
    The Add new virtual hardware wizard with Network selected as the hardware type.

    Figure 10.34. The Add new virtual hardware wizard


    Click Forward to continue.
  2. Select the network device and driver

    Select the network device from the Host device list.
    Create a custom MAC address or use the one provided.
    Set the Device model to virtio to use the para-virtualized drivers.
    The Add new virtual hardware wizard Network setup, with options for selecting the network device and driver.

    Figure 10.35. The Add new virtual hardware wizard


    Click Forward to continue.
  3. Finish the procedure

    Confirm the details for the new device are correct.
    The Add new virtual hardware wizard showing the details of the newly created network, and the Finish button at the bottom right corner of the window.

    Figure 10.36. The Add new virtual hardware wizard


    Click Finish to complete the procedure.
Once all new devices are added, reboot the virtual machine. Windows virtual machines may not recognize the devices until the guest is rebooted.

Chapter 11. Network configuration

This chapter provides an introduction to the common networking configurations used by libvirt based guest virtual machines. For additional information, consult the libvirt network architecture documentation: http://libvirt.org/intro.html.
Red Hat Enterprise Linux 6 supports the following networking setups for virtualization:
  • virtual networks using Network Address Translation (NAT)
  • directly allocated physical devices using PCI device assignment
  • directly allocated virtual functions using PCIe SR-IOV
  • bridged networks
You must enable NAT, network bridging or directly assign a PCI device to allow external hosts access to network services on guest virtual machines.

11.1. Network Address Translation (NAT) with libvirt

One of the most common methods for sharing network connections is to use Network Address Translation (NAT) forwarding (also known as virtual networks).
Host configuration
Every standard libvirt installation provides NAT-based connectivity to virtual machines as the default virtual network. Verify that it is available with the virsh net-list --all command.
# virsh net-list --allName State  Autostart -----------------------------------------default  active yes
If it is missing, the example XML configuration file can be reloaded and activated:
# virsh net-define /usr/share/libvirt/networks/default.xml
The default network is defined from /usr/share/libvirt/networks/default.xml
Mark the default network to automatically start:
# virsh net-autostart defaultNetwork default marked as autostarted
Start the default network:
# virsh net-start defaultNetwork default started
Once the libvirt default network is running, you will see an isolated bridge device. This device does not have any physical interfaces added. The new device uses NAT and IP forwarding to connect to the physical network. Do not add new interfaces.
# brctl showbridge name bridge id   STP enabled interfacesvirbr0  8000.000000000000   yes
libvirt adds iptables rules which allow traffic to and from guest virtual machines 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.ip_forward = 1
Guest virtual machine configuration
Once the host configuration is complete, a guest virtual machine can be connected to the virtual network based on its name. To connect a guest to the 'default' virtual network, the following could be used in the XML configuration file (such as /etc/libvirtd/qemu/myguest.xml) for the guest:
<interface type='network'>   <source network='default'/></interface>

Note

Defining a MAC address is optional. If you do not define one, a MAC address is automatically generated and used as the MAC address of the bridge device used by the network. Manually setting the MAC address may be useful to maintain consistency or easy reference throughout your environment, or to avoid the very small chance of a conflict.
<interface type='network'>  <source network='default'/>  <mac address='00:16:3e:1a:b3:4a'/></interface>

11.2. Disabling vhost-net

The vhost-net module is a kernel-level backend for virtio networking that reduces virtualization overhead by moving virtio packet processing tasks out of user space (the qemu process) and into the kernel (the vhost-net driver). vhost-net is only available for virtio network interfaces. If the vhost-net kernel module is loaded, it is enabled by default for all virtio interfaces, but can be disabled in the interface configuration in the case that a particular workload experiences a degradation in performance when vhost-net is in use.
Specifically, when UDP traffic is sent from a host machine to a guest virtual machine on that host, performance degradation can occur if the guest virtual machine processes incoming data at a rate slower than the host machine sends it. In this situation, enabling vhost-net causes the UDP socket's receive buffer to overflow more quickly, which results in greater packet loss. It is therefore better to disable vhost-net in this situation to slow the traffic, and improve overall performance.
To disable vhost-net, edit the <interface> sub-element in the guest virtual machine's XML configuration file and define the network as follows:
<interface type="network">   ...   <model type="virtio"/>   <driver name="qemu"/>   ...</interface>
Setting the driver name to qemu forces packet processing into qemu user space, effectively disabling vhost-net for that interface.

11.3. Bridged networking with libvirt

Bridged networking (also known as physical device sharing) is used to dedicate a physical device to a virtual machine. Bridging is often used for more advanced setups and on servers with multiple network interfaces.
To create a bridge (br0) based on the eth0 interface, execute the following command on the host:
# virsh iface-bridge eth0 br0

Important

NetworkManager does not support bridging. NetworkManager must be disabled to use networking with the network scripts (located in the /etc/sysconfig/network-scripts/ directory).
# chkconfig NetworkManager off# chkconfig network on# service NetworkManager stop# service network start
If you do not want to disable NetworkManager entirely, add "NM_CONTROLLED=no" to the ifcfg-* network script being used for the bridge.
(Sebelumnya) 26 : Virtualization Host Confi ...26 : Chapter 12. PCI device co ... (Berikutnya)