VM provision - VMware template issue


I have encountered a peculiar issue on PXE provisioning using VMware template. I have created a VMware template (A) which I had defined Network adapter 1 with Network label, say “NW_A”. I then cloned that VM template to create another VM template (B) but changed the Network label to “NW_B”.

I then created different service catalogs that linked to VMware template A and B separately. For some reasons, I am creating those to interface with different PXE servers and the different network port groups (i.e. NW_A and NW_B) were used for acquiring IP addresses from two different DHCP servers.

However, VMs that provisioned with template B always associated to NW_A instead of NW_B. When I looked into miq_request_tasks table, I could see that ":src_vm_lans"did contain “NW_B”.

I am also confused with the relationship between miq_requests and miq_request_tasks. When I looked into miq_requests table, it seemed to me that I only see that ":src_vm_lans"only contains “NW_A”.

I would appreciate if someone can shed some light into those. Thanks.



Let me first explain the relationship between MiqRequest and MiqRequestTask.

When a provision request is created through any entry-point (UI, Rest API, Automate) the first thing that is created is the MiqRequest object. Once this object is approved the MiqRequest is copied to the MiqRequestTask object. The task object si the one processed in the automate state-machine and modified/updated with values specific for the VM being created. For example, the name of the new VM would only be stored in the task or the auto-placement values selected for this VM.

The field :src_vm_lans you referencced is only used by the workflow to record the LANs associated with the VM. Which happens here: app/models/miq_provision_virt_workflow.rb#L131. The :src_vm_lans value is not used during provisioning.

The value you need to look at in the task options is the :vlan key. This is the field defined in the dialog on the Network tab: product/dialogs/miq_dialogs/miq_provision_vmware_dialogs_template.yaml#L656

The :vlan key is the one used during provisioning here:

It sounds like you need to determine where this key is being modified.

Hope this helps.

1 Like