vRA Developer: Part 8 – Working with vCAC Reservation Storage


In my previous post, I covered working with vcac reservations and provided examples of how you can retrieve property values and also linked entities, such as networks and virtual machines. In this post I am going to cover reserved storage. I planned to include this in the previous post, but the content was becoming too large, so I decided to split them.

The Actions provided here should be useful if you ever need to work with storage outside of vRA (for example, when adding or resizing a virtual hard disk directly in vCenter) and can be used to query reservation information first. This can prevent cases where storage can exceed that which is allocated/reserved for the tenant.

Here is how the reserved storage looks for the reservation that I will be working with:

All code that I have provided or talked about in this post can be downloaded as a vRO package for your consumption here.

I have also included a number of workflows in the package, which provide examples of these actions being used.

You can find these under ‘Simplygeek -> Library -> Common Workflows -> vRealize Automation -> Examples -> Reservations

Get Reserved Storage Information

The following sections provide vRO Actions that can be used to get information about storage that has been reserved in a reservation or get details of physical capacity.

Get Storage Reserved Capacity for a Reservation

The following action accepts a storage path and the reservation entity and will return the total amount of storage that has been reserved for the reservation.

Log output:

Get Storage Reserved Capacity Used for a Reservation

The following action accepts a storage path and the reservation entity and will return the amount of reserved storage capacity that has been used for the reservation.

Log output:

Get Total Physical Storage Capacity

The following action accepts a storage path and the reservation entity and will return the total amount of physical storage available.

Log output:

Get Free Physical Storage Capacity

The following action accepts a storage path and the reservation entity and will return the amount of free physical storage available. This is useful if reservations are heavily oversubscribed making it difficult to determine if the physical layer has free storage available.

Log output:

Update Reserved Storage for a Reservation

The following code will allow you to change the amount of storage that has been reserved in a reservation, for a given storage path/datastore.

Log output:

This action won’t attempt to update the reservation if the value being set is the same as what is currently configured and will display this output in the log:

That concludes this section on vcac reservations. In my next post I am going to focus on compute resource and storage entities.

I hope this has been useful. If you discover bugs with any of my code, require some help or simply need an ad-hoc solution, then please drop me a message via the Drift app.

Please rate this post!

Average rating / 5. Vote count:

Leave a Reply

avatar
  Subscribe  
Notify of