VMware Cloud Community

VCD Query Service not returning all records

I am trying to get a list of all vAppTemplateNames from my VCD host using the query service.

I have over 280 vApp Templates in VCD that are visible in the VCD plugin inventory in VCO. When I query VCD via the query service I only get back 82 records. My code is below. 

Any reason the query service would return a subset and not full result set? Could it be a permissions issue, even though the plugin has all the vAppTemplates in the inventory? Is there something simple I am missing.

Input: vdc, type = vCloud:vdc

  1. var vcdHost = vdc.getHost(); 
  2. var queryService = vcdHost.getQueryService(); 
  3. var expression = new VclExpression(VclQueryVAppTemplateField.NAME, "*", VclExpressionType.EQUALS); 
  4. var filter = new VclFilter(expression); 
  5. var params = new VclQueryParams(); 
  6. params.setFilter(filter); 
  7. var resultSet = queryService.queryRecords(VclQueryRecordType.VAPPTEMPLATE, params); 
  8. var vAppTemplateNames = new Array(); 
  9. System.log("Total Result: "+ resultSet.getTotal()); 
  10. while (resultSet != null)  { 
  11.     var records = resultSet.getRecords(new VclQueryResultVAppTemplateRecord()); 
  12.     for each (var record in records) { 
  13.         vAppTemplateNames.push(record.name); 
  14.         System.log("TemplateName: "+ record.name); 
  15.     } 
  16.     resultSet = resultSet.getNextPage(); 
  17. return vAppTemplateNames.sort(); 


0 Kudos
0 Replies