use of org.ovirt.engine.core.common.businessentities.storage.ImageTicketInformation in project ovirt-engine by oVirt.
the class GetImageTicketVDSCommand method parseImageTicketInformationReturn.
private ImageTicketInformation parseImageTicketInformationReturn() {
ImageTicketInformation ticketInfo = new ImageTicketInformation();
Map<String, Object> ticketInfoMap = imageTicketInformationReturn.getImageTicketInformation();
if (ticketInfoMap.containsKey(UUID)) {
ticketInfo.setId(Guid.createGuidFromString((String) ticketInfoMap.get(UUID)));
}
if (ticketInfoMap.containsKey(SIZE)) {
ticketInfo.setSize(((Number) ticketInfoMap.get(SIZE)).longValue());
}
if (ticketInfoMap.containsKey(URL)) {
ticketInfo.setUrl((String) ticketInfoMap.get(URL));
}
if (ticketInfoMap.containsKey(TIMEOUT)) {
ticketInfo.setTimeout((Integer) ticketInfoMap.get(TIMEOUT));
}
if (ticketInfoMap.containsKey(OPS)) {
List<TransferType> transferTypes = Stream.of((Object[]) ticketInfoMap.get(OPS)).map(String.class::cast).map(TransferType::getTransferType).collect(Collectors.toList());
ticketInfo.setTransferTypes(transferTypes);
}
if (ticketInfoMap.containsKey(FILENAME)) {
ticketInfo.setFileName((String) ticketInfoMap.get(FILENAME));
}
if (ticketInfoMap.containsKey(ACTIVE)) {
ticketInfo.setActive((Boolean) ticketInfoMap.get(ACTIVE));
}
if (ticketInfoMap.containsKey(TRANSFERRED)) {
ticketInfo.setTransferred(((Number) ticketInfoMap.get(TRANSFERRED)).longValue());
}
return ticketInfo;
}
use of org.ovirt.engine.core.common.businessentities.storage.ImageTicketInformation in project ovirt-engine by oVirt.
the class TransferImageCommand method pollTransferStatus.
private void pollTransferStatus(final StateContext context) {
if (context.entity.getVdsId() == null || context.entity.getImagedTicketId() == null || !FeatureSupported.getImageTicketSupported(vdsDao.get(context.entity.getVdsId()).getClusterCompatibilityVersion())) {
// Old engines update the transfer status in UploadImageHandler::updateBytesSent.
return;
}
ImageTicketInformation ticketInfo;
try {
ticketInfo = (ImageTicketInformation) runVdsCommand(VDSCommandType.GetImageTicket, new GetImageTicketVDSCommandParameters(context.entity.getVdsId(), context.entity.getImagedTicketId())).getReturnValue();
} catch (EngineException e) {
log.error("Could not get image ticket '{}' from vdsm", context.entity.getImagedTicketId(), e);
updateEntityPhaseToPausedBySystem(AuditLogType.TRANSFER_IMAGE_PAUSED_BY_SYSTEM_MISSING_TICKET);
return;
}
ImageTransfer upToDateImageTransfer = updateTransferStatusWithTicketInformation(context.entity, ticketInfo);
if (getParameters().getTransferType() == TransferType.Download) {
finalizeDownloadIfNecessary(context, upToDateImageTransfer);
}
}
Aggregations