Modify number_of_vms for Items in a Catalog Bundle


#1

Hi,

I’m using Catalog Bundles to provision a series of VMs - all went well, but I’m stuck in modifying number of VMs for the Items. i.e.:

Bundle1 has two resources, Item1 and Item2. What I’m trying to achieve is to let the user select number of vms to be provisioned for each of Items, like 2 of Item1 and 3 of Item2.

This has been discussed before [1], and the recommendation was to set it before the request is approved - but I’ve had no luck setting number_of_vms property for child objects in

/Service/Provisioning/StateMachines/ServiceProvisionRequestApproval/validate_request

Has anybody tried a similar scenario? Any pointerswill be great…

[1]

Thanks,

Ekin Meroglu


#2

Hi

This is a challenge because the :number_of_vms option is effectively ‘baked into’ the miq_provision_request_template that is created when the Service Catalog Item is created.

The best way to achieve what you want is to create your own ‘Generic’ Catalog Item that creates its own provision requests using $evm.execute(‘create_provision_request’). When you do this you have complete control over the requests, including :number_of_vms for each.

Kevin Morey has some excellent examples is his code collection here: https://github.com/ramrexx/CloudFormsPOC/tree/master/Automate/CloudFormsPOC/Service/Provisioning/StateMachines (any of the *_build_vmprovision_request methods), and there’s a description of using/adapting Kevin’s code here: https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/chapter17/custom_state_machines.html

Hope this helps,
pemcg


#3

Hi Peter,

Thanks for the detailed explanation… I found the chapter you wrote after posting here - but it seems I need to study it a little bit more to fit in my catalogs and workflows.

btw, let me thank you for the amazing work you’ve done - your book literally saved my day more than once, and I can surely say it is the most extensive source of information on CloudForms automate. Thanks again.


Ekin.