Enable extended IP address selection for VMware VMs

You can offer a requester the choice of IP address for the requested VM from an IP address pool on an external system.

Before you begin

Role required: cloud_admin, vmware_operator

About this task

You can offer the choice of IP address when a provisioned VM is being customized through guest customization and is being configured with a static IP address.

Procedure

  1. Create a customization specification as described in the related links. Perform the following additional steps while creating the customization specification:
    1. In the Network section, for Configure networking through, select IP Pool.
    2. The system uses the IP Pool field to select the pool using the IP pool tables in the base system. Leave the IP Pool field blank.
    3. Click Update to save the specification.
  2. Open the VMware catalog item to customize and then select the Apply guest customization check box.
  3. For Customization Specification, select the specification that you created in the earlier steps.
    Note: Alternatively, you can use a provisioning rule to select the customization specification.
  4. Define the workflow logic that selects the IP address -- the IP selection workflow.
    The workflow that you create is called as a subflow from the VMware VM Provision workflow and can take any inputs that can be passed from VMware VM Provision. For example, the subflow can take the sys_id of the VMware network that was selected by provisioning rules. The subflow can also take requester answers at request time because VMware VM Provision takes as input the sys_id (sc_req_item) of the request item record so you can look the actual record up and access its variables object. The subflow must return a JSON string that represents an object with the following fields:
    • status: Success or failure.
    • ip: String version of the IP address to assign to the VM.
    • netmask: The netmask for the network that the IP is on.
    • dns: The IP address of the DNS server.
    • dns2: Optional: The IP address of a secondary DNS server.
    • gateway: The gateway for the network that the IP is on.
    • error_message: Optional: To add a failure message, add a field called error_message with a string value that describes the failure.

    For example: {"status": success", "ip": "10.0.10.55", "netmask":"255.255.255.0", "dns":"10.0.10.15", "dns2":"8.8.8.8", "gateway":"10.0.10.1"}

  5. Cause the VMware VM Provision workflow to call the IP selection workflow by updating an extension point.
    For the extension point in the table vm_extension_point with key VMWareNetworkSelectionSetup, replace the workflow.scratchpad.networkSelectionWorkflow object with your object that contains:
    • name: the name of the subflow that you created.
    • inputs: a Javascript object with name:value pairs that represent the inputs to pass to the subflow.
  6. Update an extension point with information on releasing the IP address when the VM is terminated.
    In vm_extension_point, there is a key VMWPostProvision with a description of Set up ip. Update the script to: current.ip_address = workflow.scratchpad.provisionResult.ip; The base system script attaches the provisioned VM record to the record in the base system IP Pool table. Because you are replacing the selection logic and not using the base system IP Pool table, you must remove this logic, but the IP address to be set on the VM instance must remain (so the system knows which IP address to release when the VM is terminated).
  7. Define the logic that releases the IP address -- the IP address release workflow.
    The workflow that you create is called as a subflow from the VMware Termination workflow and can take any inputs that can be passed from VMware Termination. The return should be a JSON string with a key of status and a value of success or failure. For example, {"status":"success"} or {"status":"failure"}.
  8. Cause the VMware Termination workflow to call the IP release workflow: Modify the extension point in vm_extension_point with key VMWareReleaseIPWFSelection to point at the IP address release logic subflow that you created.