Chapter 8. Provisioning Virtual Machines in Red Hat Enterprise Virtualization
Red Hat Enterprise Virtualization 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 Enterprise Virtualization’s REST API. 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 Enterprise Virtualization environment and provision a virtual machine.
8.1. Defining Requirements for Red Hat Enterprise Virtualization Provisioning
The requirements for Red Hat Enterprise Virtualization provisioning include:
- Synchronized content repositories for Red Hat Enterprise Linux 7. See Synchronizing Red Hat Repositories in the Red Hat Satellite 6 Content Management Guide for more information.
- A Capsule Server managing a logical network on the Red Hat Enterprise 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.6, “Creating an Activation Key” for more information.
8.2. Creating a Red Hat Enterprise Virtualization User
The Red Hat Enterprise 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 Enterprise 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 Enterprise Virtualization, see Adding Users and Assigning User Portal Permissions in the Red Hat Enterprise Virtualization Administration Guide.
8.3. Adding a Red Hat Enterprise Virtualization Connection to the Satellite Server
This process adds a Red Hat Enterprise Virtualization connection in the Satellite Server’s compute resources.
For Web UI Users
Navigate to Infrastructure > Compute resource and click New 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 RHEV
. -
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,
RHEV-M server at rhevm.example.com
. -
URL - The connection URL to the Red Hat Enterprise Virtualization Manager’s API. For example, in versions of RHV less than 4.0, this URL is of the form
https://rhevm.example.com/api
. In versions of RHV 4.0 and higher, this URL is of the formhttps://rhevm.example.com/ovirt-engine/api/v3
. -
Username - The user with permission to access the Red Hat Enterprise 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 Enterprise 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 RHEV" \ --provider "Ovirt" --description "RHEV-M server at rhevm.example.com" \ --url "https://rhevm.example.com/api" --user "satellite@internal" \ --password "p@55w0rd!" --locations "New York" --organizations "ACME" \ --uuid 72cb9454-81cd-4231-a863-d9baf0f399f8
In versions of RHV less than 4.0, this URL is of the form https://rhevm.example.com/api
. In versions of RHV 4.0 and higher, this URL is of the form https://rhevm.example.com/ovirt-engine/api/v3
.
8.4. Adding Red Hat Enterprise Virtualization Images on the Satellite Server
Red Hat Enterprise 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 Enterprise 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 Enterprise 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 Enterprise Virtualization template:
-
Name - A plain text name for the image. For example,
Test RHEV 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 Enterprise 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 Enterprise Virtualization server.
# hammer compute-resource image create --name "Test RHEV Image" \ --operatingsystem "RedHat 7.2" --architecture "x86_64" --username root \ --uuid "9788910c-4030-4ae0-bad7-603375dd72b1" \ --compute-resource "ACME's RHEV"
8.5. Adding Red Hat Enterprise Virtualization Details to a Compute Profile
You can predefine certain hardware settings for virtual machines on Red Hat Enterprise 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 Enterprise Virtualization connection.
The UI provides a set of fields where you can input Red Hat Enterprise Virtualization-specific details for the profile. This includes:
- Cluster - The target host cluster in the Red Hat Enterprise Virtualization environment.
- Template - The RHEV 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 RHEV Image
. Network Interfaces - Defines 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 - Defines the name of the network interface.
- Network - Defines the logical network to use.
Storage - Defines volumes for the host. You can create multiple volumes for the host. The storage options include:
- Size (GB) - Defines the size of volume in GB.
- Storage domain - Defines the storage domain for the volume.
- Preallocate disk - Defines whether to use 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.2. 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 Enterprise Virtualization Server
The Red Hat Enterprise 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 Enterprise Virtualization virtual network. This is so the host has access to PXE provisioning services.
If using a virtual network on the Red Hat Enterprise 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
rhev-test1
. -
The provisioning context (Organization and Location) should automatically set to the current context. For example:
ACME
andNew 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 Enterprise Virtualization connection. For our example,
ACME's RHEV
. 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
.
-
Enter the Name of the Host. This becomes the provisioned system’s host name. For this example, enter
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 Enterprise 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 theexample
activation key.
-
Confirm the
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 "rhev-test1" --organization "ACME" \ --location "New York" --hostgroup "Base" \ --compute-resource "ACME's RHEV" --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"
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 Enterprise 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 Enterprise Virtualization Server
The Red Hat Enterprise Virtualization provisioning process also provides the option to create new hosts from existing images on the Red Hat Enterprise 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
rhev-test2
. -
The provisioning context (Organization and Location) should automatically set to the current context. For example:
ACME
andNew 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 Enterprise Virtualization connection. For our example,
ACME's RHEV
. 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
.
-
Enter the Name of the Host. This becomes the provisioned system’s host name. For this example, enter
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 Enterprise 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 Enterprise 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 theexample
activation key.
-
Confirm the
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 "rhev-test2" --organization "ACME" \ --location "New York" --hostgroup "Base" \ --compute-resource "ACME's RHEV" --provision-method image \ --image "Test RHEV 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"
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 Enterprise 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 Enterprise Virtualization server and how to provision new hosts through a Red Hat Enterprise 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.