Cloudforms vmware provisioning

Hi all, We have in cloudforms a catalog item to provision vmware machines. It creates the virtual machine but the problem is that always provision it at the same datacenter, cluster and template despite not selecting the default values in our custom dialog.

Note: In rhv virtualization as explained here it’s working:
rhv state machines

Let me explain it a little better:

This is the service catalog:

This is the catalog item:

Always creates the virtual machine on VMW_DC_01 datacenter and VMW_DC_01_CL_LC_Linux_01 cluster.

Do you know why? It looks like the service dialog populates the right info inside the dropdown menus but not passing them to provisioning template?

Is this for wrong names in the dropdowns? Is there any name convention?

Thank you very much,

Hi again, nobody knows why the vmware virtual machine is being created with the default dialog parameters?

If you haven’t already, I would highly recommend to read Peter McGowan’s book, espacially Part 2 as it goes into a lot more detail on how VM provisionings work

I guess the problem is, that you haven’t enabled “Choose Automatically” and it therefore just uses the values from the CatalogItem > RequestInfo configuration.
If you choose automatic placement, ManageIQ seems to try to match a couple of tags on the Catalog Item with tags on the host and select the least utilized host.
I haven’t seed an easy override option to select the cluster from the dialog (though I haven’t seen that in the RHV code repo you have posted either)

Unfortunately we use a completely different placement, so I have no idea how this is supposed to work in a default ManageIQ environment.

In general, if you start from a Catalog Item, you are provisioning 2 things simultaneously. First a Service-Object (this is a ManageIQ internal object, similar to a folder) and a VM.
The Service Provisioning StateMacine starts at /Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization and once it hits the “Proivision”-step starts the actual VM provisioning StateMachine as a sub-task

If you want to customize placement, take a look at the StateMachine in /Instrastructure/VM/Provisioning/StateMachines/VMProvisioning_VM/template. This is the StateMachine that manages the actual VM provisioning.
The “Placement”-step calls /Infrastructure/VM/Provisioning/Placement/default#vmware, which ends up calling vmware_best_fit_least_utilized

You want create a new method that does something similar to this (but more robust):

cluster = $evm.vmdb(:ems_cluster).where(name: $emv.root['dialog_vmware_cluster']).first
host = cluster.hosts.shuffle.first

I guess you figure something out using the book and the examples in the ManageIQ and RedHat domains. Just keep in mind, that the Workflow has a lot of moving parts and spend some time understanding what is happening in the background. Ideally you are ok with changing a couple of methods

1 Like

Hi buc, thanks for your great answer. Let me tell you where I am right now and explain it a little bit hoping to help someone else.

From Services > Catalogs > Calog Items > Request Info I have to select inside the enviroment tab: Choose automatically placement.
If you do this, then from our service dialog we have to override the datacenter, cluster and storage.
For knowing their respective names we have to search inside the template (miq_provision_vmware_dialogs_template.yml) and find the environment tab. There, we have to “guess” the right names, for example for datacenter i realize that the right name to override in the service dialog is “placement_dc_name”, for cluster is “placement_cluster_name”, for storage is “placement_ds_name”.

When I provision a vmware virtual machine from service dialog, it places the vm in the selected datacenter, cluster and storage.

What I’m still not able to override is the template. In Services > Catalogs > Calog Items > Request Info there is a tab called catalog where one of the required parameters is the template name. I want to override this setting with my service dialog! I discovered the parameter associated inside the yml template is called src_vm_id and I’m able to override it from my service dialog but at the end of the provisioning process is using the selected Services > Catalogs > Calog Items > Request Info > Catalog TEMPLATE :frowning:

I ended up here: Overriding Service Template VM Template? but I want to avoid using a generic type instead of using the vmware type. One of the comments say he has been able to override the template setting the parameter :sysprep_custom_spec but I cannot find this parameter.

Parameters I find that look promising are :sysprec_spec_override and :placement_auto

Any of you can help me with override the selected template?

With my service dialog template:


Thanks for your help,

I am not sure if ServiceTemplates are the right tool for the job.

ServiceTemplates are meant to provide preconfigured Services tailored to your environment. For example you might have a Service “MyPostgres”. And if someone want a Postgres database they can order the ServiceTemplate, enter a name and the rest is done by ManageIQ. ManageIQ knows that it should clone a specific VmTemplate, which cluster or datastore it should select and so on.

If you want to basically recreate the “New Virtual Machine” dialog in VMware, you should use a VM provisioning dialog Automation > Automate > Customization > Provision Dialog To create a new VM with it, go to Compute > Infrastructure > VirtualMachines > Livecycle > Provision VMs

Just in case: The override options are listed here

Back to the question:
You cannot easily change the VmTemplate in a (VMware) ServiceTemplate. You may be able to do it while you are in the miq_provision_request phase, but certainly not after you enter the miq_provision_task.

It is easier to create a Generic ServiceTemplate, figure out which template you want to provision from and create a provision request programatically

The Post you mentioned is about the (linux) sysprep_custom_spec not being compatible with the (windows) VmTemplate selected. I am not sure if xyker did change the VmTemplate with a dialog option or reconfigured the Catalog Item manually.