Chapter 16. Installing and managing Windows virtual machines
To use Microsoft Windows as the guest operating system in your virtual machines (VMs) on a RHEL 8 host, Red Hat recommends taking extra steps to ensure these VMs run correctly.
For this purpose, the following sections provide information on installing and optimizing Windows VMs on the host, as well as installing and configuring drivers in these VMs.
16.1. Installing Windows virtual machines
The following provides information on how to create a fully-virtualized Windows machine on a RHEL 8 host, launch the graphical Windows installer inside the virtual machine (VM), and optimize the installed Windows guest operating system (OS).
You can create a VM and install it using the
virt-install command or the RHEL 8 web console.
A Windows OS installation source, which can be one of the following, and be available locally or on a network:
- An ISO image of an installation medium
- A disk image of an existing VM installation
A storage medium with the KVM
To create this medium, see Section 22.214.171.124, “Preparing virtio driver installation media on a host machine”.
Create the VM. For instructions, see Section 2.2, “Creating virtual machines”.
If using the
virt-installutility to create the VM, add the following options to the command:
The storage medium with the KVM
virtiodrivers. For example:
The Windows version you will install. For example, for Windows 10:
For a list of available Windows versions and the appropriate option, use the following command:
# osinfo-query os
If using the web console to create the VM, specify your version of Windows in the
Operating Systemfield of the
Create New Virtual Machinewindow. After the VM is created and the guest OS is installed, attach the storage medium with virtio drivers to the VM using the
Disksinterface. For instructions, see Section 5.8.3, “Attaching existing disks to virtual machines using the web console”.
Install the Windows OS in the VM.
For information on how to install a Windows operating system, refer to the relevant Microsoft installation documentation.
virtiodrivers in the Windows guest OS. For details, see Section 16.2.1, “Installing KVM paravirtualized drivers for Windows virtual machines”.
- For information on further optimizing Windows VMs, see Section 16.2, “Optimizing Windows virtual machines”.
16.2. Optimizing Windows virtual machines
When using Microsoft Windows as a guest operating system in a virtual machine (VM) hosted in RHEL 8, the performance of the guest may be negatively impacted.
Therefore, Red Hat recommends optimizing your Windows VMs by doing any combination of the following:
- Using paravirtualized drivers. For more information, see Section 16.2.1, “Installing KVM paravirtualized drivers for Windows virtual machines”.
- Enabling Hyper-V enlightenments. For more information, see Section 16.2.2, “Enabling Hyper-V enlightenments”.
- Configuring NetKVM driver parameters. For more information, see Section 16.2.3, “Configuring NetKVM driver parameters”.
16.2.1. Installing KVM paravirtualized drivers for Windows virtual machines
The primary method of improving the performance of your Windows virtual machines (VMs) is to install KVM paravirtualized (
virtio) drivers for Windows on the guest operating system (OS).
To do so:
- Prepare the install media on the host machine. For more information, see Section 126.96.36.199, “Preparing virtio driver installation media on a host machine”.
- Attach the install media to an existing Windows VM, or attach it when creating a new Windows VM.
virtiodrivers on the Windows guest OS. For more information, see Section 188.8.131.52, “Installing virtio drivers on a Windows guest”.
184.108.40.206. How Windows virtio drivers work
Paravirtualized drivers enhance the performance of virtual machines (VMs) by decreasing I/O latency and increasing throughput to almost bare-metal levels. Red Hat recommends that you use paravirtualized drivers for VMs that run I/O-heavy tasks and applications.
virtio drivers are KVM’s paravirtualized device drivers, available for Windows VMs running on KVM hosts. These drivers are provided by the
virtio-win package, which includes drivers for:
- Block (storage) devices
- Network interface controllers
- Video controllers
- Memory ballooning device
- Paravirtual serial port device
- Entropy source device
- Paravirtual panic device
- Input devices, such as mice, keyboards, or tablets
- A small set of emulated devices
For additional information about emulated,
virtio, and assigned devices, refer to Chapter 8, Managing virtual devices.
Using KVM virtio drivers, the following Microsoft Windows versions are expected to run similarly to physical systems:
- Windows Server versions: See Certified guest operating systems for Red Hat Enterprise Linux with KVM in the Red Hat Knowledgebase.
Windows Desktop (non-server) versions:
- Windows 7 (32-bit and 64-bit versions)
- Windows 8 (32-bit and 64-bit versions)
- Windows 8.1 (32-bit and 64-bit versions)
- Windows 10 (32-bit and 64-bit versions)
220.127.116.11. Preparing virtio driver installation media on a host machine
To install KVM virtio drivers on a Windows virtual machine (VM), you must first prepare the installation media for the virtio driver on the host machine. To do so, install the
virtio-win package on the host machine and use the
.iso file it provides as storage for the VM.
- Ensure that virtualization is enabled in your RHEL 8 host system.
Download the drivers
- Browse to Download Red Hat Enterprise Linux.
Product Variantrelevant for your system architecture. For example, for Intel 64 and AMD64, select Red Hat Enterprise Linux for x86_64.
Packages, search for virtio-win.
virtio-winpackage from the download directory. For example:
# yum install ~/Downloads/virtio-win-1.9.9-3.el8.noarch.rpm [...] Installed: virtio-win-1.9.9-3.el8.noarch
If the installation succeeds, the
virtio-windriver files are prepared in the
/usr/share/virtio-win/directory. These include
ISOfiles and a
driversdirectory with the driver files in directories, one for each architecture and supported Windows version.
# ls /usr/share/virtio-win/ drivers/ guest-agent/ virtio-win-1.9.9.iso virtio-win.iso
virtio-win.isofile as a disk when creating a new Windows VM, or add the file as a disk to an existing Windows VM.
virtio-win.isois attached as a disk to the Windows VM, you can proceed to installing the virtio driver on the Windows guest operating system. For instructions, see Section 18.104.22.168, “Installing virtio drivers on a Windows guest”.
22.214.171.124. Installing virtio drivers on a Windows guest
To install KVM
virtio drivers on a Windows guest operating system (OS), you must add a storage device that contains the drivers - either when creating the virtual machine (VM) or afterwards - and install the drivers in the Windows guest OS.
- The installation media for KVM drivers on a Windows virtual machine is prepared on the host machine. For more information, see Section 126.96.36.199, “Preparing virtio driver installation media on a host machine”.
A storage medium with the KVM
virtiodrivers must be attached to the Windows VM.
If you have not attached this medium when creating the VM , see Section 9.2.2, “Creating and assigning storage for virtual machines using the CLI” for instructions.
In the Windows guest OS, open the
Devices and drivespane, open the
Based on the architecture of the VM’s vCPU, run one of the installers on the medium.
If using a 32-bit vCPU, run the
If using a 64-bit vCPU, run the
- If using a 32-bit vCPU, run the
Virtio-win-guest-toolssetup wizard that opens, follow the displayed instructions until you reach the
- In the Custom Setup window, select the device drivers you want to install. The recommended driver set is selected automatically, and the descriptions of the drivers are displayed on the right of the list.
- Click , then click .
- After the installation completes, click .
- Reboot the VM to complete the driver installation.
This PC, open the system disk. This is typically
Program Filesdirectory, open the
Virtio-Windirectory is present and contains a sub-directory for each of the selected drivers, the installation was successful.
- You can use the Microsoft Windows Installer (MSI) command-line interface (CLI) instead of the graphical interface to install the drivers. For more information about MSI, see the Microsoft documentation.
- If you install the NetKVM driver, you may also need to configure the Windows guest’s networking parameters. For instructions, see Section 16.2.3, “Configuring NetKVM driver parameters”.
16.2.2. Enabling Hyper-V enlightenments
Hyper-V enlightenments provide a method for KVM to emulate the Microsoft Hyper-V hypervisor. This improves the performance of Windows virtual machines.
The following sections provide information about the supported Hyper-V enlightenments and how to enable them.
188.8.131.52. Enabling Hyper-V enlightenments on a Windows virtual machine
Hyper-V enlightenments provide better performance in a Windows virtual machine (VM) running in a RHEL 8 host. For instructions on how to enable them, see the following.
Edit the XML configuration of the VM, adding the Hyper-V enlightenments. In the following commands, replace $VMNAME with the name of the Windows VM.
# virt-xml $VMNAME --edit --features hyperv_relaxed=on,hyperv_vapic=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=8191,hyperv_vpindex=on,hyperv_runtime=on,hyperv_synic=on,hyperv_stimer=on,hyperv_frequencies=on # virt-xml $VMNAME --edit --clock hypervclock_present=yes
- Restart the VM
virsh dumpxmlcommand to display the XML configuration of the modified VM. If it includes the following segments, the Hyper-V enlightenments are enabled on the VM.
<hyperv> <relaxed state='on'/> <vapic state='on'/> <spinlocks state='on' retries='8191'/> <vpindex state='on'/> <runtime state='on' /> <synic state='on'/> <stimer state='on'/> <frequencies state='on'/> </hyperv> <clock offset='localtime'> <timer name='hypervclock' present='yes'/> </clock>
184.108.40.206. Supported Hyper-V enlightenments
The following is a list of Hyper-V enlightenments with a description of the functionality of each enlightenment:
- Defines the virtual time source and offset to use with the Windows virtual machine.
- Enables Hyper-V frequency Machine Specific Registers (MSRs).
Disables a Windows sanity check that commonly results in a BSOD when the VM is running on a heavily loaded host. This is similar to the Linux kernel option
no_timer_check, which is automatically enabled when Linux is running on KVM.
- Specifies the virtual processor’s run time.
- Used by a virtual machine’s operating system to notify the hypervisor that the calling virtual processor is attempting to acquire a resource that is potentially held by another virtual processor within the same partition.
- Used by the hypervisor to indicate to the virtual machine’s operating system the number of times a spinlock acquisition should be attempted before indicating an excessive spin situation to the hypervisor.
stimer, activates the synthetic timer. Windows 8 uses this feature in periodic mode.
- Provides accelerated MSR access to the high-usage, memory-mapped Advanced Programmable Interrupt Controller (APIC) registers.
- Specifies the virtual processor’s index.
16.2.3. Configuring NetKVM driver parameters
After the NetKVM driver is installed, you can configure it to better suit your environment. The parameters listed in this section can be configured using the Windows Device Manager (devmgmt.msc).
Modifying the driver’s parameters causes Windows to reload that driver. This interrupts existing network activity.
The NetKVM driver is installed on the virtual machine.
For more information, see Section 16.2.1, “Installing KVM paravirtualized drivers for Windows virtual machines”.
Open Windows Device Manager.
For information on opening Device Manager, refer to the Windows documentation.
Locate the Red Hat VirtIO Ethernet Adapter.
- In the Device Manager window, click + next to Network adapters.
- Under the list of network adapters, double-click Red Hat VirtIO Ethernet Adapter. The Properties window for the device opens.
View the device parameters.
In the Properties window, click the Advanced tab.
Modify the device parameters.
- Click the parameter you want to modify. Options for that parameter are displayed.
Modify the options as needed.
For information on the NetKVM parameter options, refer to Section 16.2.4, “NetKVM driver parameters”.
- Click OK to save the changes.
16.2.4. NetKVM driver parameters
The following table provides information on the configurable NetKVM driver logging parameters.
Table 16.1. Logging parameters
A Boolean value that determines whether logging is enabled. The default value is Enabled.
An integer that defines the logging level. As the integer increases, so does the verbosity of the log.
High logging levels will slow down your virtual machine.
The following table provides information on the configurable NetKVM driver initial parameters.
Table 16.2. Initial parameters
A string that defines the locally-administered MAC address for the paravirtualized NIC. This is not set by default.
An integer that represents the connection rate in megabits per second. The default value for Windows 2008 and later is 10G (10,000 megabits per second).
A Boolean value that enables Priority/VLAN tag population and removal support. The default value is Enabled.
An integer that defines the maximum transmission unit (MTU). The default value is 1500. Any value from 500 to 65500 is acceptable.
An integer that represents the number of TX ring descriptors that will be allocated.
The default value is 1024.
Valid values are: 16, 32, 64, 128, 256, 512, and 1024.
An integer that represents the number of RX ring descriptors that will be allocated.
The default value is 256.
Valid values are: 16, 32, 64, 128, 256, 512, and 1024.
Specifies the TX checksum offloading mode.
In Red Hat Enterprise Linux 8, the valid values for this parameter are:
* All (the default) which enables IP, TCP, and UDP checksum offloading for both IPv4 and IPv6
* TCP/UDP(v4,v6) which enables TCP and UDP checksum offloading for both IPv4 and IPv6
* TCP/UDP(v4) which enables TCP and UDP checksum offloading for IPv4 only
* TCP(v4) which enables only TCP checksum offloading for IPv4 only