Czernobog
Expert
Expert

vRA 7.2 - vRO 7.2 - loading all CAFE VMs with Server.findAllForType not working on bigger groups

Hi,

I'm one emmbeded vRA 7.2 Orchestrator instance. I've configured a few Cafe Hosts and try to query them vor VMs.

For my workflow I need to load all VMs in the system. I did this so far with

var vCACCAFEVMs = Server.findAllForType("vCACCAFE:CatalogResource");

However, this does not seem to work with one hosts, where about 140 VMs are placed. Smaller Hosts, where about 10 VMs are laced currently, are loading the VMs fine.

When I try to check on the VMs in the plugin directly (under the vRA Hosts), after clicking on the "Items" folder no items are loaded.

Is there a way to efficienlty load all Cafe VMs in a short time? I found a quick workaround but it's taking about 15-20 minutes instead of 1-2 as it was previously...

Tags (2)
0 Kudos
7 Replies
qc4vmware
Virtuoso
Virtuoso

Do you see anything in the logs?  My first reaction is either paging of some sort or memory issues.  I've had to bump up the memory for vRO on all my embedded vRA deployments.

Czernobog
Expert
Expert

I'll try adding more memory to the embedded vRO in the morning, thanks for the tip; before I have used an external instance, that had 8GB RAM so that might actually be the origin of the issue.

0 Kudos
Czernobog
Expert
Expert

Increasing RAM for the service did not help, however I found the following Log entry:

[{com.vmware.csp.component.iaas.proxy.provider@resource.type.registration.name.Infrastructure.Machine}].} ) ( [Rest Error]: {Status code: 400}, {Error code: 42000} , {Error Source: null}, {Error Msg: Request was denied due to exceeded resource size limit. The maximum number of resources allowed is 100.}, {System Msg: Infrastructure service provider error: Request was denied due to exceeded resource size limit. The maximum number of resources allowed is 100.} )

Since the number of VMs I want to pull exceeds 100, I guess this would be the problem.

Is there a way to extend the limit?

Edit: The issue ist described here: https://kb.vmware.com/kb/2149013

The resolution does not apply to the findall methods though:/ Currently working on how to pull cafe VMs from the request...

Edit2: Here a small script I use to benchmark queries, I've modified it to include a cafe vm query under the new conditions:

System.log("Get all vCAC VMs start");

var entities = Server.findAllForType("VCAC:VirtualMachine");

System.log("Found items: " + entities.length);

System.log("Get all vCAC VMs stop");

System.log("Get all vCACCAFE VMs start");

var vCACCAFEVMs = Server.findAllForType("vCACCAFE:CatalogResource");

System.log("Found items: " + vCACCAFEVMs.length);

System.log("List incomplete due to API limitation - no cafe vms loaded when more than 100 are present: ");

System.log("Get all vCACCAFE VMs stop");

System.log("Get all vCACCAFE VMs by entity finder start");

System.log("Does not work because of the 100 items limit !!!");

// var vCACCAFEVMs = vCACCAFEEntitiesFinder.getCatalogResources(vCACCAFEHost);

//System.log("Found items: " + vCACCAFEVMs.length);

System.log("Get all vCACCAFE VMs by entity finder stop");

System.log("Get all vCACCAFE VMs by OData Query start");

// This method will include Deployments, as they are of the same type as vCACCAFE VM (CatalogResource)

var cafeHosts = Server.findAllForType("vCACCAFE:VCACHost");

var businessGroups = Server.findAllForType("vCACCAFE:BusinessGroup");

var vCACCAFEVMs = [];

for each (host in cafeHosts){

    service = host.createCatalogClient().getCatalogConsumerResourceService();

    for each (businessGroup in businessGroups){

        var filter = new Array();

        filter[0] = vCACCAFEFilterParam.substringOf("organization/subTenant/id", vCACCAFEFilterParam.string(businessGroup.id));

        var query = vCACCAFEOdataQuery.query().addFilter(filter);

        var odataRequest = new vCACCAFEPageOdataRequest(1, 10000, query);

        resources = service.getResourcesList(odataRequest);

        vCACCAFEVMs = vCACCAFEVMs.concat(resources);

        }

}

System.log("Found items: " + vCACCAFEVMs.length);

System.log("Get all vCACCAFE VMs by OData Query stop");

// Filter Deployments

var i = vCACCAFEVMs.length;

while(i--){

     if (vCACCAFEVMs[i].hasChildren == true) { vCACCAFEVMs.splice(i, 1) }

}

System.log("VM List length no Deployments: " + vCACCAFEVMs.length);

System.log("VM List no Deployments: ");

for each(vm in vCACCAFEVMs){

    System.log(vm.name);

    }

}

System.log("VM List length no Deployments: " + vCACCAFEVMs.length);

System.log("VM List no Deployments: ");

for each(vm in vCACCAFEVMs){

    System.log(vm.name);

    }

0 Kudos
balawiz
Enthusiast
Enthusiast

Czernobog​ Still I am getting exceed limit 100 error in the following line Smiley Sad

var odataRequest = new vCACCAFEPageOdataRequest(1, 10000, query);

0 Kudos
iiliev
VMware Employee
VMware Employee

balawiz​ Check if the code I posted in the following thread works for you - https://communities.vmware.com/thread/601249

balawiz
Enthusiast
Enthusiast

The above link method helped me. Thank you!

0 Kudos
Czernobog
Expert
Expert

Like iiliev said, you have to loop through every business group and pull all cafe vm objects from it, then concatenate the result in a large array. I have set the paging to 500 objects, so it deviates from the original post. It looks like this for every bg iteration:

var odataRequest = new vCACCAFEPageOdataRequest(1, 500, query);
resources = service.getResourcesList(odataRequest);
vCACCAFEVMs = vCACCAFEVMs.concat(resources);

0 Kudos