Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 9. Provisioning Virtual Machines in VMware vSphere

VMware vSphere is an enterprise-level virtualization platform from VMware. Red Hat Satellite 6 can interact with the vSphere platform, including creating new virtual machines and controlling their power management states. In this chapter, the aim is to add a connection to ACME’s vSphere environment and provision a virtual machine.

9.1. Defining Requirements for VMware vSphere Provisioning

The requirements for VMware vSphere 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 network on the vSphere 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 VMware template if you aim to use image-based provisioning.
  • An example activation key for host registration. See Section 3.8, “Creating an Activation Key” for more information.

9.2. Creating a VMware vSphere User

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

  • All Privileges → Datastore → Allocate Space
  • All Privileges → Network → Assign Network
  • All Privileges → Resource → Assign virtual machine to resource pool
  • All Privileges → Virtual Machine → Configuration (All)
  • All Privileges → Virtual Machine → Interaction
  • All Privileges → Virtual Machine → Inventory
  • All Privileges → Virtual Machine → Provisioning

9.3. Adding a VMware vSphere Connection to the Satellite Server

This process adds a VMware vSphere 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 vSphere.
  • Provider - A field for selecting the compute resource provider. Select VMware and a new set of fields appear.
  • Description - A plain text description for the resource. For example, VMware vSphere at vsphere.example.com.
  • VCenter/Server - The IP address or host name of the vCenter server. For example, vsphere.example.com.
  • Username - The user with permission to access the vCenter’s resources. For example, SatelliteUser.
  • 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 VMware vSphere environment. Select a specific data center to manage from this list.
  • Fingerprint - The certificate fingerprint for accessing your vSphere environment. This field is usually populated with the fingerprint from your chosen data center.
  • Console passwords - Secures console access for new hosts with a randomly generated password.
  • Enable caching - Enables caching of compute resources. For more information, see Section 9.8, “Caching of Compute Resources”.

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 Vmware as the --provider and set the instance UUID of the data center as the --uuid:

# hammer compute-resource create --name "ACME's vSphere" \
--provider "Vmware" \
--description "vSphere server at vsphere.example.com" \
--server "vsphere.example.com" --user "SatelliteUser" \
--password "p@55w0rd!" --locations "New York" --organizations "ACME" \
--uuid 72cb9454-81cd-4231-a863-d9baf0f399f8
Note

Ensure that the host and network-based firewalls are configured to allow Satellite to vCenter communication on TCP port 443. Verify that Satellite is able to resolve the host name of vCenter and vCenter is able to resolve the Satellite Server host name.

9.4. Adding VMware vSphere Images on the Satellite Server

VMware vSphere uses templates as images for creating new virtual machines. If using image-based provisioning to create new hosts, you need to add VMware 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 VMware vSphere 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 Create Image and the UI provides a set of fields for the VMware vSphere template:

  • Name - A plain text name for the image. For example, Test vSphere 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.
  • User data - To set if images support user data input, such as cloud-init data.
  • Password - The SSH password for image access.
  • Image - The relative path and name of the template on the vSphere environment. For example Templates/RHEL72. Do not include the data center in the relative path.

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 relative template path on the vSphere environment.

# hammer compute-resource image create --name "Test vSphere Image" \
--operatingsystem "RedHat 7.2" --architecture "x86_64" \
--username root --uuid "Templates/RHEL72" \
--compute-resource "ACME's vSphere"

9.5. Adding VMware vSphere Details to a Compute Profile

You can predefine certain hardware settings for virtual machines on VMware vSphere. 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 vSphere connection.

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

  • CPUs - The number of CPUs to allocate to the new host.
  • Cores per socket - The number of cores to allocate to each CPU.
  • Memory - The amount of memory to allocate to the new host.
  • Cluster - The target host cluster on the VMware environment.
  • Resource pool - The resource pool containing the available resource allocations for the host.
  • Folder - The folder to organize the host.
  • Guest OS - Defines the underlying operating system in VMware vSphere.
  • SCSI controller - Defines the disk access method.
  • Virtual H/W version - Defines the underlying VMware hardware abstraction to use for virtual machines.
  • Memory hot add or CPU hot add - Define whether you can add more resources while the virtual machine is powered.
  • Image - The image to use if performing image-based provisioning. For this example, use the Test VMware 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:

    • NIC type - Defines the VMware network interface type.
    • Network - Defines the virtual network to use.
  • Storage - Defines volumes for the host. You can create multiple volumes for the host. The storage options include:

    • Data store - Defines the storage location for the volume.
    • Size (GB) - Defines the size of the volume in GB.
    • Thin provision - Defines whether to use thin provisioning or preallocation of the full disk.
    • Eager zero - Defines whether to use eager zero thick provisioning. If unchecked, the disk uses lazy zero thick provisioning.

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.

9.6. Creating Network-Based Hosts on a VMware vSphere Server

The VMware vSphere 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 VMware vSphere virtual network. This is so the host has access to PXE provisioning services.

Important

If using a virtual network on the VMware vSphere 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: vmware-test1.
    • The provisioning context (Organization and Location) should automatically set to the current context. For this example: ACME and New York.
    • Select the Host Group. This should automatically populate most of the new host’s fields. For this example: Base.
    • In Deploy on, select the VMware vSphere connection. For this example: ACME's vSphere. 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 VMware vSphere 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 VMware vSphere-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 "vmware-test1" --organization "ACME" \
--location "New York" --hostgroup "Base" \
--compute-resource "ACME's vSphere" --provision-method build \
--build true --enabled true --managed true \
--interface "managed=true,primary=true,provision=true,compute_type=VirtualE1000,compute_network=mynetwork" \
--compute-attributes="cpus=1,corespersocket=2,memory_mb=1024,cluster=MyCluster,path=MyVMs,start=true" \
--volume="size_gb=20G,datastore=Data,name=myharddisk,thin=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 VMware vSphere 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.

9.7. Creating Image-Based Hosts on a VMware vSphere Server

The VMware vSphere provisioning process also provides the option to create new hosts from existing images on the VMware vSphere 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: vmware-test1.
    • The provisioning context (Organization and Location) should automatically set to the current context. For this example: ACME and New York.
    • Select the Host Group. This should automatically populate most of the new host’s fields. For this example: Base.
    • In Deploy on, select the VMware vSphere connection. For this example: ACME's vSphere. 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 VMware vSphere 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 VMware vSphere-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 "vmware-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_type=VirtualE1000,compute_network=mynetwork" \
--compute-attributes="cpus=1,corespersocket=2,memory_mb=1024,cluster=MyCluster,path=MyVMs,start=true" \
--volume="size_gb=20G,datastore=Data,name=myharddisk,thin=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 VMware vSphere server to create the virtual machine, using the pre-existing image as a basis for the new volume.

9.8. Caching of Compute Resources

Caching of compute resources speeds up rendering of VMware information.

9.8.1. Enabling Caching of Compute Resources

To enable or disable caching of compute resources:

  1. Navigate to Infrastructure > Compute resources.
  2. Click the Edit button to the right of the VMware server you want to update.
  3. Select the Enable caching checkbox.

9.8.2. Refreshing the Compute Resources Cache

To refresh the cache of compute resources to update compute resources information:

For Web UI Users

  1. Navigate to Infrastructure > Compute resources.
  2. Select a VMware server you want to refresh the compute resources cache for and click the Refresh Cache button.

For CLI Users

Use this API call to refresh the compute resources cache:

# curl -H "Accept:application/json,version=2" \
-H "Content-Type:application/json" -X PUT \
-u username:password -k \
https://satellite.example.com/api/compute_resources/compute_resource_id/refresh_cache

Use the hammer compute-resource list command to determine the id of the VMware server you want to refresh the compute resources cache for.

9.9. Chapter Summary

This chapter showed how to configure Red Hat Satellite 6 to use a VMware vSphere server and how to provision new hosts through a VMware vSphere 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 Red Hat OpenStack Platform environment.