Creating a Linux Virtual Machine in Red Hat Virtualization (RHV)
Installing Console Components on Client Systems
To install a virtual machine, you may need to access its “console”, the virtual version of its monitor, keyboard, and mouse, so that you can interact with the installation program. This requires some preparation of the client machine that you are using to access the Administration Portal. Virtual machines, depending on how they have been configured, may use either the SPICE or VNC protocol to manage remote connections.
Note: On workstation increase the screen resolution to 1920×1080. Different dialog windows displayed in this post require a higher resolution.
Red Hat Enterprise Linux Console Viewers
The Remote Viewer application is a native client for Linux that runs on your local system to allow you to connect to a remote virtual machine’s graphical console. It is provided by the virt-viewer package by the base Red Hat Enterprise Linux Server or Workstation repositories. It should be installed in conjunction with the spice-xpi package, which provides a SPICE plugin for your Firefox browser. That plugin allows Firefox to act as a browser-based console client using SPICE-HTML5 and noVNC.
Installing the spice-xpi package also installs virt-viewer as a dependency:
[[email protected] ~]# yum -y install spice-xpi
For the browser plugin to work, restart Firefox after installing the spice-xpi package.
Microsoft Windows Console Viewers
Versions of the Remote Viewer for Microsoft Windows are available from a web page on your Red Hat Virtualization Manager server, https://your-manager-fqdn/ovirt-engine/ rhev/client-resources.
That page has download links for 32-bit and 64-bit installers of the Virt Viewer application for Microsoft Windows. It also has installers for the UsbDk driver to allow USB redirection from your client to the remote virtual machine. Choose the correct version for your architecture and install all the required components.
Installing a new virtual server
To create a new virtual machine, log in to the Administration Portal and navigate to the Virtual Machines tab. In this tab, there is a New VM button. To provision a new server, click the New VM button. This brings up a New Virtual Machine dialog to define the basic parameters of the virtual machine. Here you can choose the data center and cluster in which you want to deploy the new virtual machine. You can also choose the Operating System, the type of instance you want to create (the amount of resources you want to allocate to that new virtual machine), as well as the type of environment optimization (Desktop or Server).
In the lower part of the dialog box, you can specify the virtual machine Name, ID and Description.
In the bottom part of the dialog are the final two settings you need to specify. Those two settings are very important. The first one, defines a new image in the Storage Domain for the new virtual machine. This is the primary hard drive for your virtual machine to use. The second setting creates a network device for the new virtual machine.
To create the new image, use the Create button to the right, under the Instance images line. In this new dialog, specify the Size of the image, the Alias, and the Description. At this stage of the course, all you need to do is to specify the size of the image in Gigabytes (GB). You can leave all the other options and their default values and accept everything by clicking OK. If you did not make any mistakes, you should see a new line under Instance Images line, displaying the details of your newly defined image.
The final setting you need to specify is the network interface access for your new virtual machine. In the lowest part of the dialog under the line Instantiate VM network by picking a vNIC profile., click the Please select an item list, next to the name of the first possible network card for your virtual machine called nic1. From the newly opened list of all available networks, choose the network you want that virtual machine to be part of. For example click on the ovirtmgmt network.
Once all the hardware for the new virtual machine is configured, it is time to install the operating system. Accept all the configured settings. Click the OK button to close the New Virtual Machine dialog and create the virtual machine.
Booting the virtual machine
Now that all the hardware for the new virtual machine is configured, it is time to install the operating system. If the virtual machine were started normally, it may try to boot from the (empty) hard drive, so boot it in a different way. Select the new virtual machine in the Virtual Machines, then right-click it, and select Run Once. This brings up the Run Virtual Machine(s) window, which allows pointing to an operating system installer, provided by the ISO domain.
Installing the Virtual Machine Using PXE
Virtual machines in Red Hat Virtualization have the ability to boot using PXE (Pre-eXecution Environment, a method of booting over the network. Network-based deployments, such automated Kickstart installations using a Red Hat Satellite Server with Cobbler, are also possible. To do so, simply make Network (PXE) the top priority in the Boot Sequence of a Run Once dialog, and follow the same procedure as for a bare-metal installation started from PXE.
Installing the Virtual Machine Using the ISO Domain
If a PXE-based deployment is not an option, or you prefer an ISO-based installation, you can use the library of ISO images in the ISO domain.
Note: To minimize the space needed for Red Hat Enterprise Linux installation images in the ISO domain, you can use the small boot.iso network boot image in conjunction with the Content Distribution Network or a Red Hat Satellite, instead of installing from full DVD images.
To install the virtual machine using an ISO image, right-click the newly defined virtual machine. From the list, choose Run Once. This opens a Run Virtual Machine(s) dialog, which lets you define various options regarding the way this virtual machine is to be booted. 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 is to boot this time. Because you used the Run Once option, the changes you make here are only used for this booting of the virtual machine.
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 booting 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, select the CD-ROM drive by clicking on its name in the Predefined Boot Sequence list. This chooses the virtual CD-ROM drive and activates the 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 the virtual machine that has been Run Once is shut down, any custom Run Once settings selected 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.
Connecting to the console of virtual machine
To connect to the console of a virtual machine, select the virtual machine name in the Virtual Machines tab of the Administration Portal and click the green Console button, or right-click the name of the virtual machine and choose Console from the menu.
Starting, stopping and suspending virtual machines
Starting Virtual Machines
To start a virtual machine currently in the Down state, navigate to the Virtual Machines tab of the Administration Portal and select the virtual machine to start. To start the virtual machine with its normal configuration, click the Run icon (green Play button) or right-click the virtual machine and select Run from the menu.
To start a virtual machine with settings other than the defaults, right-click the virtual machine, and select Run Once. This brings up the Run Virtual machine(s) dialog discussed in the previous section.
Shutting Down Virtual Machines
To shut down a virtual machine, there are three options:
- Shut down the virtual machine directly by using its own commands. For example, a Red Hat Enterprise Linux virtual machine can be shut down by logging into it and using the poweroff command.
- In the Administration Portal, on the list of available virtual machines, right-click the virtual machine name and select Shutdown from the pop-up menu. This sends a virtual ACPI power button event to the virtual machine. Note that in certain cases, the operating system running on the virtual machine may ignore this event (for example, when Microsoft Windows 7 is displaying a login screen).
- In the Administration Portal, in the list of available virtual machines, right-click on the virtual machine name and select Power Off from the pop-up menu. This effectively pulls the virtual power cables from the machine, resulting in an ungraceful crash. Use this method only as a last resort due to the risk of data loss for the virtual machine.
Note: Shutting down a virtual machine using Power Off immediately kills that machine as if power had failed, risking data loss or other issues.
Suspending and Resuming Virtual Machines
Virtual machines can also be suspended by selecting them in the Administration Portal and clicking the Suspend button with the crescent moon icon. A suspended virtual machine is put into Hibernate mode. Its memory and CPU state are saved to disk and the machine is suspended.
To resume a suspended virtual machine, right-click the virtual machine and select Run from the menu.
Remving Virtual Machines
To remove a virtual machine, first shut it down normally, then select it in the Virtual Machines tab of the Administration Portal. Right-click the virtual machine and select Remove from the menu. Click OK in the confirmation dialog box to confirm removing this virtual machine.
Note: When removing a virtual machine, all resources associated with the virtual machine are removed, as well. This includes all virtual disks and virtual network cards the machine had configured. Once a virtual disk is removed, both the disk and its contents are lost forever.