Source:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk(Guid storageDomainId, Guid storagePoolId) { List<DiskImage> ovfStoreDiskImages = new ArrayList<>(getAllOVFDisks(storageDomainId, storagePoolId)); if (!ovfStoreDiskImages.isEmpty()) { while (!ovfStoreDiskImages.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RetrieveImageData, new RetrieveImageDataParameters(getParameters().getStoragePoolId(), storageDomainId, ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond()), cloneContextAndDetachFromParent()); getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); if (vdcReturnValue.getSucceeded()) { List<OvfEntityData> returnedMap = OvfUtils.getOvfEntities(vdcReturnValue.getActionReturnValue(), unregisteredDisks, storageDomainId); return returnedMap; } else { log.error("Image data could not be retrieved for disk id '{}' in storage domain id '{}'", ovfDisk.getId(), storageDomainId); } } catch (RuntimeException e) { log.error("Image data could not be retrieved for disk id '{}' in storage domain id '{}': {}", ovfDisk.getId(), storageDomainId, e.getMessage()); log.debug("Exception", e); } ovfStoreDiskImages.remove(ovfDisk); } else { break; } } AuditLogableBase logable = Injector.injectMembers(new AuditLogableBase()); logable.setStorageDomainId(storageDomainId); auditLogDirector.log(logable, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } else { log.warn("There are no OVF_STORE disks on storage domain id {}", storageDomainId); } return new ArrayList<>(); }

Target:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk(Guid storageDomainId, Guid storagePoolId) { List<DiskImage> ovfStoreDiskImages = new ArrayList<>(getAllOVFDisks(storageDomainId, storagePoolId)); if (!ovfStoreDiskImages.isEmpty()) { while (!ovfStoreDiskImages.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RetrieveImageData, new RetrieveImageDataParameters(getParameters().getStoragePoolId(), storageDomainId, ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond()), cloneContextAndDetachFromParent()); getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); if (vdcReturnValue.getSucceeded()) { List<OvfEntityData> returnedMap = OvfUtils.getOvfEntities(vdcReturnValue.getActionReturnValue(), unregisteredDisks, storageDomainId); return returnedMap; } else { log.error("Image data could not be retrieved for disk id '{}' in storage domain id '{}'", ovfDisk.getId(), storageDomainId); } } catch (RuntimeException e) { log.error("Image data could not be retrieved for disk id '{}' in storage domain id '{}': {}", ovfDisk.getId(), storageDomainId, e.getMessage()); log.debug("Exception", e); } ovfStoreDiskImages.remove(ovfDisk); } else { log.error("Couldn't find additional ovf store to retrieve the ovf data from in storage domain '{}'", storageDomainId); break; } } AuditLogableBase logable = Injector.injectMembers(new AuditLogableBase()); logable.setStorageDomainId(storageDomainId); auditLogDirector.log(logable, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } else { log.warn("There are no OVF_STORE disks on storage domain id {}", storageDomainId); } return new ArrayList<>(); }