VM Provisioning

Virtual Machine Provisioning example

The first example will guide you through the process of offering a Service Catalog Item to provision a simple virtual machine. This will include:

  • Create a service catalog: this will allow to organize services in a structured way
  • Design a service dialog: a form which will ask the user for the necessary input data
  • Publish a service catalog item: puts everything together and build the item which users can order

The following chapters will guide you through the process step-by-step.

Build a Service Dialog

For this example we will create a Service Dialog which will ask the user for two parameters:

  • the name of the new virtual machine
  • how much memory should be allocated to the new virtual machine

Follow these steps to design the service dialog:

  1. Navigate to Automation -> Automate -> Customization

    navigate to Automation, Automate, Customization

  2. Navigate to Service Dialogs in the accordion on the left.

    navigate to service dialogs

  3. Click on Configuration -> Add a new Dialog

  4. Chose a label and description:

    Label: Simple VM

    Description: Simple VM provisioning dialog

Make sure Submit and Cancel are both checked

Do not try to save the changes right now! The dialog is not finished and you will receive and error message (“Validation failed: Dialog Simple VM must have at least one Tab”)

![create a service dialog](/img/pconf17-create-service-dialog.png)
  1. Click on the little plus icon in the menu on the top and select Add a new Tab to this Dialog

    Tabs can be used to make complex Service Dialogs easier to navigate and fill out. They are often used to logically structure related questions (e.g. “General Configuration”, “Network Configuration”, “user Configuration”).

    For this lab, we will keep it simple:

    Label: Generic

    Description: Generic Tab

    add a new tab to the dialog

  2. Click on the little plus icon and Add a new Box to this Tab

    Boxes are used to visually group related dialog elements. For example in the network configuration Service Dialog a box could be used to group all IPv4 related questions, and another box to group all IPv6 related questions.

    For this lab we create a simple box:

    Label: Generic

    Description: Generic Box

    add a new box to the tab

  3. Now we can add elements to this box. Click on Add a new Element to this Box

    The first element will allow the user to specify a VM name:

    The Label is the name of the element as it will be shown in the UI:

    Label: VM Name

    The name will be used for the internal variable of the provisioning workflow:

    Name: vm_name

    The description is some text which will be shown if the mouse pointer is hovering over this element. It can be used to provide additional information to the user to fill out this field:

    Description: Specify the name of the new virtual machine

    CloudForms allows us to design Service Dialogs comprised of many different types of Elements:

    • Check box: allows to user to check or uncheck the element, often used to ask for additional optional data
    • Date Control: allows the user to select a date from a calender widget. Often used for retirement or other date related options
    • Date/Time Control: same as Date Control, but also allows to specify a time, for example used to specify an automated shutdown or if a change should be scheduled for later
    • Drop Down List: allows the user to select one or multiple options from a list, for example to chose from a list of available networks, applications, cost centers and many more
    • Radio Button: Similar to the check box, but only one of the options can be selected, for example the base OS version (RHEL 6 or RHEL 7, but never more than one)
    • Tag Control: a special element which allows the user to chose from available tags. More about tagging later in this lab
    • Text Area Box: allows the user to enter relatively large amounts of text (multiple lines), could be used for example to provide description information
    • Text Box: allows the user for short amounts of text (one line), in this example we use this element to ask the user for a name of the virtual machine

    We want the user to enter a text which then will be used to name the VM. This can be accomplished by selecting “Text Box” in the Type drop down list.

    add a new element to ask for the VM name

    The remaining options can be ignored for now.

  4. We want to add a second element where the user can chose the memory size of the new VM. Click once more on Add a new Element to this Box.

    Label: Memory size

    Name: option_0_vm_memory

    Description: Select how much memory the virtual machine should have

    Type: Drop Down List

    A element of type “Drop Down List” allows the user to select one of the predefined values. To create the list of selectable values, scroll down to the table “Entries” and add the following lines:

    Value: 2048

    Description: 2 GB

    Value: 4096

    Description: 4 GB

    Value: 8192

    Description: 8 GB

To be able to add a line to the table, click on the little “Add this entry” icon on the left of each row!

![add entries to the drop down list](/img/pconf17-memory-dropdownlist.png)
  1. We are finally done designing the dialog. Click on Add to save the dialog.

If you’re having trouble creating the Service Dialog, you can download it from Github and import it. Follow the instructions on how to import a service dialog ONLY if you were unable to create the dialog.

Build a Virtual Machine Service Catalog

The following steps will create a Service Catalog.

  1. The next step is to create a Service Catalog. First we have to navigate to Services -> Catalogs.

    navigate to services, catalog

  2. Click on Catalogs in the accordion on the left

    service catalogs

  3. Click on Configuration and Add a New Catalog

  4. Fill out name and description:

    Name: Virtual Machines

    Description: Deploy Virtual Machines from the Catalog

    add a new catalog

  5. Click Add to save the Service Catalog

Build a Virtual Machine Service Catalog Item

To tie everything together, the last step is to define a service catalog item.

  1. Navigate to Services -> Catalogs

    navigate to services, catalog

  2. Click on Catalog items in the accordion on the left.

    You should already see two Service Catalogs:

    Unassigned: Catalog items which are not published yet, will be listed here

    Virtual Machines: the Service Catalog we just created in the previous step

    navigate to catalog items

  3. In the Configuration Menu, click on Add a New Catalog Item

    Catalog Bundles are used for multi tier applications and consist of many Catalog Items. Since we do not have any existing Catalog Items, we can not create a Bundle.

  4. Chose the Catalog Item Type. For this example we want to use the Red Hat Virtualization Provider, so click on RHEV

    select catalog item type

It can take a few seconds for the next screen to load.

  1. The next dialog will ask for the details of the new Service Catalog Item:

    The name of the Service Catalog Item shown in the UI:

    Name: Simple VM

    A more descriptive text about the Service Catalog Item:

    Description: A simple Linux Virtual Machine

    Check the “Display in Catalog” box. If not selected, the Service Catalog Item will not be visible to users. This can be used for Items which are either still in draft mode, or should only be ordered as a part of a bundle:

    Display in Catalog: check this box

    Select the previously created Service Catalog:

    Catalog: Virtual Machines

    Select the previously created Service Dialog:

    Dialog: Simple VM

    All other fields on this tab can remain unchanged.

    adding a new catalog item

    Entry Points are the hooks into CloudForms’ powerful Automation Framework. It allows administrators to define provisioning, reconfiguration and retirement workflows which are different from the out of the box behavior. For example we could add integration into an IP Address Management Tool, a ticketing system or a CMDB Service. For this lab, we want to stick with the out of the box experience and leave those fields unchanged.

  2. Click on the Details tab. You can provide some more descriptive explanation about the service here. We can even use basic HTML formatting in this box.

    <h1>Simple VM</h1>
    <p>When ordering this item, the user will be provided some simple questions to specify the hostname and memory size of the requested virtual machine.</p>
    <p>The VM will be deployed with <a href=http://www.redhat.com>Red Hat Enterprise Linux 7</a>.
  3. The Request Info tab of the dialog allows us to provide all the settings we want to use when provisioning a virtual machine from this Service Catalog Item.

    Select the template used for provisioning:

    Selected VM: rhel73

    For automatic naming chose “changeme”

    Naming: changeme

    If no name is specified, this will cause CloudForms to automatically assign a name based on “cfme” as a prefix. The name will be expanded with a unique ID starting with 001.

  4. Click on the sub tab Environment

    Although it sounds the most convenient option, we can not use “Choose Automatically”. This will require the definition of a provisioning scope, which we haven’t done yet. Instead we we set the appropriate values manually.

    The datacenter of our Red Hat Virtualization Provider:

    Datacenter: Default

    The cluster in the Red Hat Virtualization Datacenter:

    Cluster: Default

    The host which will perform the actual tasks and where the VM will initially run on:

    Host: rhelkvm

    The storage domain to store the VM

    Datastore: vmstore00

  5. Click on the next sub tab Hardware

    For the purpose of the lab, the provided defaults are fine.

  6. Click on the next sub tab Network

    The lab environment is very simple, there is only one VLAN available:

    VLAN: rhevm

  7. Click on the next sub tab Customize

    This allows to reconfigure certain settings inside the virtual machine. For this lab, we keep them all empty

  8. Click on the last sub tab Schedule

    This allows us to delay provisioning to a later time, for example during the night or off hours. We can also set a retirement date. After notifying the user and allowing him or her to extend the lifespan of the virtual machine, retirement will shutdown and, by default, delete the virtual machine.

    For the purpose of the lab, we keep these settings unchanged.

  9. Finally click on Add to save the Catalog Item

    catalog item saved

Order the Simple Virtual Machine Service Catalog Item

For sure you want to test the Service Catalog Item you just created!

  1. Navigate to Services -> Catalogs and then click on Service Catalogs in the accordion on the left.

    navigate to services, catalog

  2. You should see the Service Catalog Item we just created:

    all services

  3. Click on the Item to see more details.

    service item details

    Note that the Link for Red Hat Enterprise Linux in fact opens the Red Hat Homepage.

  4. Click on Order

  5. The Service Dialog we created earlier will be presented and ask for the name of the virtual machine and the memory size. As you can see, the name is a free text field, and the memory size is a drop down list.

    Chose an example virtual machine name and the amount of memory you would like to be allocated.


  6. You will be redirected to the request queue where you can see CloudForms working on your request.

    simple vm ordered

Since we are using nested virtualization to run these labs, performance will be slow and it can take several minutes to complete the request (20-30 minutes).

Verify order

In the requests queue you can click on Reload to see how CloudForms processes the order. If you click the button a few times, you should see the status is progressing.

We want to log into Red Hat Virtualization to see how the virtual machine is created:

  1. Open the Red Hat Virtualization Web UI in a new browser window or tab.

    URL: https://rhevm-lu<number>.labs.rhepds.com

    rhv portal page

  2. Click on Administrator Portal

    rhv admin portal

  3. Log in with these credentials:

    ***user:*** admin
    ***Password:*** r3dh4t1!

    Make sure the profile is set to “internal”.

  4. Click on the tab Virtual Machines to see all existing virtual machines

    vm overview

  5. After a few moments you’re virtual machine should automatically show up in the list.

    lab VM showing up

    Note that while the virtual machine is created, the memory size is still 1 GB. This value is specified in the template therefore copied when creating the virtual machine. Only after the virtual machine was successfully cloned, CloudForms corrects the memory size.

    lab VM complete

  6. This concludes this first part of the lab