Oparin

Creating a Service in for Virtual Machine Provisioning

Overview

ManageIQ provides the ability to define services, which can include one or more virtual machines or instances, and can be deployed across hybrid environments. Services can be made available to users through the Self Service user interface, allowing users to order predefined IT services without IT operations getting involved.

The following three items are required to make a service available to users from the ManageIQ Self Service user interface:

  1. Service Dialog: A service dialog is where you allow users to configure virtual machine or instance options. A service dialog determines which options users get to change. You can choose the options presented to the user, from setting the service name to changing all provisioning dialog options.

  2. Service Catalog: A service catalog is used to group service dialogs together.

  3. Service Catalog Item: A service catalog item is the actual service which combines a service dialog with a provisioning dialog.

Examining the Provisioning Dialog

Understanding provisioning dialogs is important when working with services in ManageIQ. Every provider in ManageIQ comes with a sample provisioning dialog covering the options specific to that provider. The process begins with the provisioning dialog, which presents the basic configuration options for a virtual machine or instance. The options presented are dependent on the provider you are using. For instance, a cloud provider might have flavors of instances, whereas an infrastructure provider might allow you to set the memory size or number of CPUs on a virtual machine.

To see the sample provisioning dialog for Red Hat Virtualization:

  1. Browse to menu: Automation > Automate > Customization.

  2. Expand the Provisioning Dialogs accordion and select Sample RedHat VM Provisioning Dialog under VM Provision.

This is a textual representation of the dialog you will get when you provision a virtual machine.

Creating a Service Dialog

Using a service dialog you can determine which options users get to change. When users access a service, the majority of options available to them are preset and cannot be altered. A service dialog exposes some of those options to the user so that even if they are ordering a basic RHEL 7 machine, for example, they can at least choose the amount of memory, virtual CPUs, or other options available to the instance they order. In cases where certain fields must be unique, such as the name of virtual machines in Red Hat Virtualization, users must enter their own unique name for the virtual machine they choose or the operation will fail, so this field must be exposed.

Note:

A service requires an assigned service dialog, regardless of exposing details to user. A simple service dialog with a Submit and Cancel button is required at minimum.

A service dialog contains three components:

  • One or more Tabs.

  • Inside the tabs, one or more Sections. Note that in the previous method of creating a service dialog using the ManageIQ user interface, Sections were referred to as Boxes.

  • Inside the sections, one or more Elements. Elements are controls that accept input. Elements contain methods, like check boxes, drop-down lists or text fields, to fill in the options on the provisioning dialog.

The names of the elements must correspond to the options used in the provisioning dialog.

The following procedure outlines how to create a service dialog for your sample service:

  1. Browse to menu: Automation > Automate > Customization.

  2. Click the Service Dialogs accordion.

  3. Click Configuration, and then 1862(Add a new Dialog).

  4. Enter basic information for your dialog under General:

    1. Enter Provision RHV VM in Dialog’s name, and enter a description for the dialog in Dialog’s description.
  5. Add a new tab to the dialog:

    1. Click 1862Create Tab. Then, click the pencilicon on the new tab to edit tab information.

    2. Enter General in Label.

    3. Optional: Enter a description for the tab in Description.

    4. Click Save.

  6. Add a new section to the tab:

    1. Click 1862Add Section. Then, click the pencilicon on the upper-right to edit section details.

    2. Enter Service and VM Name in Label.

    3. Optional: Enter a description for the section in Description.

    4. Click Save.

  7. Add a Text Box element to the section for the service name:

    1. From the list of elements on the left, click the Text Box element, then drag-and-drop it inside the section. Then, click the pencilicon next to the element to edit its field details.

    2. Enter Service Name in Label.

    3. Enter service_name in Name.

    4. Click Options, then select String from the Value Type list.

    5. Click Save.

  8. Add a Text Box element to the section for the virtual machine name:

    1. From the list of elements on the left, click the Text Box element, then drag-and-drop it inside the section. Then, click the pencilicon next to the element to edit its field details.

    2. Enter VM Name in Label.

    3. Enter vm_name in Name.

    4. Click Options, then select String from the Value Type list.

    5. Click Save.

  9. Add a Text Box element to the section for the virtual machine description:

    1. From the list of elements on the left, click the Text Box element, then drag-and-drop it inside the section. Then, click the pencilicon next to the element to edit its field details.

    2. Enter VM Description in Label.

    3. Enter vm_description in Name.

    4. Click Options, then select String from the Value Type list.

    5. Click Save.

  10. Add a new section to the tab:

    1. Click 1862Add Section. Then, click the pencilicon on the upper-right to edit section details.

    2. Enter VM Characteristics in Label.

    3. Optional: Enter a description for the section in Description.

    4. Click Save.

  11. Add a Dropdown element to the section for the number of CPUs:

    1. From the list of elements on the left, click the Dropdown element, then drag-and-drop it inside the section. Then, click the pencilicon next to the element to edit its field details.

    2. Enter Number of CPUs in Label.

    3. Enter option_0_cores_per_socket in Name.

    4. Click Options. Next to Entries, click + to add individual entries for the values 1, 2, and 4, and their description.

    5. Click Save.

  12. Add a Dropdown element to the section for the virtual machine memory:

    1. From the list of elements on the left, click the Dropdown element, then drag-and-drop it inside the section.

    2. Click the pencilicon next to the element to edit its field details.

    3. Enter VM Memory in Label.

    4. Enter option_0_vm_memory in Name.

    5. Click Options. Next to Entries, click + to add individual entries for the values 1024, 2048, and 4096 and their description.

    6. Click Save.

  13. Click Save to save the dialog.

Your service dialog is now added in the Service Dialogs accordion.

Creating a Catalog Item

Create a service catalog item to represent that service in a catalog.

  1. Browse to menu: Services > Catalog.

  2. Click the Catalog Items accordion.

  3. Click Configuration, and then 1862(Add a new Catalog Item).

  4. Select RHEV from the Catalog Item Type list.

  5. Enter the basic details in the Basic Info tab:

    1. Enter a name for the catalog item in Name.

    2. Enter a description for the catalog item in Description.

    3. Select Display in Catalog.

    4. Select the catalog you created from the Catalog list.

    5. Select the service dialog you created from the Dialog list.

  6. Click the Details tab:

    1. Enter a description of the catalog item using HTML tags.
  7. Click the Request Info tab to enter the request details. Enter the same data you did in the traditional provisioning dialog.

    1. In the Catalog tab, select the template on which to base the virtual machine from the Selected VM area.

    2. Enter changeme as the default name of the virtual machine in VM Name.

    3. In the Network tab, select rhevm from the vLan list.

  8. Click Add.

Note:

In ManageIQ, service catalog items can be more complex than a single virtual machine and are provisioned through a series of automation workflows. The service dialog you created will be used to gather information from the user requesting the virtual machine, hiding all the complexity of the details needed to actually deploy any of the components.

You can now provision a virtual machine through Red Hat Virtualization using the Self Service user interface.

Provisioning a Virtual Machine Using the Self Service User Interface

  1. Log in to the Self Service User Interface at https://<hostname/ui/service>.

  2. Click the Service Catalog tab.

  3. Click the service you created.

  4. In the Service and VM Name:

    1. Enter the service name in Service Name.

    2. Enter the virtual machine name in VM Name.

    3. Enter the virtual machine description in VM Description.

  5. In VM Characteristics, enter Number of CPUs and VM Memory.

  6. Click Add to Shopping Cart and access the shopping cart by clicking its icon on the upper-right corner of the screen.

  7. Click Order.

You have ordered a new provisioning request. You can follow its progress and see additional details of the order request by selecting it from the Orders tab.

Also, see the Self Service User Interface Guide for more information about using the Self Service user interface.

Summary.

As part of the above sample service, you created a provisioning dialog that defines the options that can be set on a virtual machine. Then, you created a service dialog which allows us to expose certain options to be set by the user. For our example, the service name, virtual machine name, virtual machine description, and virtual machine characteristics are configurable. Additionally, you created a service catalog and finally a catalog item. The catalog item combines the service dialog with all of the options in the provisioning dialog. Lastly, you provisioned a Red Hat Virtualization virtual machine using the Self Service user interface.