How to install virtual machines optimized and configured for the Red Hat Virtualization environment
Installing virtual machines
Red Hat Virtualization allows you to create virtual machines (guests) running different operating systems. Various Red Hat and third-party operating systems are certified and supported as guest operating system.
Here is a list of supported guest operating systems in a 32-bit (x86) based, or 64-bit (x86-64) Red Hat Virtualization environment. This list may be updated from time to time, and a current list can be found on the Red Hat Customer Portal at https://access.redhat.com/articles/973163/.
|Red Hat Enterprise Linux||3, 4, 5, 6, 7|
|Microsoft Windows Server||2008, 2008 (R2), 2012, 2012 R2, 2016|
|Microsoft Windows||7, 8, 8.1, 10|
|SUSE Linux Enterprise Server||10, 11, 12|
Installing a new virtual machine
A new virtual machine can be installed using either the Administration Portal or the User Portal. This is a basic outline of the steps required to install a new virtual machine:
- Create a blank virtual machine for the new operating system, choose the required hardware for the requirements of your new operating system and create a new virtual disk for storage, and create one or more network interfaces to connect the virtual machine to the required logical networks.
- Boot the virtual machine from the installation CD and install the operating system.
- Start the virtual machine and install guest agents and drivers to extend the virtual machine’s functionality.
Creating the virtual machine
The first step of the process is to create the blank virtual machine. There are many ways to do this, but one is to log in to the Administration Portal, switch to the Virtual Machines tab, and click New VM. This opens the New Virtual Machine window.
When not showing advanced options, there are two tabs available. General provides key configuration settings for your virtual machine. Console provides settings which affect the console of your virtual machine (the virtualized “physical” monitor for the system).
You saw the options on the General tab in Chapter 2, Installing and Configuring Red Hat Virtualization . For example, Cluster is the name of the cluster in which the new virtual machine will be created, and Name, Description, and Comment are self-explanatory.
Operating System configures the virtual machine with virtualized devices that are likely to be supported by a particular operating system.
Instance Type configures the default hardware configuration, including number of CPUs and amount of memory, for the new virtual machine. You can customize this in Configure → Instance Types in the upper-right corner of the Administration Portal interface.
The five default instance types are:
- Tiny: 1 vCPU, 512 MB RAM
- Small: 1 vCPU, 2048 MB RAM
- Medium: 2 vCPUs, 4096 MB RAM
- Large: 2 vCPUs, 8192 MB RAM
- XLarge: 4 vCPUs, 16384 MB RAM
Optimized for affects some advanced settings for persistence and configuration. You should select Server for most virtual machines.
Instance Images is used to configure your virtual machine’s local storage. Press Create to create a new disk. This opens the New Virtual Disk window. In that window, you are presented with options to select a size, alias, and data domain for the disk. Two other options that are particularly important:
– Interface specifies the hardware interface for the virtual machine’s storage. VirtIO-SCSI and VirtIO are faster but require that you have paravirtualized guest drivers for your virtual machine’s operating system. Red Hat Enterprise Linux is installed with these drivers by default. IDE emulates a basic IDE interface supported by most operating systems.
– Allocation Policy specifies whether the whole disk is immediately Preallocated, or to Thin Provision the storage, allocating only what the virtual machine requires.
Thin Provision is generally faster for deployment, backup, replication, and recovery. However,as storage grows, the underlying storage needs to be allocated on the fly, resulting in wait time and lower performance. Preallocated is faster from a performance standpoint, but takes up more space.
If the storage array backing your data domain supports deduplication, you can configure the hardware storage array to thin provision and enable deduplication at that level, and preallocate the virtual machine storage in Red Hat Virtualization.
The advantage of this method is that virtual machines can be managed and backed up separately from application data. A virtual machine can be rebuilt quickly from a snapshot or template, and then the application data can be remounted from the SAN or NAS. Performance may also be better for the application by not having the Red Hat Virtualization host translate storage traffic for the virtual machine.
Instantiate VM network interfaces by picking a vNIC profile configures network interfaces. One network interface (nic1) is defined by default, and the drop-down menu next to it may be used to attach the interface to a virtual machine logical network. Once you have configured one vNIC, you can click the + button to add additional network interfaces to the virtual machine.
The Show Advanced Options button causes the New Virtual Machine window to display a number of advanced options. These can be used to customize vCPU and memory configuration, adjust the boot order, or enable advanced features.
Instaling the virtual machine using ISO domain
To install the virtual machine using an ISO image, right-click the newly defined virtual machine. From this list, choose Run Once. This opens a Run Virtual Machine(s) dialog, which lets you define boot options. For example, to boot your virtual machine from the available ISO using the ISO library, click the + button next to the Boot Options label. This opens a new section of the dialog, where you can specify the way this virtual machine boots. Because you used the Run Once option, changes you make here are used only once.
To attach the installation ISO to the virtual CD-ROM drive of your virtual machine, click the check box next to the Attach CD label. This activates the virtual CD-ROM drive for this boot and lets you choose the appropriate ISO file from a list of all available ISOs in your library.
With the correct ISO file chosen and attached, specify the correct boot order for the virtual machine. In this example, highlight the CD-ROM drive by clicking on its name in the Predefined Boot Sequence list. This chooses the virtual CD-ROM drive and activates two additional buttons: Up and Down. Because you want to boot from the ISO file mounted in your virtual CD-ROM drive, use the Up button to bring the CD-ROM to the top of the Predefined Boot Sequence list. That is everything you need for the virtual machine to start the installation process. Accept everything by clicking on the OK button.
NOTE:If a Run Once installation is rebooted without shutting down the virtual machine, the BIOS settings is retained and the virtual machine boots from the CD-ROM again. Once a virtual machine that has been Run Once is shut down, any custom Run Once settings are no longer used. At that point, the virtual machine can be started using Run from the Administration Portal interface, and the virtual machine’s default boot settings are used.
Manual installation of guest drivers and agents
Guest drivers and agents are tools that are installed in a guest operating system to improve management and performance of virtual machines. A guest driver provides a paravirtualized device driver that uses interfaces presented by the hypervisor rather than standard device drivers to improve performance. A guest agent typically provides information about the guest and notifications about its status from the guest operating system to the Red Hat Virtualization environment. One of guest agent key features is the ability to monitor the usage of resources and to gracefully shut down or reboot virtual machines using the User Portal or Administration Portal.
It is good practice to install Red Hat Virtualization guest agents and drivers for Red Hat Enterprise Linux and Microsoft Windows virtual machines. Guest agents and drivers need to be installed on each virtual machine for which this functionality needs to be available.
The table below describes the different guest drivers available for Red Hat Virtualization guests. Not all drivers are available for all supported operating systems.
|virtio-net||Paravirtualized network driver for enhancing performance of network interfaces.|
|virtio-block||Paravirtualized HDD driver for increased I/O performance. Optimizes communication and coordination between the guest and hypervisor.|
|virtio-scsi||Paravirtualized iSCSI HDD driver provides support for adding hundreds of devices, and uses the standard SCSI device naming scheme.|
|virtio-serial||Provides support for multiple serial ports to improve performance for faster communication between the guest and host.|
|virtio-balloon||Controls the amount of memory a guest actually accesses. Optimizes memory over-commitment.|
|qxl||This paravirtualized display driver reduces CPU usage on the host and provides better performance.|
When a virtual machine is started by RHVM, it uses the guest agent on the virtual machine to gather information such as the virtual machine’s IP address. RHVM also tries to use the guest agent to communicate with the virtual machine to shut it down gracefully.
On Red Hat Enterprise Linux, this communication is done by the ovirt-guest-agent and qemu-guest-agent services. If installing a Red Hat Enterprise Linux virtual machine in RHV, make sure to include the ovirt-guest-agent-common package.
On Windows, install the RHV Agent as part of the RHEV-Tools installation. These are the available guest agents and tools:
|ovirt-guest-agent-common||Allows Red Hat Virtualization Manager to execute specific commands, and to receive guest internal events or information.|
|spice-agent||Supports multiple monitors, reduces the bandwidth usage over wide area network. It also enables cut and paste operations for text and images between guest and client.|
|rhev-sso||Desktop agent that enables users to automatically log in to their virtual machines.|
Installing the Guest Agents and Drivers on Red Hat Enterprise Linux
On Red Hat Enterprise Linux virtual machines, the Red Hat Virtualization guest agents and drivers are installed using the ovirt-guest-agent-common package.
Here is the procedure for installing the guest agents and drivers on Red Hat Enterprise Linux 7:
1. Log in to the virtual machine.
2. Ensure that your virtual machine is registered with subscription-manager and has been attached to the correct entitlement (typically, a pool ID for “Red Hat Enterprise Linux with Smart Virtualization”).
[[email protected] ~]# subscription-manager attach ...output omitted... [[email protected] ~]# subscription-manager list --available ...output omitted... [[email protected] ~]# subscription-manager attach --pool=pool-id-for-entitlement
3. Enable the repository containing the Red Hat Virtualization Agent:
[[email protected] ~]# subscription-manager repos --enable=rhel-7-server-rh-common-rpms
4. Install the ovirt-guest-agent-common package:
[[email protected] ~]# yum install ovirt-guest-agent-common
5. Start and enable the ovirt-guest-agent service:
[[email protected] ~]# systemctl start ovirt-guest-agent [[email protected] ~]# systemctl enable ovirt-guest-agent
6. Start and enable the QEMU guest agent:
[[email protected] ~]# systemctl start qemu-guest-agent [[email protected] ~]# systemctl enable qemu-guest-agent
Red Hat Virtualization Manager receives now additional usage information from the guest agent running in the virtual machine. You can check this by logging into the Administration Portal, selecting the virtual machine from the Virtual Machines tab, and selecting the Guest Info tab from the lower pane of the interface.
Installing Guest Agents and Drivers on Windows
One of the best ways to improve the performance of Microsoft Windows guests is to use paravirtualized devices and drivers for KVM in the guests. This provides close to bare-metal performance (up to 95%).
On Windows virtual machines, the Red Hat Virtualization guest agents and drivers are installed using the rhev-tools-setup.iso ISO file. The ISO is installed as a dependency on the Red Hat Virtualization Manager and is located in /usr/share/rhev-guest-tools-iso/ directory.
The rhev-tools-setup.iso can be automatically copied to the default ISO storage domain during RHVM installation, or can be uploaded manually. New versions of the rhev-toolssetup.iso ISO file must be manually attached to Windows virtual machines to update the tools and drivers. Here is the procedure for installing the guest agents and drivers on Windows:
- Log in to the virtual machine.
- Select the CD-ROM drive with the attached rhev-tools-setup.iso ISO file.
- Double-click RHEV-toolsSetup.
- In the next screen, click Next.
- Follow the prompts of the RHEV-Tools InstallShield Wizard window. Select all boxes in the list of components.
- When the installation is complete, select Yes, I want to restart my computer now and click Finish to restart the virtual machine and apply the changes
Cloning a virtual machine
Another way to create a virtual machine is to clone an existing one. A clone is a copy of a virtual machine created on new virtual hardware. The clone gets an exact copy of the disk image for the original virtual machine, which includes configuration settings, logs, and other data on that image.
To clone a virtual machine from an existing virtual machine:
- In the Administration Portal, switch to the Virtual Machines tab. Select your virtual machine from the list.
- Shut down the virtual machine if it is running, either by clicking the red downward-pointing icon, or by right-clicking on the virtual machine and selecting Shutdown from the menu.
- Click the Clone VM item or right-click the virtual machine and select Clone VM from the menu.
- This opens a new window, Clone Virtual Machine. Set a Name for your cloned virtual machine and click OK to create it.
- It may take a few minutes to create the cloned virtual machine’s disk image. During this time, the disk images for both the original virtual machine and the new clone will be Locked. You can check this by clicking on the virtual machine under the Virtual Machines resource tab, and selecting its Disks subtab at the bottom of the web interface. Look at the Status of the virtual machine’s disk images. You will not be able to start either virtual machine until their disk images change status to OK.
- Once the status of the virtual machines’ disk images switch to OK, you may Run either or both virtual machines normally.
NOTE: A cloned virtual machine has data from its source image, including logs, SSH keys, and other unique information. You might not want this if you’re trying to create a new virtual machine with a similar configuration rather than an exact copy. As an alternative, you can use the virtual machine to create a sealed template that has been cleared of unique data, and then create virtual machines from that template. A template can be created from a virtual machine by using the Make Template item instead of Clone VM. Some preliminary steps may also need to be taken to sanitize the data on the template.