Ejemplo n.º 1
0
  /**
   * Query all the vms.
   *
   * @throws VCloudException
   */
  public static void QueryAllVMs() throws VCloudException {

    System.out.println("Query All VM's");
    System.out.println("--------------");

    QueryParams<QueryAdminVMField> vmQueryParams = new QueryParams<QueryAdminVMField>();
    vmQueryParams.setPageSize(MAX_PAGE_SIZE);

    RecordResult<QueryResultAdminVMRecordType> vmRecordResult =
        queryService.queryRecords(QueryRecordType.ADMINVM, vmQueryParams);

    while (vmRecordResult.getRecords().size() > 0) {
      displayVms(vmRecordResult);
      try {
        vmRecordResult = vmRecordResult.getNextPage();
      } catch (VCloudException e) {
        break;
      }
    }
    System.out.println("\nTotal No of VM's - " + noOfVms);
  }
Ejemplo n.º 2
0
 /**
  * Display some of the VM's information.
  *
  * @param vmRecordResult
  */
 public static void displayVms(RecordResult<QueryResultAdminVMRecordType> vmRecordResult) {
   for (QueryResultAdminVMRecordType vmRecord : vmRecordResult.getRecords()) {
     noOfVms++;
     System.out.println("VMName : " + vmRecord.getName() + " VMMoref : " + vmRecord.getMoref());
   }
 }