Search in sources :

Example 1 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class XrootdDoor method getUploadPath.

private FsPath getUploadPath(Subject subject, Restriction restriction, boolean createDir, boolean overwrite, Long size, FsPath path, FsPath rootPath) throws CacheException, InterruptedException {
    try {
        EnumSet<CreateOption> options = EnumSet.noneOf(CreateOption.class);
        if (overwrite) {
            options.add(CreateOption.OVERWRITE_EXISTING);
        }
        if (createDir) {
            options.add(CreateOption.CREATE_PARENTS);
        }
        PnfsCreateUploadPath msg = new PnfsCreateUploadPath(subject, restriction, path, rootPath, size, null, null, null, options);
        msg = _pnfsStub.sendAndWait(msg);
        return msg.getUploadPath();
    } catch (NoRouteToCellException ex) {
        throw new CacheException("Internal communication failure", ex);
    }
}
Also used : PnfsCreateUploadPath(diskCacheV111.vehicles.PnfsCreateUploadPath) FileExistsCacheException(diskCacheV111.util.FileExistsCacheException) CacheException(diskCacheV111.util.CacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) CreateOption(org.dcache.namespace.CreateOption)

Example 2 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class MovePinRequestProcessor method messageArrived.

public PinManagerMovePinMessage messageArrived(PinManagerMovePinMessage message) throws CacheException, InterruptedException {
    try {
        PnfsId pnfsId = message.getPnfsId();
        String source = message.getSourcePool();
        String target = message.getTargetPool();
        Collection<Pin> pins = _dao.get(_dao.where().pnfsId(pnfsId).pool(source));
        /* Remove all stale sticky flags.
             */
        for (StickyRecord record : message.getRecords()) {
            if (!containsPin(pins, record.owner())) {
                setSticky(source, pnfsId, false, record.owner(), 0);
            }
        }
        /* Move all pins to the target pool.
             */
        for (Pin pin : pins) {
            Pin tmpPin = move(pin, target, pin.getExpirationTime());
            setSticky(tmpPin.getPool(), tmpPin.getPnfsId(), false, tmpPin.getSticky(), 0);
            _dao.delete(tmpPin);
        }
        LOGGER.info("Moved pins for {} from {} to {}", pnfsId, source, target);
    } catch (NoRouteToCellException e) {
        throw new CacheException("Failed to move pin due to communication failure: " + e.getDestinationPath(), e);
    }
    return message;
}
Also used : StickyRecord(org.dcache.pool.repository.StickyRecord) Pin(org.dcache.pinmanager.model.Pin) CacheException(diskCacheV111.util.CacheException) InvalidMessageCacheException(diskCacheV111.util.InvalidMessageCacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) PnfsId(diskCacheV111.util.PnfsId) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException)

Example 3 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class DCacheAwareJdbcFs method listPins.

@Override
public List<PinInfo> listPins(FsInode inode) throws ChimeraFsException {
    PnfsId pnfsid = new PnfsId(inode.getId());
    PinManagerListPinsMessage request = new PinManagerListPinsMessage(pnfsid);
    Subject subject = getSubjectFromContext();
    request.setSubject(subject);
    try {
        return pinManagerStub.sendAndWait(request).getInfo().stream().map(DcachePinInfo::new).collect(Collectors.toList());
    } catch (NoRouteToCellException | InterruptedException | CacheException e) {
        throw new InvalidArgumentChimeraException(e.getMessage());
    }
}
Also used : CacheException(diskCacheV111.util.CacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) PnfsId(diskCacheV111.util.PnfsId) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) PinManagerListPinsMessage(org.dcache.pinmanager.PinManagerListPinsMessage) Subject(javax.security.auth.Subject)

Example 4 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class DCacheAwareJdbcFs method unpin.

/**
 * This method sends a request to the pin manager to unpin a given file.
 */
@Override
public void unpin(FsInode inode) throws ChimeraFsException {
    PinManagerUnpinMessage message = new PinManagerUnpinMessage(new PnfsId(inode.getId()));
    Subject subject = getSubjectFromContext();
    message.setSubject(subject);
    try {
        message.setRequestId(getRequestId(subject));
        pinManagerStub.sendAndWait(message);
    } catch (PermissionDeniedCacheException e) {
        /* Trigger returning NFSERR_PERM back to client.  The Linux kernel
             * should convert this to an EPERM response.
             */
        throw new PermissionDeniedChimeraFsException(e.getMessage(), e);
    } catch (NoRouteToCellException | InterruptedException | CacheException e) {
        /* We "notify" the client that there was a problem unpinning the
             * the file by returning NFSERR_INVAL back to the client.  The Linux
             * kernel should convert this to an EINVAL response.
             */
        throw new InvalidArgumentChimeraException(e.getMessage(), e);
    }
}
Also used : PinManagerUnpinMessage(org.dcache.pinmanager.PinManagerUnpinMessage) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) CacheException(diskCacheV111.util.CacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) PnfsId(diskCacheV111.util.PnfsId) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) Subject(javax.security.auth.Subject)

Example 5 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class DiskCleaner method cleanPoolComplete.

/**
 * cleanPoolComplete delete all files from the pool 'poolName' found in the trash-table for this
 * pool
 *
 * @param poolName name of the pool
 */
void cleanPoolComplete(final String poolName) throws InterruptedException, CacheException, NoRouteToCellException {
    LOGGER.trace("CleanPoolComplete(): poolname={}", poolName);
    try {
        List<String> files = new ArrayList<>(_processAtOnce);
        Timestamp graceTime = Timestamp.from(Instant.now().minusSeconds(_gracePeriod.getSeconds()));
        String lastSeenIpnfsid = "";
        int removed = 0;
        while (true) {
            _db.query("SELECT ipnfsid FROM t_locationinfo_trash WHERE ilocation=? AND itype=1 AND ictime<? AND ipnfsid>? ORDER BY ipnfsid ASC LIMIT ?", rs -> {
                files.add(rs.getString("ipnfsid"));
            }, poolName, graceTime, lastSeenIpnfsid, _processAtOnce);
            if (files.isEmpty()) {
                break;
            }
            lastSeenIpnfsid = files.get(files.size() - 1);
            removed += sendRemoveToPoolCleaner(poolName, files);
            files.clear();
        }
        LOGGER.info("Removed {} files from pool {} deleted before {}", removed, poolName, graceTime);
    } catch (UncheckedExecutionException e) {
        throwIfInstanceOf(e.getCause(), InterruptedException.class);
        throwIfInstanceOf(e.getCause(), CacheException.class);
        throwIfInstanceOf(e.getCause(), NoRouteToCellException.class);
        throw new RuntimeException(e.getCause());
    }
}
Also used : UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) CacheException(diskCacheV111.util.CacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) ArrayList(java.util.ArrayList) Timestamp(java.sql.Timestamp)

Aggregations

NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)67 CacheException (diskCacheV111.util.CacheException)55 TimeoutCacheException (diskCacheV111.util.TimeoutCacheException)25 PermissionDeniedCacheException (diskCacheV111.util.PermissionDeniedCacheException)22 FileNotFoundCacheException (diskCacheV111.util.FileNotFoundCacheException)19 ArrayList (java.util.ArrayList)15 ApiOperation (io.swagger.annotations.ApiOperation)14 ApiResponses (io.swagger.annotations.ApiResponses)14 Produces (javax.ws.rs.Produces)14 BadRequestException (javax.ws.rs.BadRequestException)13 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)13 Path (javax.ws.rs.Path)13 CellPath (dmg.cells.nucleus.CellPath)11 ExecutionException (java.util.concurrent.ExecutionException)11 ForbiddenException (javax.ws.rs.ForbiddenException)11 GET (javax.ws.rs.GET)11 FsPath (diskCacheV111.util.FsPath)10 PnfsId (diskCacheV111.util.PnfsId)10 SRMException (org.dcache.srm.SRMException)10 SRMInternalErrorException (org.dcache.srm.SRMInternalErrorException)10