currently I am trying to deploy a VM from one blueprint on vRA 7.3 where I am able to select applicable networks during request.
Made up easy, my setup looks like this:
- I have two independent vCenters that are not linked
- I have a Windows template in both vCenters that are exactly the same and also have the same name
- I have several networks within each vCenter with different names
- In vRA I configured network profiles for each network
- In vRA I configured a reservation policy for each vCenter
- In vRA I configured a reservation for each vCenter and applied the network profile to each available network and applied each vCenter its own reservation policy
- In vRA I configured just one Blueprint and left the reservation policy empty
- In vRA I created the custom property VirtualMachine.Network0.Name linked to the script action com.vmware.vra.networks/getApplicableNetworks as external value and attached it to my blueprint
- In vRA I created a custom property __ReservationPolicyID linked to the script action com.vmware.vra.reservations/getApplicableReservationPolicies and attached it to my blueprint
So far so good,
now during a new request I am able to select by dropdown a reservation policy to place the new VM either in vCenter A or B. But on the network selection dropdown I am getting displayed all networks from all reservations within the user's current business group. So I checked the code of the script action com.vmware.vra.networks/getApplicableNetworks and it does exactly that :)
What I want to do is modify this script action, so it does only return the networks from the reservation policy currently selected in the request. As I have a reservation policy for each vCenter and each reservation is bound to one of those policies, I would end up with only the networks from one vCenter getting displayed.
The problem is, that I do not know how to modify the code to achieve this :/ I couldnt figure out what the objects/variables look like in the code or which methods are availabe and what they actually do :( I am also looking for some kind of API or Documentation.
//For example: what is returned in to the variable and what does it look like? How can I filter the reservations to only get the one matching the selected one in the request?
var reservations = System.getModule("com.vmware.vra.reservations").getReservationsForUserAndComponent(user, tenant, host, blueprint, component);