Provisioning vm with host and datastore


is possible add a new item (host and datastore) in this pic?

I tryed with “host_vmware” and “set_storage”


Try with placement_host_name and placement_ds_name (see Automation/Automate/Customization/Provisioning Dialogs/All Dialogs/VM Provision/Sample VM Provisioning Dialog (Template) for hints).
Both are arrays with values like [2, "Name"]

1 Like

Hi! I tryed with your item. This is the result

Server [EVM] Service [prueba] Step [checkprovisioned] Status [Error Creating Service] Message [[MiqException::MiqProvisionError]: Destination placement_host_name and placement_cluster_name not provided]

Service Provision Error: Server [EVM] Service [prueba host] Step [checkprovisioned] Status [Error Creating Service] Message [[EVM] VM [V1128SCP619] Step [CheckProvisioned] Status [Error Creating VM] Message [[MiqException::MiqProvisionError]: Destination placement_ds_name not provided] ]


I found something for you. Correlation with the Provisioning Dialog has a sample of Host Name option:

request.options[:placement_host_name] = [1000000000001, ""]

You won’t be able to read such an array directly so will need to do some automation coding. Section Set Methods explains that this key can be set by the request.set_host method which expects a service model object. There is also an example how to create such an object at the end of the section (see cloud_network).
So use something like (assuming the dialog element names are hostname and storage):

request = $evm.root['miq_provision_request']
host = $evm.vmdb(:host).find_by_name(dialog_hostname)
unless host.nil?
storage = $evm.vmdb(:storage).find_by_name(dialog_storage)
unless storage.nil?

You’ll need to create your own instance of Service Provisioning State Machine to call your code and customize the request with the dialog options. It is also recommended to create a dynamic dropdown for these dialog elements.

See also topic Passing arrays into dialog_parser for further explanation.