Quantcast
Channel: VMware Communities : All Content - vRealize Automation Tools
Viewing all articles
Browse latest Browse all 9859

Looking for confirmation on something. Anyone game?

$
0
0

Ok this is my scenario.  I started out with 1 fabric group and circled back to create multiple fabric groups for the different datacenters that I have.  So one I created the fabric groups and added the compute resources, I then removed the compute from the original fabric group, which left the resource only in the new fabric group.  I have a script that I use as an action to get the reservation polcies in the blueprint form.  See below for script.  Long story, short the script stopped working when I removed the resources from the original fabric group.  If I understand things correctly, I do not see why this action would stop working when switching to a different fabric group that I have full permissions to.  If anyone can explain any flaws in my logic, I am all ears.  If not, and you have some time to place.  Would you please take the script and create an action and present that action as a property definition, add to a blueprint and see if the action continues to work when you switch to a different fabric group.

 

Thanks

 

 

::::::SCRIPT::::::::

 

 

 

 

 

var blueprint = System.getContext().getParameter("__asd_composition_blueprintId");

var component = System.getContext().getParameter("__asd_composition_componentId");

var user = System.getContext().getParameter("__asd_requestedFor");

var tenant = System.getContext().getParameter("__asd_tenantRef");

 

 

var host = vCACCAFEHostManager.getDefaultHostForTenant(tenant , true);

var reservationPolicyService = host.createReservationClient().getReservationReservationPolicyService();

 

 

var reservations = System.getModule("com.vmware.vra.reservations").getReservationsForUserAndComponent(user,tenant,host, blueprint, component);

 

 

// get reservation filtered by reservations

var reservationPolicyFilter = getReservationPolicyFilterForReservations(reservations);

var reservationPolicies = [];

if (reservationPolicyFilter) {

reservationPolicies = reservationPolicyService.getAllReservationPolicies(reservationPolicyFilter).getContent();

}

 

 

var reservationPolicyProperties = new Properties();

for each(var reservationPolicy in reservationPolicies) {

reservationPolicyProperties.put(reservationPolicy.getId(),reservationPolicy.getName());

}

return reservationPolicyProperties;

 

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function getReservationPolicyFilterForReservations(reservations) {

var query = new vCACCAFEOdataQuery();

 

 

var queryParams = [];

for each (var reservation in reservations) {

queryParams.push(vCACCAFEFilterParam.equal("id" , vCACCAFEFilterParam.string(reservation.getReservationPolicyId())));

}

 

 

if(queryParams.length > 1) {

query.addFilter([vCACCAFEFilterParam.or(queryParams)]);

} else if(queryParams.length == 1){

query.addFilter(queryParams);

} else {

return null;

}

 

return new vCACCAFEPageOdataRequest(1 , 2147483647, query);

}


Viewing all articles
Browse latest Browse all 9859

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>