Bookmark this page

Chapter 8. Deploying and Managing Virtual Machines

Abstract

Goal Operate virtual machines in the Red Hat Virtualization environment.
Objectives
  • Install virtual machines that are optimized and configured for the Red Hat Virtualization environment.

  • Change configuration or virtual hardware of an existing virtual machine.

  • Create a template of a Red Hat Enterprise Linux virtual machine, and use it to deploy a new virtual machine.

  • Deploy a virtual machine using a template configured to use cloud-init.

Sections
  • Installing Virtual Machines (and Guided Exercise).

  • Editing Virtual Machine Hardware (and Guided Exercise).

  • Creating and Deploying Virtual Machines with Templates (and Guided Exercise).

  • Automating Virtual Machine Configuration (and Guided Exercise).

Lab

Deploying and Managing Virtual Machines.

Installing Virtual Machines

Objectives

After completing this section, you should be able to install virtual machines that are optimized and configured for the Red Hat Virtualization environment.

Describing 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 systems.

A list of supported guest operating systems for a 32-bit (x86) or 64-bit (x86-64) Red Hat Virtualization environment is available. This list may be updated from time to time; a current list can be found on the Red Hat Customer Portal at https://access.redhat.com/articles/973163/.

Operating SystemVersion
Red Hat Enterprise Linux3, 4, 5, 6, 7, 8*
Microsoft Windows Server2008, 2008 (R2), 2012, 2012 R2, 2016, 2019**
Microsoft Windows7, 8, 8.1, 10
SUSE Linux Enterprise Server10, 11, 12, 15

* Red Hat Enterprise Linux 8 is supported by Red Hat Virtualization 4.3 with the following limitations: SSO in gnome environments is not supported, only the qemu-guest-agent is supported, virt-sysprep (template sealing) and virt-sparsify are not supported, and v2v conversion of RHEL 8 is not supported.

** Microsoft Windows Server 2019 is only certified for compatibility with Red Hat Enterprise Linux 8.

Installing a New Virtual Machine

A new virtual machine can be installed using either the Administration Portal or the VM 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 hardware that meets the requirements of your new operating system, and create a new virtual disk for storage. 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 then install guest agents and drivers to extend the functionality.

Creating the Virtual Machine

The first step is to create a blank virtual machine. There are many ways to do this, but one method uses the Administration Portal. From Compute, select Virtual Machines and then click the New button. This opens the New Virtual Machine window.

When advanced options are not displayed, there are two tabs available. The General tab provides key configuration settings for your virtual machine. The Console tab provides settings that affect the console of your virtual machine (the virtualized physical monitor for the system).

On the General tab, Cluster is the name of the cluster in which the new virtual machine will be created. Since a cluster belongs to a data center, the virtual machine will belong to the same data center as the cluster.

The Template menu lists templates available in the selected data center and cluster. Templates enable the rapid creation of new virtual machines. If no templates are available, the Template menu defaults to Blank.

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 settings, including the number of CPUs and the amount of memory, for the new virtual machine. Instance types can be customized by clicking Administration in the menu bar, selecting Configure, and then clicking the Instance Types tab from the Configure window.

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

The Optimized for option affects some advanced settings for persistence and configuration. Select Server for most virtual machines.

The fields for Name, Description, and Comment are self-explanatory.

The Instance Images section is used to configure local storage for the virtual machine. Click the Create button to create a new disk. The New Virtual Disk window displays. In this window, you are presented with options to select a size, alias, and data domain for the disk. Two other options are particularly important:

  • Interface specifies the hardware interface for storage on the virtual machine. VirtIO-SCSI and VirtIO are faster, but require that you have paravirtualized guest drivers for the virtual machine operating system. Red Hat Enterprise Linux is installed with these drivers by default. IDE emulates a basic IDE interface, which is supported by most operating systems.

  • Allocation Policy specifies whether the whole disk is created immediately (Preallocated), or whether the size of the disk is increased as needed. A disk specified as Thin Provision only allocates 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, enable deduplication at that level, and then preallocate the virtual machine storage in Red Hat Virtualization.

    A recommended practice is to give your virtual machine a local boot disk managed by RHV that contains the operating system and application binaries. Any additional disks for application data are probably best managed externally and accessed directly by the virtual machine.

    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.

To configure the network interface, use the Instantiate VM network interfaces by picking a vNIC profile pane. 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. After configuring 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. For more information on all the options available, look in the appendix "Reference: Settings in Administration Portal and User Portal Windows" in the Virtual Machine Management Guide at https://access.redhat.com/documentation/.

Installing a Virtual Machine Using an ISO Image

To install a virtual machine using an ISO image, select the row containing the virtual machine, click the Run menu, and select Run Once. This opens a Run Virtual Machine(s) window, which lets you define boot options. For example, to boot a 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 window, where you can specify the way this virtual machine will boot. Changes made with the Run Once option are used only once.

To attach the installation ISO to the virtual CD-ROM drive of your virtual machine, select 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.

Figure 8.1: Run Virtual Machine(s) window

With the correct ISO file chosen and attached, specify the desired 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. These steps enable the virtual machine to start the installation process. Clicking the OK button will run the virtual machine with the specified settings.

Important

Remember that Run Once settings are used until the virtual machine is completely shut down. If the virtual machine is rebooted, it will continue to use the Run Once settings.

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 the key features of the guest agent is its ability to monitor the usage of resources and to gracefully shut down or reboot virtual machines, using the VM Portal or the Administration Portal.

It is a 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 that requires this functionality.

The table below describes the different guest drivers available for Red Hat Virtualization guests. Not all drivers are available for all supported operating systems.

DriverDescription
virtio-netParavirtualized network driver for enhancing performance of network interfaces.
virtio-blockParavirtualized HDD driver for increased I/O performance. Optimizes communication and coordination between the guest and hypervisor.
virtio-scsiParavirtualized iSCSI HDD driver provides support for adding hundreds of devices, and uses the standard SCSI device naming scheme.
virtio-serialProvides support for multiple serial ports to improve performance, for faster communication between the guest and host.
virtio-balloonControls the amount of memory a guest can actually access. Optimizes memory overcommitment.
qxlThis paravirtualized display driver reduces CPU usage on the host and provides better performance.

When a virtual machine is started by RHV-M, it uses the guest agent on the virtual machine to gather information, such as the IP address for the virtual machine. RHV-M 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 qemu-guest-agent service. This service is provided by the qemu-guest-agent package, and should be installed by default on a Red Hat Enterprise Linux system. If the package is not installed by default, it can always be installed later.

On Windows, install the RHV Agent as part of the RHEV-Tools installation. These are the available guest agents and tools:

NameDescription
ovirt-guest-agent-commonAllows Red Hat Virtualization Manager to execute specific commands, and to receive guest internal events or information.
spice-agentSupports multiple monitors, and reduces the bandwidth usage over wide area networks. It also enables cut and paste operations for text and images between the guest and client.
rhev-ssoDesktop agent that enables users to automatically log in to their virtual machines.

Installing the Guest Agents on Red Hat Enterprise Linux

On Red Hat Enterprise Linux virtual machines, the Red Hat Virtualization guest agents are installed using the qemu-guest-agent package. This package is installed by default, even in a minimal installation of Red Hat Enterprise Linux 7 or Red Hat Enterprise Linux 8. Virtualization drivers are also installed by default in RHEL.

After the virtual machine is installed, use the subscription-manager command to register the system, grant it entitlements by attaching it to a subscription, and enable the desired repositories. Use either the yum command or the rpm command to verify the qemu-guest-agent package is installed, and install it if necessary. Once the qemu-guest-agent package is installed, use the systemctl command to start and enable the qemu-guest-agent service.

Red Hat Virtualization Manager will start receiving additional usage information from the guest agent running on the virtual machine. You can check this by logging into the Administration Portal, clicking Compute, and then selecting Virtual Machines. After a few minutes, the main virtual machines page should display the IP addresses and FQDN for the virtual machine. Additional information collected by the agent can be seen by clicking on the name of the virtual machine, and then exploring tabs such as General, Network Interfaces, and Guest Info.

Note

In the past, both the ovirt-guest-agent-common package and the qemu-guest-agent package were required on a Red Hat Enterprise Linux virtual machine. This is no longer the case.

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 rhv-tools-setup.iso ISO file. The ISO is available in the rhv-tools-setup-iso package provided by the rhel-7-server-rhv-4.3-manager-rpms repository.

Once the rhv-tools-setup-iso package is installed, the rhv-tools-setup.iso file can be uploaded to a data storage domain from the /usr/share/rhv-guest-tools-iso/ directory. New versions of the rhv-tools-setup.iso file must be manually attached to Windows virtual machines to update the tools and drivers.

The rhv-tools-setup.iso file can be attached to a Windows virtual machine by following the same basic procedure used to install a Red Hat Enterprise Linux guest from an ISO file. However, the Windows virtual machine should already be installed. In addition, after you attach the rhv-tools-setup.iso ISO in the CD drive, you will not adjust the predefined boot sequence. The Windows virtual machine should boot from its hard drive, rather than attempting to boot from the CD drive.

After logging in to the Windows virtual machine, the rhv-tools-setup.iso ISO will be accessible from the CD-ROM drive. Running the RHEV-toolsSetup file launches the RHEV-Tools InstallShield Wizard window. Decide which components should be installed, and then start the installation. When the installation completes, restart the virtual machine in order to 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 is an exact copy of the disk image from 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, start by selecting the virtual machine that you wish to clone. Since a clone can only be made when a virtual machine is in a stopped state, shut down the virtual machine if it is running. With the row containing the virtual machine highlighted, select the Clone VM menu entry from the three vertical dot menu displayed to the right of the Create Snapshot button.

After providing a name for the clone, the process to create the clone begins. While the clone is being created, the disk images for both the original virtual machine and the clone will be in a locked state. You will not be able to start either the original virtual machine or the clone until the status of the disk images changes to OK. Once the clone is complete, and the status of the images updates, both of the virtual machines are ready to run.

Be aware that attempting to run both the original virtual machine and the cloned virtual machine at the same time may cause problems. Remember, a cloned virtual machine starts with all of the data from the original virtual machine, including logs, SSH keys, and other unique information. This may not be desirable if you are trying to create a new virtual machine with a similar configuration, rather than an exact copy.

As an alternative, use the virtual machine to create a sealed template that has been cleared of unique data, and then create virtual machines from that template. Creating and using templates is covered later in this chapter.

References

Certified Guest Operating Systems in Red Hat OpenStack Platform and Red Hat Enterprise Virtualization

More information is available in the "Installing Red Hat Enterprise Linux Virtual Machines" chapter in the Virtual Machine Management Guide for Red Hat Virtualization at https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html-single/virtual_machine_management_guide/index#Installing_Red_Hat_Enterprise_Linux_Virtual_Machines

Additional information is available in the "Installing Windows Virtual Machines" chapter in the Virtual Machine Management Guide for Red Hat Virtualization at https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html-single/virtual_machine_management_guide/index#chap-Installing_Windows_Virtual_Machines

Detailed information on New Virtual Machine window settings are documented in the "Reference: Settings in Administration Portal and VM Portal Windows" appendix to the Virtual Machine Management Guide for Red Hat Virtualization at https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html-single/virtual_machine_management_guide/index#appe-Reference_Settings_in_Administration_Portal_and_User_Portal_Windows

Revision: rh318-4.3-c05018e