Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 7. 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.

With Red Hat Satellite 6, you can manage virtualization functions through Red Hat Virtualization’s REST API version 3. REST API version 4 is not yet supported by Satellite 6. This includes creating virtual machines and controlling their power states.

Use the following procedures to add a connection to a Red Hat Virtualization environment and provision a virtual machine.

7.1. Prerequisites for Red Hat Virtualization Provisioning

The requirements for Red Hat Virtualization provisioning include:

  • Synchronized content repositories for Red Hat Enterprise Linux 7. For more information, see Synchronizing Red Hat Repositories in the Content Management Guide.
  • 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. For more information, see Chapter 4, Configuring Networking.
  • An existing template, other than the blank template, if you want to use image-based provisioning. For more information about creating templates for virtual machines, see Templates in the Virtual Machine Management Guide.
  • An activation key for host registration. For more information, see Creating An Activation Key in the Content Management guide.

7.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 more information about how to create a user and add permissions in Red Hat Virtualization, see Administering User Tasks From the Administration Portal in the Red Hat Virtualization Administration Guide.

7.3. Adding a Red Hat Virtualization Connection to Satellite Server

Use this procedure to add a Red Hat Virtualization connection to Satellite Server’s compute resources.

Procedure

To add a Red Hat Virtualization connection to Satellite, complete the following steps:

  1. In the Satellite web UI, navigate to Infrastructure > Compute Resources, and in the Compute Resources window, click Create Compute Resource.
  2. In the Name field, enter a name for the new compute resource.
  3. From the Provider list, select RHV.
  4. In the Description field, enter a description for the compute resource.
  5. In the URL field, enter the connection URL for the Red Hat Virtualization Manager’s API.

    For example, in RHEV 3.6 and earlier, the URL is of the following form: https://rhvm.example.com/ovirt-engine/api. In RHV 4.0 and later, the URL is of the following form: https://rhvm.example.com/ovirt-engine/api/v3.

  6. Optionally, select the Use APIv4 (experimental) check box to evaluate the new engine API.

    Warning

    The items listed in this step are provided as Technology Previews. For further information about the scope of Technology Preview status, and associated support implications, see Technology Preview Features Support Scope.

  7. In the User field, enter the name of a user with permissions to access Red Hat Virtualization Manager’s resources.
  8. In the Password field, enter the password of the user.
  9. Click Load Datacenters to populate the Datacenter list with data centers from your Red Hat Virtualization environment.
  10. From the Datacenter list, select a data center.
  11. From the Quota ID list, select a quota to limit resources available to Satellite.
  12. In the X509 Certification Authorities field, enter the certificate authority for SSL/TLS access. Alternatively, if you leave the field blank, a self-signed certificate is generated on the first API request by the server.
  13. Click the Locations tab and select the location you want to use.
  14. Click the Organizations tab and select the organization you want to use.
  15. Click Submit to save the compute resource.

For CLI Users

To create a Red Hat Virtualization connection, enter the hammer compute-resource create command with Ovirt for --provider and the name of the data center you want to use for --datacenter.

# hammer compute-resource create \
--name "My_RHV" --provider "Ovirt" \
--description "RHV server at rhvm.example.com" \
--url "https://rhvm.example.com/ovirt-engine/api" \
--use-v4 "false" --user "Satellite_User" \
--password "My_Password" \
--locations "New York" --organizations "My_Organization" \
--datacenter "My_Datacenter"

Optionally, to evaluate the new engine API, change false to true for the --use-v4 option.

Warning

The items listed in this step are provided as Technology Previews. For further information about the scope of Technology Preview status, and associated support implications, see Technology Preview Features Support Scope.

7.4. Adding Red Hat Virtualization Images to Satellite Server

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

Procedure

To add Red Hat Virtualization images on Satellite Server, complete the following steps:

  1. In the Satellite web UI, navigate to Infrastructure > Compute Resources, and in the Compute Resources window, click the name of your Red Hat Virtualization connection.
  2. Click the Image tab, and then click New Image.
  3. In the Name field, enter a name for the image.
  4. From the Operatingsystem list, select the image’s base operating system.
  5. From the Architecture list, select the operating system architecture.
  6. In the Username field, enter the SSH user name for image access. This is normally the root user.
  7. In the Password field, enter the SSH password for image access.
  8. From the Image list, select the name of the image on Red Hat Virtualization.
  9. Click Submit to save the image details.

For CLI Users

Create the image with the hammer compute-resource image create command. Use the --uuid option 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 "My_RHV"

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

Procedure

To add Red Hat Virtualization details to a compute profile, complete the following steps:

  1. In the Satellite web UI, navigate to Infrastructure > Compute Profiles and in the Compute Profiles window, click the name of the Red Hat Virtualization connection.
  2. From the Cluster list, select the target host cluster in the Red Hat Virtualization environment.
  3. From the Template list, select the RHV template to use for the Cores and Memory settings.
  4. In the Cores field, enter the number of CPU cores to allocate to the new host.
  5. In the Memory field, enter the amount of memory to allocate to the new host.
  6. From the Image list, select image to use for image-based provisioning.
  7. In the Network Interfaces area, enter the network parameters for the host’s network interface. You can create multiple network interfaces. However, at least one interface must point to a Capsule-managed network. For each network interface, enter the following details:

    1. In the Name field, enter the name of the network interface.
    2. From the Network list, select The logical network that you want to use.
  8. In the Storage area, enter the storage parameters for the host. You can create multiple volumes for the host. For each volume, enter the following details:

    1. In the Size (GB) enter the size, in GB, for the new volume.
    2. From the Storage domain list, select the storage domain for the volume.
    3. From the Preallocate disk, select either thin provisioning or preallocation of the full disk.
    4. From the Bootable list, select whether you want a bootable or non bootable volume.
  9. Click Submit to save the compute profile.

For CLI Users

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

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

In Satellite, you can create Red Hat Virtualization hosts over a network connection or from an existing image.

To create a host over a network, the new host must have access to either Satellite Server’s integrated Capsule or an external Capsule Server on a Red Hat Virtualization virtual network, so that the host has access to PXE provisioning services. The 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.

DHCP conflicts

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

When you create a host with an existing image, the 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.

Procedure

To create a host for Red Hat Virtualization Server, complete the following steps:

  1. In the Satellite web UI, navigate to Hosts > New Host.
  2. In the Name field, enter the name that you want to become the provisioned system’s host name.
  3. Click the Organization and Location tabs to ensure that the provisioning context is automatically set to the current context.
  4. From the Host Group list, select the host group that you want to use to populate the form.
  5. From the Deploy on list, select the Red Hat Virtualization connection.
  6. From the Compute Profile list, select a profile to use to automatically populate virtual machine-based settings.
  7. Click the Interface tab and click Edit on the host’s interface.
  8. Verify that the fields are automatically populated with values. Note in particular:

    • The Name from the Host tab becomes the DNS name.
    • Satellite Server automatically assigns an IP address for the new host.
  9. Ensure that the MAC address field is blank. The Red Hat Virtualization server assigns one to the host.
  10. Verify that the Managed, Primary, and Provision options are automatically selected for the first interface on the host. If not, select them.
  11. In the interface window, ensure that the Red Hat Virtualization-specific fields are populated with settings from the compute profile. Modify these settings to suit your needs.
  12. Click the Operating System tab, and confirm that all fields automatically contain values.
  13. For network-based provisioning, ensure that the Provisioning Method is set to Network Based. For image-based provisioning, ensure that the Provisioning Method is set to Image Based.
  14. Click Resolve in Provisioning templates to check the new host can identify the right provisioning templates to use.
  15. Click the Virtual Machine tab and confirm that these settings are populated with details from the host group and compute profile. Modify these settings to suit your needs.
  16. Click the Parameters tab and ensure that a parameter exists that provides an activation key. If not, add an activation key.
  17. Click Submit to save the host entry.

For CLI Users

To create a host with network-based provisioning, use the hammer host create command and include --provision-method build.

# hammer host create --name "rhv-test1" --organization "My_Organization" \
--location "New York" --hostgroup "Base" \
--compute-resource "My_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"

To create a host with image-based provisioning, use the hammer host create command and include --provision-method image.

# hammer host create --name "rhv-test2" --organization "My_Organization" \
--location "New York" --hostgroup "Base" \
--compute-resource "My_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"

For more information about additional host creation parameters for this compute resource, see Appendix B, Additional Host Parameters for Hammer CLI.