use of org.ovirt.engine.core.bll.UploadStreamParameters in project ovirt-engine by oVirt.
the class ProcessOvfUpdateForStorageDomainCommand method performOvfUpdateForDomain.
private boolean performOvfUpdateForDomain(byte[] ovfData, StorageDomainOvfInfo storageDomainOvfInfo, DiskImage ovfDisk, List<Guid> vmAndTemplatesIds) {
Guid storagePoolId = ovfDisk.getStoragePoolId();
Guid storageDomainId = ovfDisk.getStorageIds().get(0);
Guid diskId = ovfDisk.getId();
Guid volumeId = ovfDisk.getImageId();
storageDomainOvfInfo.setStoredOvfIds(null);
try {
setOvfVolumeDescription(storagePoolId, storageDomainId, diskId, volumeId, generateOvfStoreDescription(storageDomainOvfInfo.getLastUpdated(), false, null));
storageDomainOvfInfoDao.update(storageDomainOvfInfo);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(ovfData);
Long size = Long.valueOf(ovfData.length);
UploadStreamParameters uploadStreamParameters = new UploadStreamParameters(storagePoolId, storageDomainId, diskId, volumeId, byteArrayInputStream, size);
uploadStreamParameters.setParentCommand(getActionType());
uploadStreamParameters.setParentParameters(getParameters());
uploadStreamParameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
ActionReturnValue actionReturnValue = runInternalActionWithTasksContext(ActionType.UploadStream, uploadStreamParameters);
if (actionReturnValue.getSucceeded()) {
storageDomainOvfInfo.setStatus(StorageDomainOvfInfoStatus.UPDATED);
storageDomainOvfInfo.setStoredOvfIds(vmAndTemplatesIds);
storageDomainOvfInfo.setLastUpdated(updateDate);
setOvfVolumeDescription(storagePoolId, storageDomainId, diskId, volumeId, getPostUpdateOvfStoreDescription(size));
storageDomainOvfInfoDao.update(storageDomainOvfInfo);
return true;
}
} catch (EngineException e) {
log.warn("failed to update domain '{}' ovf store disk '{}'", storageDomainId, diskId);
}
failedOvfDisks.add(diskId);
return false;
}
Aggregations