use of org.ovirt.engine.core.common.businessentities.OvfEntityData in project ovirt-engine by oVirt.
the class GetUnregisteredVmsQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<OvfEntityData> entityList = getOvfEntityList(VmEntityType.VM);
List<VM> vmList = new ArrayList<>();
for (OvfEntityData ovf : entityList) {
try {
VM vm = ovfHelper.readVmFromOvf(ovf.getOvfData()).getVm();
// Setting the rest of the VM attributes which are not in the OVF.
vm.setClusterCompatibilityVersion(ovf.getLowestCompVersion());
vm.setClusterArch(ovf.getArchitecture());
vm.setStatus(ovf.getStatus());
vmList.add(vm);
} catch (OvfReaderException e) {
log.debug("failed to parse a given ovf configuration: \n" + ovf.getOvfData(), e);
getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage());
}
}
getQueryReturnValue().setSucceeded(true);
getQueryReturnValue().setReturnValue(vmList);
}
Aggregations