Dynamic Reservation Selection in vRA7 | Writing about tech and anything else I find interesting

Dynamic Reservation Selection in vRA7

A common question that comes up is whether or not you can select a reservation at request time with vRealize Automation. In previous versions this was pretty clunky, but in 7 it is now pretty straightforward to setup.

Before we tackle the “how” let’s look at a couple of concepts quickly.

Reservations

This figure shows us a few things – the relationships between the various elements, and also why this kind of request is common. Reservation Policies are a means of ensuring that reservations with similar characteristics can be related. This is important, as without this mechanism you would be trying to tie a Blueprint to a single Reservation, which would limit it’s use to a single Business Group.

By default, your blueprint (or more specifically the components thereof) are associated with a single Reservation Policy.

So, without further ado let’s look at how we can change that.

We’re going to be making use of the __ReservationPolicyID Custom Property, but before creating it we need to get a couple of GUIDs. For this, I like to make use of Firebug, though if you’re handy with the API you could get it that way.

The Firebug method is to login to the browser and open the Reservation Policy tab (you’ll need Fabric Administrator rights for that). Grab the appropriate GUID value from the API call that you catch and paste it somewhere useful.

2016-02-12_22-03-33

If you don’t want to install Firebug, you can do the same thing with curl.

To authenticate, do use the following command:

curl --insecure -H "Accept: application/json" -H 'Content-Type: application/json' --data '{"username":"username","password":"password","tenant":"tenant"}' https://vra-fqdn/identity/api/tokens/

Once you’ve authenticated, run the following, using the token value you got back from the previous command.

curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://vra-fqdn/reservation-service/api/reservations/policies/

The Custom Property that you will be using is call __ReservationPolicyID. To create it, you need either Tenant Administrator or Fabric Administrator rights (Tenant Admin can create properties for the tenant they administer, while Fabric Administrators can create them system wide for all tenants).

The Property Definitions tab has moved over to the Administration tab, so don’t waste too many hours searching for it under Infrastructure like I did!

Create a new property per the screenshot below, although this should be mandatory as opposed to what I’ve done.

You’ll notice that when defining your Predefined Values, there is both a name and a value. This is one of those nice little features that don’t make it into slide decks because they aren’t amazing – however it is really, really useful. The “name” is what your users will see when they click the dropdown, while the “value” is what is used by vRA. This will be used a lot I suspect!

2016-02-12_22-10-24

Create a Property Group with your Property Definition included so that you can easily enable it on multiple blueprints – I called mine “Reservation Selection”.

The final step is to apply the Property Group to your Blueprint components. One caveat here – you need to not set a Reservation Policy on your Blueprint components or this will fail.

2016-02-12_22-16-34

Login as an a user, and request your Catalog Item, and voila!

2016-02-12_22-20-30