ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
Chapter 6. Catalogs and Services
6.1. About Catalogs and Services
Through the use of catalogs, ManageIQ Management Engine provides support for multi-tier service provisioning to deploy layered workloads across hybrid environments. You can create customized dialogs that will give consumers of the services the ability to input just a few parameters and provision the entire service.
6.2. Terminology
Terminology
Catalog Bundle
A grouping of Templates.
Catalog Item
A single Template or a group of Templates (catalog bundle).
Dialog Tabs
Part of a Service Dialog.
Element
An item on a tab in a Dialog. It can be a Button, Check Box, Drop Down List, Radio Button, Tag
Control, Text Area Box, or a Text Box.
Provisioning Dialogs
Dialogs created for Host Provisioning, VM Migration, or VM Provisioning. The dialog name must be added to the appropriate provision instance to be processed.
Service Catalog
A catalog item or Catalog bundle that is available for provisioning.
Service Dialogs
Made up of fully customizable tabs, items, and values for use with Service provisioning.
Template
A template is a copy of a preconfigured virtual machine, designed to capture installed software and software configurations, as well as the hardware configuration, of the original virtual machine.
6.3. Catalogs
6.3.1. Catalogs
Catalogs are used to create groups of virtual machines or instances for provisioning. For example, a complete package of a database server, desktop with specialized software already on it, and a firewall.
60
Chapter 6. Catalogs and Services
You will need to complete the following steps to create and provision a service catalog.
1. Create Catalog Items for each virtual machine or instance that will be part of the service.
2. Create a
Service dialog. For example, create a dropdown with three options small, medium, and large.
3. Create a method for the Service Dialog in the Factory/Service class. This method defines what each of the options means to each of the individual virtual machines or cloud instances for the service. This method is called from a service provisioning instance in the
Automate model.
4. Create an instance in the Factory/StateMachines/ServiceProvision class that calls the method.
5. Associate method with Automate instance
6. Create a
Catalog Bundle, adding each of the catalog items to it. Select the Service Dialog you created. Use the instance created in the Factory/StateMachines/ServiceProvision class as the
Entry Point. Check Display in Catalog box.
7. Provision a service
6.3.2. Creating a Catalog Item
Create a catalog item for each virtual machine or cloud instance that will be part of the service.
Procedure 6.1. To Create a Catalog Item
1. Navigate to Services → Catalogs.
2. Click the Catalog Items accordion.
3. Click (Configuration), and then (Add a New Catalog Item).
4. Select the Catalog Item Type you are adding. The dialogs that appear will be filtered based on the selected type of provider. For example, you will only see templates residing on Red Hat
Providers, if the Catalog Item Type is Redhat.
5. In the Basic Info subtab: a. Type a Name/Description.
b. Check Display in Catalog to edit Catalog, Dialog, and Entry Point(NS/Cls/Inst) options.
i.
Provisioning Entry Point (NS/Cls/Inst) requires you to select an Automate instance to run upon provisioning.
ii. Retirement Entry Point (NS/Cls/Inst) requires you to select an Automate instance to run upon retirement.
61
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
Note
You can only choose from the catalogs and dialogs you have already created. If you haven't done so, leave the values blank and edit later.
6. In the Details subtab, write a Long Description for the catalog item.
7. In the Request Info subtab, select provisioning options that apply to the provider chosen. For more information, refer to the sections on
Provisioning Virtual Machines and Provisioning
Instances.
8. Click Add.
6.3.3. Service Dialogs
6.3.3.1. Service Dialogs
When provisioning a service, input will be needed from the requester. Service Dialogs are used to take input from the user. This input is connected to a method in the Automate model that defines how the users input is translated into the provision request. Before creating a
Service Dialog, be sure to plan what items you need the user to input.
6.3.3.2. Adding a Service Dialog
Procedure 6.2. To Add a Service Dialog
1. Navigate to Automate → Customization.
2. Click the Service Dialogs accordion.
3. Click (Configuration), and then (Add a new Dialog).
4. In Dialog Information, type in a Label and Description. Check the boxes for the buttons you want available at the bottom of the dialog form. The description will appear as hover text.
5. Click Add.
6. Select the dialog you just created.
7. Click (Configuration), and then (Edit this Dialog).
8. Add a tab to the dialog.
a. Click (Add), then (Add a New Tab to this Dialog).
b. Type in a Label and Description for this tab.
9. Add a box to this tab.
a. Click (Add), then (Add a New Box to this Tab).
b. Type in a Label and Description for this box.
10. Add an element to this box. Elements are controls that accept input.
62
Chapter 6. Catalogs and Services a. Click
(Add), then (Add a New Element to this Box).
b. Type in a Label, Name, and Description for this element.
Important
Name must use only alphanumeric characters and underscores without spaces. It is also used to retrieve the value of this element in the method used with the dialog and must start with
dialog_service_type
c. Select a Type for an element type. All Type options have a Required and Default
Value field. Check Required or set Required to true if the element is required to proceed. You can also specify a default value. The rest of the options presented are based on which type of element you select.
Table 6.1. Element Types
Element Types
Check Box
Date Control
Date/Time Control
Drop Down Dynamic List
Drop Down List
Radio Button
Tag Control
Text Area Box
Text Box
Additional Info
Check Default Value if you want this check box checked by default.
Use Date Control to create a field where users can select a date. If you want users to be able to select a date and time, use the
Date/Time Control option.
Use
Date/Time Control to create a field where users can select a date and time.
Only one Date Control or Date/Time
Control element can be present in a dialog.
Use
Drop Down Dynamic List if you want the list options to be created using automate methods. Use
Entry Point
(NS/Cls/Inst) to select an automate instance. Check
Show Refresh Button
to allow users to refresh the list options manually.
Use Drop Down List to create a list of options for the user to choose from.
This element type serves the same purpose as
Drop Down List but displays options using radio buttons.
Select a
Category of tags you want assigned to the virtual machines associated with this service dialog. Check
Single
Select if only one tag can be selected.
Provides text area for users to type in some text. You can also leave a message to users by typing in the Default Value field or leave it as blank.
This element type serves the same purpose as
Text Area Box with the option to check Protected so the text is shown as
63
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide asterisks (*), instead of plain text.
11. Click Save.
6.3.4. Methods
6.3.4.1. Creating a Method to Associate with the Dialog
You will need to create a method that connects the values in the dialog with the provisioning request. The method should be created in the Factory/Service class of the Automate model. A method is provided below that was created for the following scenario:
You want to provision a 3-tiered Service that contains catalog items of web, app and DB. Each of these virtual machines (or cloud instances) has been tagged under the Service category with the appropriate value. Then, added as a catalog item and combined into a catalog bundle.
The Service Dialog captures the selection of small, medium or large application in a dropdown called
service_type. When referring to a value captured in an element in a dialog, the name of the element should be prefixed with dialog_. For example, service_type becomes
dialog_service_type when used in the method.
The method will set the memory sizes for each of the catalog items based on the
service_type
selection.
#
# ManageIQ Management Engine Automate Method
#
$evm .log( "info" , "ManageIQ Management Engine Automate Method
ConfigureChildDialog Started" )
#
# Method Code Goes here
#
$evm .log( "info" , "===========================================" )
$evm .log( "info" , "Listing ROOT Attributes:" )
$evm .root.attributes.sort.each { | k, v | $evm .log( "info" , "\t #{ k } : #{ v } " ) }
$evm .log( "info" , "===========================================" ) stp_task = $evm .root
[ "service_template_provision_task" ]
$evm .log( "info" , "===========================================" )
$evm .log( "info" , "Listing task Attributes:" ) stp_task.attributes.sort.each { | k, v | $evm .log( "info" , "\t #{ k } : #{ v } " ) }
$evm .log( "info" , "===========================================" )
#############################################################
#### This is how the method would look for dialog variables
############################################################# dialog_service_type = $evm .root
[ 'dialog_service_type' ]
$evm .log( "info" , "User selected Dialog option = [ #{ dialog_service_type } ]" ) stp_miq_request_task = stp_task.miq_request_task
#$evm.log("info","(parent) miq_request_task: = [#{stp_miq_request_task}]")
#############################################################
#### This is how you get the catalog items for the catalog bundle
############################################################# stp_miq_request_tasks = stp_task.miq_request_tasks
#$evm.log("info","(children) miq_request_tasks count: =
[#{stp_miq_request_tasks.count}]")
64
Chapter 6. Catalogs and Services
#############################################################
#### By going through the children, you can set the dialog variable for each of the children (we based our values on the childrens service tags)
############################################################# stp_miq_request_tasks.each do | t |
$evm .log( "info" , " Setting dialog for: #{ t.description
} " )
service = t.source
service_resource = t.service_resource
#$evm.log("info"," Child service resource name:
#{service_resource.resource_name}")
#$evm.log("info"," Child service resource description:
#{service_resource.resource_description}")
service_tag_array = service.tags( :app_tier )
service_tag = service_tag_array.first.to_s
memory_size = nil
#############################################################
#### The dialog_service_type is the attribute set on the service dialog
#### We use the service_tag to decide what child gets what dialog
############################################################# case dialog_service_type when "Small" case service_tag when "app"
memory_size = 1024 when "web"
memory_size = 1024 when "db"
memory_size = 4096
else
$evm .log( "info" , "Unknown Dialog type" ) end when "Large" case service_tag when "app"
memory_size = 4096 when "web"
memory_size = 4096 when "db"
memory_size = 8192
else
$evm .log( "info" , "Unknown Dialog type" ) end
else
$evm .log( "info" , "Unknown Dialog type - setting Dialog options here" ) end
#############################################################
#### set_dialog_option sets the dialog for the child
#############################################################
t.set_dialog_option( 'memory' ,memory_size) unless memory_size.nil?
$evm .log( "info" , "Set dialog for selection: [ #{ dialog_service_type } ]
Service_Tier: [ #{ service_tag } ] Memory size: [ #{ memory_size } ]" ) end
#
65
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
#
#
$evm .log( "info" , "ManageIQ Management Engine Automate Method
ConfigureChildDialog Ended" ) exit MIQ_OK
6.3.4.2. Creating a Method in the Factory/Service Class
Procedure 6.3. To Create a Method in the Factory/Service Class
1. Navigate to
Automate → Explorer.
2. Click the
Datastore accordion, and select a Factory → Service class.
3. Click the
Methods tab.
4. Click
(Configuration), then (Add a New Method).
5. Type in a
Name and Display Name.
6. In the Data field, type in the method contents.
7. Click Validate and wait for your data entry to be successfully validated.
8. Click Add.
6.3.4.3. Creating an Instance in the Factory/Service Class
Procedure 6.4. To Create an Instance in the Factory/Service Class
1. Navigate to Automate → Explorer.
2. Click the
Datastore accordion, and select a Factory → Service class.
3. Click the
Instances tab.
4. Click
(Configuration), then (Add a new Instance).
5. Type in a
Name and Display Name.
6. In the
Fields area, type in the method's name in Value.
7. Click Add.
Result:
The instance is created so that it can be called from the ServiceProvision class.
Note
After the method has been created, it must be mapped to an instance in the
Factory/StateMachines/Service Provision State Machine class. The name of the instance must be specified as the Entry Point. This method must be called before the provision job begins.
66
Chapter 6. Catalogs and Services
6.3.4.4. Associating a Method with an Automate Instance
Procedure 6.5. To Associate the Method with an Automate Instance
1. Navigate to Automate → Explorer.
2. From the accordion menu, click Datastore → Factory → StateMachines → Service
Provision State Machine class.
3. Either create a new instance or select the clone_to_service instance.
4. Click (Configuration), then (Edit Selected Instance).
5. In the
configurechilddialog value, put the path to the method.
6. Click
Save or Add if you are adding this to a new instance.
Result:
Now that the catalog items, service dialog, dialog methods, and service provision instance have been created, you can create the catalog bundle.
6.3.4.5. Creating a Catalog Bundle
Procedure 6.6. To Create a Catalog Bundle
1. Navigate to Services → Catalogs.
2. Click the
Catalog Items accordion.
3. Click
(Configuration), and then (Add a New Catalog Bundle).
4. In
Basic Info, type in a name and description
5. Click
Display in Catalog.
6. Select the appropriate dialog name.
7. Select the path to the appropriate Automate/Factory/StateMachines/ServiceProvision instance.
8. Click on the Resources tab, then select the catalog items you want added to the bundle from the
Add a Resource dropdown.
9. Click Add.
Result:
A catalog bundle is created and visible in the
Service Catalog accordion.
67
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
Note
You should also create and specify an Entry Point in the Factory/StateMachines/Service Provision
State Machine class for each catalog item that is part of a bundle. If you do not, then the pre and post provision processing will occur for each item in the bundle in addition to processing for the
Catalog Bundle. To set the entry point, go into each Catalog Item and check Display in
Catalog. Then, you will see the Entry Point field.
6.3.4.6. Provisioning a Service
Procedure 6.7. To Provision a Service
1. Navigate to Services → Catalogs.
2. Click the Service Catalogs accordion, and select the service to provision.
3. Click Order. The dialog appears.
4. Select the options in the
Service dialog.
Result:
The parameters are passed to the children based on the method tied to the choices made in the dialog.
68