Search in sources :

Example 1 with ExtendImageTicketVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.ExtendImageTicketVDSCommandParameters in project ovirt-engine by oVirt.

the class TransferImageCommand method extendImageTransferSession.

private boolean extendImageTransferSession(final ImageTransfer entity) {
    if (entity.getImagedTicketId() == null) {
        log.error("Failed to extend image transfer session: no existing session to extend");
        return false;
    }
    long timeout = getHostTicketLifetime();
    Guid resourceId = entity.getImagedTicketId();
    ExtendImageTicketVDSCommandParameters transferCommandParams = new ExtendImageTicketVDSCommandParameters(entity.getVdsId(), entity.getImagedTicketId(), timeout);
    // TODO This is called from doPolling(), we should run it async (runFutureVDSCommand?)
    VDSReturnValue vdsRetVal;
    try {
        vdsRetVal = backend.getResourceManager().runVdsCommand(VDSCommandType.ExtendImageTicket, transferCommandParams);
    } catch (RuntimeException e) {
        log.error("Failed to extend image transfer session for ticket '{}': {}", resourceId.toString(), e);
        return false;
    }
    if (!vdsRetVal.getSucceeded()) {
        log.error("Failed to extend image transfer session");
        return false;
    }
    log.info("Transfer session with ticket id {} extended, timeout {} seconds", resourceId.toString(), timeout);
    setNewSessionExpiration(timeout);
    return true;
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) ExtendImageTicketVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ExtendImageTicketVDSCommandParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

ExtendImageTicketVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.ExtendImageTicketVDSCommandParameters)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1