Chapter 4. Managing Virtual Machines

4.1. Creating Virtual Machines

4.1.1. Create Virtual Machines Introduction

The final stage of setting up Red Hat Enterprise Virtualization is the virtual machine lifecycle - spanning the creation, deployment and maintenance of virtual machines; using templates; and configuring user permissions. This chapter will also show you how to log in to the user portal and connect to virtual machines.
Create Virtual Machines

Figure 4.1. Create Virtual Machines

On Red Hat Enterprise Virtualization, you can create virtual machines from an existing template, as a clone, or from scratch. Once created, virtual machines can be booted using ISO images, a network boot (PXE) server, or a hard disk. This document provides instructions for creating a virtual machine using an ISO image.

4.1.2. Create a Red Hat Enterprise Linux Virtual Machine

In your current configuration, you will have at least one host available for running virtual machines, and have uploaded the required installation images to your ISO domain. This section guides you through the creation of a Red Hat Enterprise Linux 6 virtual machine. You will perform a normal attended installation using a virtual DVD.

Procedure 4.1. Creating a Red Hat Enterprise Linux Virtual Machine

  1. Navigate to the Tree pane and click Expand All. Click the VMs icon under the default cluster. On the Virtual Machines tab, click New VM.
    The New Virtual Machine window

    Figure 4.2. The New Virtual Machine window

    In the General tab, fill in the Name field, select Red Hat Enterprise Linux 6.x as your Operating System, and select a network interface card from the drop-down list at the bottom of the window. Also ensure that Optimized for is set to Server. You can alter other settings, but in this example, retain the defaults. Click OK to create the virtual machine.
  2. The New Virtual Machine - Guide Me window opens. This allows you to add virtual disks to the virtual machine.
    The New Virtual Machine - Guide Me window

    Figure 4.3. The New Virtual Machine - Guide Me window

  3. Click Configure Virtual Disks to add storage to the virtual machine. The parameters in the following figure are recommended, but can be edited as necessary. When you have configured your required settings, click OK.
    The New Virtual Disk window

    Figure 4.4. The New Virtual Disk window

  4. Click Configure Later to close the New Virtual Machine - Guide Me window. The new Red Hat Enterprise Linux 6 virtual machine will display in the Virtual Machines tab.
You have now created your first Red Hat Enterprise Linux virtual machine. Before you can use your virtual machine, you must install an operating system on it.

Procedure 4.2. Installing a Red Hat Enterprise Linux Guest Operating System

  1. Right-click the virtual machine and select Run Once. Configure the following options:
    The Run Virtual Machine(s) window

    Figure 4.5. The Run Virtual Machine(s) window

    • Attach CD: Red Hat Enterprise Linux 6
    • Boot Sequence: CD-ROM
    • Display Protocol: SPICE
    Retain the default settings for the other options and click OK to start the virtual machine.
  2. Select the virtual machine and click the Console ( ) icon. Because this is your first time connecting to the virtual machine, allow the installation of the Spice Active X and the SPICE client.
  3. After the SPICE plug-ins have been installed, select the virtual machine and click the Console icon again. This displays a window to the virtual machine, where you will be prompted to begin installing the operating system. For further instructions, see the Red Hat Enterprise Linux Installation Guide.
  4. After the installation has completed, shut down the virtual machine and reboot from the hard drive.
You can now connect to your Red Hat Enterprise Linux virtual machine and start using it.

4.1.3. Create a Windows Virtual Machine

You now know how to create a Red Hat Enterprise Linux virtual machine from scratch. The procedure of creating a Windows virtual machine is similar, except that it requires additional virtio drivers. This example uses Windows 7, but you can also use other Windows operating systems. You will perform a normal attended installation using a virtual DVD.

Procedure 4.3. Creating a Windows Virtual Machine

  1. Navigate to the Tree pane and click Expand All. Click the VMs icon under the Default cluster. On the Virtual Machines tab, click New VM.
    Create New Windows Virtual Machine

    Figure 4.6. Create New Windows Virtual Machine

    You only need to fill in the Name field and select Windows 7 as your Operating System. You can alter other settings but in this example we will retain the defaults. Click OK to create the virtual machine.
  2. A New Virtual Machine - Guide Me window opens. This allows you to define networks for the virtual machine. Click Configure Network Interfaces.
  3. You are returned to the Guide Me window. This time, click Configure Virtual Disks to add storage to the virtual machine.
  4. Close the Guide Me windows. Your new Windows 7 virtual machine will display in the Virtual Machines tab.

Procedure 4.4. Installing a Windows Guest Operating System

  1. Right click the virtual machine and select Run Once. The Run Once dialog displays. Configure the following options:
    • Attach Floppy: virtio-win
    • Attach CD: Windows 7
    • Boot sequence: CD-ROM
    • Display protocol: SPICE
    Retain the default settings for the other options and click OK to start the virtual machine.
  2. Select the virtual machine and click the Console ( ) icon. This displays a window to the virtual machine, where you will be prompted to begin installing the operating system.
  3. Accept the default settings and enter the required information as necessary. The only change you must make is to manually install the VirtIO drivers from the virtual floppy disk (vfd) image. To do so, select the Custom (advanced) installation option and click Load Driver. Press Ctrl and select:
    • Red Hat VirtIO Ethernet Adapter
    • Red Hat VirtIO SCSI Controller
    The installation process commences, and the system will reboot itself several times.
  4. Install RHEV-ISO tools:
    1. Power down the virtual machine.
    2. Click the Run Once button.
    3. Select the Boot Options tab.
    4. Select the Attach CD check box.
    5. Select the RHEVtools-Setup ISO file from the drop-down menu to the right of the Attach CD check box.
    6. Start the virtual machine and install the tools using the installation program on the CD.
    7. After the tools have been installed, you will be prompted to restart the machine for changes to be applied. Restart the machine.
You can now connect to your Windows virtual machine and start using it.