/**
   * Generate a string containing the given VM's configuration.
   *
   * @param vm The VM to generate configuration from.
   * @return A String containing the VM configuration.
   */
  protected String generateVmConfiguration(VM vm) {
    if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) {
      vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId()));
    }

    if (StringHelper.isNullOrEmpty(vm.getvmt_name())) {
      VmTemplate t = getVmTemplateDao().get(vm.getvmt_guid());
      vm.setvmt_name(t.getname());
    }

    RefObject<String> tempRefObject = new RefObject<String>("");
    new OvfManager()
        .ExportVm(
            tempRefObject, vm, new ArrayList<DiskImage>(getDiskImageDao().getAllForVm(vm.getId())));
    return tempRefObject.argvalue;
  }
Exemple #2
0
 @Override
 public int compare(VmTemplate x, VmTemplate y) {
   return x.getname().compareTo(y.getname());
 }