Setting Disk and Memory properties of VMs using vRA custom forms – Part 1

Requirements

During my last project, the customer asked me if it was possible to use vRA custom forms to change the default appearance of the memory and disk input fields for a machine blueprint. They wanted to achieve two things:

  1. Allow users to input the Memory size in GB without having to display the value in MB on the form
  2. Allow users to change the size of the additional drives which are added to a SQL blueprint during provisioning without being prompted to review or set the other disk related properties

To keep their design simple they did not want to use XaaS blueprints. They also did not want to change the machine blueprint configuration since in some instances the underlying vSphere template is shared between Windows and SQL catalog items. Custom forms were already being trialled with the use of additional input values through custom properties for IaaS provisioning. The customer felt the custom forms approach provided users with a friendly simple request form, as they did not have to deal with the deployment and VM sections both displaying. They also wanted to hide the values that are preconfigured, or restricted and could not be changed, such as the number of instances to prevent confusion.

This post covers the steps performed to meet the first requirement related to the Memory input.

Memory in GB Solution

With users being asked to enter a value in GB, we needed the ability to convert the entered value into MB, since this is the format vRA expects to use.

vRO Action configuration

Using vRO we created a new action named memoryToMB and set the return type to number, as the default Memory input field is an Integer value which maps to the number type in vRO. A single input parameter was added to the action, named memoryInGB, and set to the type number.

For the script of the action, a single line of code is all that is needed.

return (memoryInGB*1024);

This converts the entered value into MB by multiplying it by 1024, and then returns it. The final action looks like the screenshot below:

vRA Custom Form configuration

Now that we had a way of converting the Memory value we needed to configure the vRA Custom Form so that users can enter the required amount of Memory. This was achieved by adding a new integer field onto the Custom Form named Memory in GB and setting default, minimum and maximum values. This is the field that would be visible to end users on the form at request time.

With a new input field configured we could now change the visibility value for the default Memory input field to No, hiding it from the end users at request time.

The final step was to connect the new Memory in GB field with the default Memory (MB) input field, to ensure that the entered value is configured on the provisioned VM by vRA.

This was achieved by setting the default Memory (MB) field to use an external source, so that it executes a vRO action to populate its value. Selecting the new action and binding the single input to the Memory in GB field on the form, the final configuration for the default Memory input field looks like the screenshot below.

After activating the Custom Form, placing a new catalog request in vRA the end user was now presented with a friendly form showing only a single memory input field, which takes the value in GB. A default value was assigned so that the vRO action to convert the value to MB would not generate an error due to an empty input value when the form loads. While the end user does not see the default memory input field, its value is populated with the equivalent requested memory value in MB by the vRO action. When submitted this is the value that vRA uses to provision the VM, ensuring the VM is created with the correct amount of assigned memory.

In part 2 I’ll cover the configuration used for the disk properties.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close