| Virtualization Host Configuration and Guest Installation GuideChapter 7. Installing a Red Hat Enterprise Linux 6 guest virtual machine on a Red Hat Enterprise Linux 6 hostThis 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. 7.1. Creating a Red Hat Enterprise Linux 6 guest with local installation mediaThis 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 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. 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. Open virt-manager and start the wizard Open virt-manager by executing the virt-manager command as root or opening Applications ⤍ System Tools ⤍ Virtual Machine Manager.
Click on the Create a new virtual machine button to start the new virtualized guest wizard.
The New VM window opens. 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.
Click Forward to continue. Select the installation media Select the appropriate radio button for your installation 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. 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.
Click Forward to continue. 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.
Click Forward to continue. 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. 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. 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.
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. 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.
Select a storage pool from the Storage Pools list. 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.
Click Finish to continue. 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.
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 treeProcedure 7.2. Creating a Red Hat Enterprise Linux 6 guest with virt-manager 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. >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. Open virt-manager and start the wizard Open virt-manager by executing the virt-manager command as root or opening Applications ⤍ System Tools ⤍ Virtual Machine Manager.
Click on the Create a new virtual machine button to start the new virtual machine wizard.
The Create a new virtual machine window opens. 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.
Click Forward to continue. Provide the installation URL, and the Kickstart URL and Kernel options if required.
Click Forward to continue. 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 PXEProcedure 7.3. Creating a Red Hat Enterprise Linux 6 guest with virt-manager 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. 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. Open virt-manager and start the wizard Open virt-manager by executing the virt-manager command as root or opening Applications ⤍ System Tools ⤍ Virtual Machine Manager.
Click on the Create new virtualized guest button to start the new virtualized guest wizard.
The New VM window opens. 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.
Click Forward to continue. 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.
Chapter 8. Virtualizing Red Hat Enterprise Linux on Other PlatformsThis chapter contains useful reference material for customers running Red Hat Enterprise Linux 6 as a virtualized operating system on other virtualization hosts. 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 guestThis 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: Creating the guest virtual machine, using either virt-install or virt-manager . Installing the Windows operating system on the guest virtual machine, using virt-viewer .
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 guestThe virt-install command allows you to create a fully-virtualized guest from a terminal, for example, without a GUI. 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. 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 . 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 DriversPara-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. 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 driversThis 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. Download the drivers The virtio-win package contains the para-virtualized block and network drivers for all supported Windows guest virtual machines. 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. 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 machineThis procedure covers installing the para-virtualized drivers with a virtualized CD-ROM after Windows is installed. Procedure 10.1. Installing from the driver CD-ROM image with virt-manager 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. Open the hardware window Click the lightbulb icon on the toolbar at the top of the window to view virtual hardware details.
Then click the Add Hardware button at the bottom of the new view that appears.
This opens a wizard for adding the new device. 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.
Click the Finish button to proceed. 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.
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.
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.
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. 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.
Open the Device Manager Select the Device Manager from the left-most pane. This can be found under Computer Management > System Tools.
Start the driver update wizard View available system devices Expand System devices by clicking on the arrow to its left.
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.
Open the driver update wizard From the drop-down menu, select Update Driver Software... to access the driver update wizard.
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.
Select the driver to install Open a file browser Click on Browse...
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.
Once you have navigated to the correct location, click OK. Click Next to continue
The following screen is displayed while the driver installs:
Close the installer The following screen is displayed when installation is complete:
Click Close to close the installer. Reboot Reboot the virtual machine to complete the driver installation.
10.3. Installing drivers during the Windows installationThis 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 Install the virtio-win package: # yum install virtio-win RHEL Client Supplementary (v. 6) RHEL Server Supplementary (v. 6) RHEL Workstation Supplementary (v. 6)
Creating the guest virtual machine 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. 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. 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. 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.
Creating the guest virtual machine with virt-manager and changing the disk type At the final step of the virt-manager guest creation wizard, check the Customize configuration before install checkbox.
Click on the Finish button to continue. Open the Add Hardware wizard Click the Add Hardware button in the bottom left of the new panel.
Select storage device Storage is the default selection in the Hardware type list.
Ensure the Select managed or other existing storage radio button is selected. Click Browse....
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.
Confirm settings Review the device settings.
You have now created a removable device accessible by your virtual machine. 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.
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.
Ensure settings are correct Review the settings for VirtIO Disk 1 .
When you are satisfied with the configuration details, click the Begin Installation button.
You can now continue with Step 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 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.
Additional steps for driver installation During the installation, additional steps are required to install drivers, depending on the type of Windows guest. Windows Server 2003 and Windows XP Before the installation blue screen repeatedly press F6 for third party drivers.
Press S to install additional device drivers.
Press Enter to continue the installation. 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 guestsPara-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. For Red Hat Enterprise Linux 3.9 guests, the kmod-virtio package is a requirement for the virtio module. 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. 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). The drivers must be loaded in the following order: virtio
virtio_ring
virtio_pci
virtio_blk
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. --with virtio --with virtio_ring --with virtio_blk --with virtio_net --with virtio_pci 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. 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 /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 devicesYou 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 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 . 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> 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> 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. 10.6. Using KVM para-virtualized drivers for new devicesThis 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. 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 Open the guest virtual machine by double clicking on the name of the guest in virt-manager . Open the Show virtual hardware details tab by clicking the lightbulb button.
In the Show virtual hardware details tab, click on the Add Hardware button.
Procedure 10.6. Adding a storage device using the para-virtualized storage driver Open the guest virtual machine by double clicking on the name of the guest in virt-manager . Open the Show virtual hardware details tab by clicking the lightbulb button.
In the Show virtual hardware details tab, click on the Add Hardware button. Select hardware type Select Network as the Hardware type.
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.
Click Finish to complete the procedure.
Procedure 10.7. Adding a network device using the para-virtualized network driver Select hardware type Select Network as the Hardware type.
Click Forward to continue. 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.
Click Forward to continue. Finish the procedure Confirm the details for the new device are correct.
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 configurationThis 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 libvirtOne of the most common methods for sharing network connections is to use Network Address Translation (NAT) forwarding (also known as virtual networks). # 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 <interface type='network'> <source network='default'/></interface> 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-netThe 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 libvirtBridged 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 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. |
| |