The more VMware PSO engagements I work with, the more interesting use cases and requirements I gather from our customers which drive me to write and share for the sake of helping others.
In a recent vRA design engagement where compute/storage resources are assigned on a customer’s project basis, a reservation is created to designate the resources needed for the project. A user working on several projects should be able to select the reservation which the requested VM should consume resources from. This approach will help the IT department to assign a complete pool of resources for a specific project for a department and perform the billing accordingly.
They requested to have a drop down menu that allows the user to select from a list of available projects during run time. The solution was to create reservation policies for each reservation (project) and find a way to show this list to the consumer to select from during request time from the portal.
The below post demonstrates how to add a drop down menu that will dynamically retrieve reservation policies by user context. This means that it retrieves reservation policies for the requesting user only. If you submit a request on behalf of another user, the reservation policies are for you. For example, Reservation 1 and Reservation 3 are associated with Business Group 1, so the BG1 users see only Reservations 1 and 3, not 2.
The steps to achieve this are detailed below:
Create Custom Property
Login to your vRA tenant administration portal with a user that has the Fabric Administrator assigned role. Navigate to Administration tab -> Property Dictionary ->Property Definitions.
Click New to create a custom property in property definitions (Data type: string, Display as: dropdown, values: external).
Click Select and choose the getApplicableReservationPolicies VRO script action available in the action folder com.vmware.vra.reservations. This is available as an OOTB script action starting with vRA/vRO 7.x. Click OK.
Click OK to create the custom property.
Add Custom Property to your Blueprints
Navigate to Design tab -> Blueprints. Select your blueprint and click Edit.
Navigate to Properties -> Custom Properties. Click New to add your custom property (Encrypted: No, Overridable: Yes, Show in Request: Yes). Click Finish.
Check the Reservation Policies Drop Down Menu in action
Login to your self-service vRA portal as a business group consumer. Navigate to Catalog tab to request a service.
You can see the dropdown menu which displays the reservation policies by user context. The user will select a project and click Submit to process the request (VM Provisioning).
Hope this post is informative,
Thanks for reading,
Mohamad Alhussein