Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 8. Provisioning Virtual Machines in Red Hat Virtualization

Red Hat Virtualization (version 4.0 and later) or Red Hat Enterprise Virtualization (version 3.6 and earlier) is an enterprise-grade server and desktop virtualization platform built on Red Hat Enterprise Linux. Red Hat Satellite 6 can mange virtualization functions through Red Hat Virtualization’s REST API version 3; REST API version 4 is not yet supported by Satellite 6. This include creating new virtual machines and controlling their power states. In this chapter, the aim is to add a connection to ACME’s Red Hat Virtualization environment and provision a virtual machine.

8.1. Defining Requirements for Red Hat Virtualization Provisioning

The requirements for Red Hat Virtualization provisioning include:

  • Synchronized content repositories for Red Hat Enterprise Linux 7. See Synchronizing Red Hat Repositories in the Content Management Guide for more information.
  • A Capsule Server managing a logical network on the Red Hat Virtualization environment. Ensure no other DHCP services run on this network to avoid conflicts with the Capsule Server. See Chapter 4, Configuring Networking for more information.
  • An existing template, other than the blank template, if you aim to use image-based provisioning. See Templates in the Virtual Machine Management Guide for information on creating templates for virtual machines.
  • An example activation key for host registration. See Section 3.8, “Creating an Activation Key” for more information.

8.2. Creating a Red Hat Virtualization User

The Red Hat Virtualization server requires an administration-like user for Satellite Server communication. For security reasons, Red Hat advises against using the admin@internal user for such communication. Instead, create a new Red Hat Virtualization user with the following permissions:

  • System

    • Configure System

      • Login Permissions
  • Network

    • Configure vNIC Profile

      • Create
      • Edit Properties
      • Delete
      • Assign vNIC Profile to VM
      • Assign vNIC Profile to Template
  • Template

    • Provisioning Operations

      • Import/Export
  • VM

    • Provisioning Operations

      • Create
      • Delete
      • Import/Export
      • Edit Storage
  • Disk

    • Provisioning Operations

      • Create
    • Disk Profile

      • Attach Disk Profile

For information on how to create a new user and add permissions in Red Hat Virtualization, see Administering User Tasks From the Administration Portal in the Red Hat Virtualization Administration Guide.

8.3. Adding a Red Hat Virtualization Connection to the Satellite Server

This process adds a Red Hat Virtualization connection in the Satellite Server’s compute resources.

For Web UI Users

Navigate to Infrastructure > Compute resource and click Create Compute Resource. The UI provides a set of fields for the compute resource:

  • Name - A plain text name for the resource. For example, ACME's RHV.
  • Provider - A field for selecting the compute resource provider. Select RHEV and a new set of fields appear.
  • Description - A plain text description for the resource. For example, RHV-M server at rhvm.example.com.
  • URL - The connection URL to the Red Hat Virtualization Manager’s API. For example, in RHEV 3.6 and earlier, this URL is of the form https://rhvm.example.com/api. In RHV 4.0 and later, this URL is of the form https://rhvm.example.com/ovirt-engine/api/v3 .
  • Username - The user with permission to access the Red Hat Virtualization Manager’s resources. For example, satellite@internal.
  • Password - The password for the chosen user.
  • Datacenter - Once the URL, Username, and Password are entered, click Load Datacenters to populate the list of data centers from your Red Hat Virtualization environment. Select a specific data center to manage from this list.
  • Quota ID - Select a quota to limit resources available to the Satellite Server.
  • X509 Certification Authorities - The certificate authority for SSL/TLS access.

The Locations and Organizations tabs are automatically set to your current context. Add additional contexts to these tabs.

Click Submit to save the connection.

For CLI Users

Create the connection with the hammer compute-resource create command. Select Ovirt as the --provider and set the UUID of the data center to use as --uuid:

# hammer compute-resource create --name "ACME's RHV" \
--provider "Ovirt" --description "RHV-M server at rhvm.example.com" \
--url "https://rhvm.example.com/api" --user "satellite@internal" \
--password "p@55w0rd!" --locations "New York" --organizations "ACME" \
--uuid 72cb9454-81cd-4231-a863-d9baf0f399f8
Note

In versions of RHV less than 4.0, this URL is of the form https://rhvm.example.com/api. In versions of RHV 4.0 and higher, this URL is of the form https://rhvm.example.com/ovirt-engine/api/v3 .

8.4. Adding Red Hat Virtualization Images on the Satellite Server

Red Hat Virtualization uses templates as images for creating new virtual machines. If using image-based provisioning to create new hosts, you need to add Red Hat Virtualization template details to your Satellite Server. This includes access details and the template name.

For Web UI Users

Navigate to Infrastructure > Compute resource and click the name of your Red Hat Virtualization connection. The UI displays information about the connection, including an Images tab. This tab contains no images for new providers but you can add new ones. Click New Image and the UI provides a set of fields for the Red Hat Virtualization template:

  • Name - A plain text name for the image. For example, Test RHV Image.
  • Operatingsystem - A field for selecting the image’s base operating system. For example, RedHat 7.2.
  • Architecture - A field for selecting the operating system architecture. For example, x86_64.
  • Username - The SSH user name for image access. This is normally the root user.
  • Password - The SSH password for image access.
  • Image - The name of the image on Red Hat Virtualization. Select the image name from the list.

Click Submit to save the image details.

For CLI Users

Create the image with the hammer compute-resource image create command. Use the --uuid field to store the template UUID on the Red Hat Virtualization server.

# hammer compute-resource image create --name "Test RHV Image" \
--operatingsystem "RedHat 7.2" --architecture "x86_64" --username root \
--uuid "9788910c-4030-4ae0-bad7-603375dd72b1" \
--compute-resource "ACME's RHV"

8.5. Adding Red Hat Virtualization Details to a Compute Profile

You can predefine certain hardware settings for virtual machines on Red Hat Virtualization. You achieve this through adding these hardware settings to a compute profile. For this example, the aim is to include some basic hardware settings to the 4-Example profile.

For Web UI Users

Navigate to Infrastructure > Compute profiles and click the name of your profile. For example, use the 4-Example profile you previously created. The UI displays a list of your compute resources. Click on the Red Hat Virtualization connection.

The UI provides a set of fields where you can input Red Hat Virtualization-specific details for the profile. This includes:

  • Cluster - The target host cluster in the Red Hat Virtualization environment.
  • Template - The RHV template to use for the Cores and Memory settings.
  • Cores - The number of CPU cores to allocate to the new host.
  • Memory - The amount of memory to allocate to the new host.
  • Image - The image to use if performing image-based provisioning. For this example, use the Test RHV Image.
  • Network Interfaces - The network parameters for the host’s network interface. You can create multiple network interfaces. However, at least one interface should point to a Capsule-managed network. The network interface options include:

    • Name - The name of the network interface.
    • Network - The logical network to use.
  • Storage - The volumes for the host. You can create multiple volumes for the host. The storage options include:

    • Size (GB) - The size of volume in GB.
    • Storage domain - The storage domain for the volume.
    • Preallocate disk - To set thin provisioning or preallocation of the full disk.
    • Bootable - Defines the boot volume.

Click Submit to save the compute profile.

For CLI Users

The compute profile CLI commands are not yet implemented in Red Hat Satellite 6.3. As an alternative, you can include the same settings directly during the host creation process.

8.6. Creating Network-Based Hosts on a Red Hat Virtualization Server

The Red Hat Virtualization provisioning process provides the option to create new hosts over a network connection. This requires the new host to access either the Satellite Server’s integrated Capsule or an external Capsule Server on a Red Hat Virtualization virtual network. This is so the host has access to PXE provisioning services.

Important

If using a virtual network on the Red Hat Virtualization server for provisioning, make sure to select one that does not provide DHCP assignments. This causes DHCP conflicts with the Satellite Server when booting new hosts.

For Web UI Users

Navigate to Hosts > New host. The UI provides a set of fields where you can input details for the host.

  • In the Host tab:

    • Enter the Name of the Host. This becomes the provisioned system’s host name. For this example, enter rhv-test1.
    • The provisioning context (Organization and Location) should automatically set to the current context. For example: ACME and New York.
    • Select Base from the Host Group field. This should automatically populate most of the new host’s fields.
    • In Deploy on, select the Red Hat Virtualization connection. For our example, ACME's RHV. A new tab for virtual machines appears.
    • In Compute profile, select a profile to use to automatically populate virtual machine-based settings. For our example: 4-Example.
  • In the Interface tab:

    • Click Edit on the host’s interface.
    • Most of the fields should automatically contain values. Note in particular:

      • The Name from the Host tab becomes the DNS name.
      • The Satellite Server automatically assigns an IP address for the new host.
    • Leave the MAC address blank. The server assigns one to the host.
    • The Satellite Server should automatically select the Managed, Primary, and Provision options for the first interface on the host. If not, select them.
    • The interface screen shows the Red Hat Virtualization-specific fields populated with settings from our compute profile. Modify these settings to suit your needs.
  • In the Operating System tab:

    • All fields should automatically contain values. Confirm each aspect of the operating system.
    • Make sure the Provisioning Method is set to Network Based
    • Click Resolve in Provisioning templates to check the new host can identify the right provisioning templates to use.
  • In the Virtual Machine tab:

    • These settings should be populated with details from the chosen host group and compute profile. Modify these settings to suit your needs.
  • In the Parameters tab:

    • Confirm the kt_activation_keys parameter exists and is using the example activation key.

Click Submit.

For CLI Users

Create the host with the hammer host create command and include --provision-method build to use network-based provisioning. For example:

# hammer host create --name "rhv-test1" --organization "ACME" \
--location "New York" --hostgroup "Base" \
--compute-resource "ACME's RHV" --provision-method build \
--build true --enabled true --managed true \
--interface "managed=true,primary=true,provision=true,compute_name=eth0,compute_network=satnetwork" \
--compute-attributes="cluster=Default,cores=1,memory=1073741824,start=true" \
--volume="size_gb=20G,storage_domain=Data,bootable=true"
Note

See Appendix B, Additional Host Parameters for Hammer CLI for more information on additional host creation parameters for this compute resource.

This new host entry triggers the Red Hat Virtualization server to create the virtual machine. If the virtual machine detects the defined Capsule Server through the virtual network, the virtual machine boots to PXE and begins to install the chosen operating system.

8.7. Creating Image-Based Hosts on a Red Hat Virtualization Server

The Red Hat Virtualization provisioning process also provides the option to create new hosts from existing images on the Red Hat Virtualization server.

For Web UI Users

Navigate to Hosts > New host. The UI provides a set of fields where you can input details for the host.

  • In the Host tab:

    • Enter the Name of the Host. This becomes the provisioned system’s host name. For this example, enter rhv-test2.
    • The provisioning context (Organization and Location) should automatically set to the current context. For example: ACME and New York.
    • Select Base from the Host Group field. This should automatically populate most of the new host’s fields.
    • In Deploy on, select the Red Hat Virtualization connection. For our example, ACME's RHV. A new tab for virtual machines appears.
    • In Compute profile, select a profile to use to automatically populate virtual machine-based settings. For our example: 4-Example.
  • In the Interface tab:

    • Click Edit on the host’s interface.
    • Most of the fields should automatically contain values. Note in particular:

      • The Name from the Host tab becomes the DNS name.
      • The Satellite Server automatically assigns an IP address for the new host.
    • Leave the MAC address blank. The Red Hat Virtualization server assigns one to the host.
    • The Satellite Server should automatically select the Managed, Primary, and Provision options for this host. If not, select them.
    • The interface screen shows the Red Hat Virtualization-specific fields populated with settings from our compute profile. Modify these settings to suit your needs.
  • In the Operating System tab:

    • All fields should automatically contain values. Confirm each aspect of the operating system.
    • Make sure the Provisioning Method is set to Image Based. A new Image field appears. This field allows you to select the image as a basis for the new host’s root volume. This is also automatically populated from the compute profile you chose in the Host tab.
    • Click Resolve in Provisioning templates to check the new host can identify the right provisioning templates to use.
  • In the Virtual Machine tab:

    • These settings should be populated with details from the chosen host group and compute profile. Modify these settings to suit your needs.
  • In the Parameters tab:

    • Confirm the kt_activation_keys parameter exists and is using the example activation key.

Click Submit.

For CLI Users

Create the host with the hammer host create command and include --provision-method image to use image-based provisioning. For example:

# hammer host create --name "rhv-test2" --organization "ACME" \
--location "New York" --hostgroup "Base" \
--compute-resource "ACME's RHV" --provision-method image \
--image "Test RHV Image" --enabled true --managed true \
--interface "managed=true,primary=true,provision=true,compute_name=eth0,compute_network=satnetwork" \
--compute-attributes="cluster=Default,cores=1,memory=1073741824,start=true" \
--volume="size_gb=20G,storage_domain=Data,bootable=true"
Note

See Appendix B, Additional Host Parameters for Hammer CLI for more information on additional host creation parameters for this compute resource.

This new host entry triggers the Red Hat Virtualization server to create the virtual machine, using the pre-existing image as a basis for the new volume.

8.8. Chapter Summary

This chapter showed how to configure Red Hat Satellite 6 to use a Red Hat Virtualization server and how to provision new hosts through a Red Hat Virtualization server. This included both network-based hosts and image-based hosts.

If you have no further compute resources to configure with Red Hat Satellite 6, see Chapter 13, Finalizing Provisioning for some final notes on provisioning.

The next chapter explores methods of provisioning from a VMware vSphere platform.