use of dmg.cells.nucleus.CellPath in project dcache by dCache.
the class NfsTransferService method notifyDoorWithRedirect.
public void notifyDoorWithRedirect(NfsMover mover) {
CellPath directDoorPath = new CellPath(mover.getPathToDoor().getDestinationAddress());
final org.dcache.chimera.nfs.v4.xdr.stateid4 legacyStateId = mover.getProtocolInfo().stateId();
_door.notify(directDoorPath, new PoolPassiveIoFileMessage<>(_cellAddress.getCellName(), _localSocketAddresses, legacyStateId, _bootVerifier));
}
use of dmg.cells.nucleus.CellPath in project dcache by dCache.
the class Task method selectPool.
/**
* Returns a pool from the pool list using the pool selection strategy.
*/
private CellPath selectPool() throws NoSuchElementException {
List<PoolManagerPoolInformation> pools = _parameters.poolList.getPools().stream().filter(pool -> !_replicas.contains(pool.getName())).collect(toList());
PoolManagerPoolInformation pool = _parameters.selectionStrategy.select(pools);
if (pool == null) {
if (pools.isEmpty()) {
throw new NoSuchElementException("No pools available.");
}
throw new NoSuchElementException("All target pools are full.");
}
return new CellPath(pool.getName());
}
use of dmg.cells.nucleus.CellPath in project dcache by dCache.
the class XrootdDoor method messageArrived.
/**
* Requests to start movers are processed synchronously by the Transfer class. This message
* handler will only ever receive replies for those requests for which the Transfer class timed
* out or interrupted.
* <p>
* To avoid that orphaned movers fill a transfer slot on the pool, we kill it right away.
*/
public void messageArrived(PoolIoFileMessage message) {
if (message.getReturnCode() == 0) {
String pool = message.getPoolName();
_poolStub.notify(new CellPath(pool), new PoolMoverKillMessage(pool, message.getMoverId(), "door timed out before pool"));
}
}
use of dmg.cells.nucleus.CellPath in project dcache by dCache.
the class FileOperationHandler method handleStaging.
/**
* <p>Called when there are no available replicas, but the file
* can be retrieved from an HSM.</p>
*
* <p>Issues a fire and forget request. Task is considered complete at
* that point.</p>
*
* <p>When staging actually completes on the PoolManager end, the new
* cache location message should be processed by Resilience as a new FileOperation.</p>
*
* <p>Should staging not complete before the pool is once again scanned,
* PoolManager should collapse the repeated staging request.</p>
*/
public void handleStaging(PnfsId pnfsId, ResilientFileTask task) {
try {
FileOperation operation = fileOpMap.getOperation(pnfsId);
FileAttributes attributes = namespace.getRequiredAttributesForStaging(pnfsId);
String poolGroup = poolInfoMap.getGroup(operation.getPoolGroup());
LOGGER.trace("handleStaging {}, pool group {}.", pnfsId, poolGroup);
migrationTaskService.schedule(() -> {
try {
PoolMgrSelectReadPoolMsg msg = new PoolMgrSelectReadPoolMsg(attributes, getProtocolInfo(), null);
msg.setSubject(Subjects.ROOT);
msg.setPoolGroup(poolGroup);
CellMessage cellMessage = new CellMessage(new CellPath(poolManagerAddress), msg);
ACTIVITY_LOGGER.info("Staging {}", pnfsId);
endpoint.sendMessage(cellMessage);
LOGGER.trace("handleStaging, sent select read pool message " + "for {} to poolManager.", pnfsId);
completionHandler.taskCompleted(pnfsId);
} catch (URISyntaxException e) {
completionHandler.taskFailed(pnfsId, CacheExceptionUtils.getCacheException(CacheException.INVALID_ARGS, "could not construct HTTP protocol: %s.", pnfsId, Type.WAIT_FOR_STAGE, e.getMessage(), null));
}
}, 0, TimeUnit.MILLISECONDS);
} catch (CacheException ce) {
completionHandler.taskFailed(pnfsId, ce);
}
}
use of dmg.cells.nucleus.CellPath in project dcache by dCache.
the class FileOperationHandler method handleStagingReply.
/**
* <p>If the reply from the Pool Manager indicates that the file has
* been staged to a pool outside the pool group, resend the message with refreshed attributes to
* trigger a p2p by the Pool Manager to a readable resilient pool in the correct group.
* Otherwise, discard the message.</p>
*/
public void handleStagingReply(PoolMgrSelectReadPoolMsg reply) {
PnfsId pnfsId = reply.getPnfsId();
try {
if (reply.getReturnCode() == CacheException.OUT_OF_DATE) {
FileAttributes attributes = namespace.getRequiredAttributesForStaging(pnfsId);
/*
* Check to see if one of the new locations is not resilient.
*/
Collection<String> locations = attributes.getLocations();
List<String> valid = poolInfoMap.getReadableLocations(locations).stream().filter(poolInfoMap::isResilientPool).collect(Collectors.toList());
LOGGER.trace("{}, handleStagingReply, readable resilience " + "locations are now {}.", valid);
if (valid.size() == 0) {
LOGGER.trace("{}, handleStagingReply, " + "PoolManager staged to" + " a non-resilient pool, " + "requesting p2p.", pnfsId);
/*
* Figure out on which pool group this should be.
*
* It's possible that the file was "resilient" when the
* stage request was sent and a subsequently configuration
* change has resulted in the file no longer being
* "resilient". If this happens, the file may have no
* corresponding resilient pool group.
*
* Another possibility is the lack of resilient pool group
* is due to a bug somewhere.
*/
Integer gIndex = null;
for (String loc : locations) {
Integer pIndex = poolInfoMap.getPoolIndex(loc);
gIndex = poolInfoMap.getResilientPoolGroup(pIndex);
if (gIndex != null) {
break;
}
}
if (gIndex == null) {
LOGGER.warn("{}, handleStagingReply, file no longer" + " hosted on resilient pool group", pnfsId);
return;
}
final String poolGroup = poolInfoMap.getGroup(gIndex);
LOGGER.trace("{}, handleStagingReply, resilient pool group " + "for p2p request: {}.", pnfsId, poolGroup);
migrationTaskService.schedule(() -> {
PoolMgrSelectReadPoolMsg msg = new PoolMgrSelectReadPoolMsg(attributes, reply.getProtocolInfo(), reply.getContext(), reply.getAllowedStates());
msg.setSubject(reply.getSubject());
msg.setPoolGroup(poolGroup);
CellMessage cellMessage = new CellMessage(new CellPath(poolManagerAddress), msg);
ACTIVITY_LOGGER.info("Selecting read pool for file {}" + " staged to a non-resilient pool", pnfsId);
endpoint.sendMessage(cellMessage);
LOGGER.trace("handleStagingReply, resent select read pool " + "message for {} to poolManager.", pnfsId);
}, 0, TimeUnit.MILLISECONDS);
return;
}
}
LOGGER.trace("{} handleStagingReply {}, nothing to do.", pnfsId, reply);
} catch (CacheException ce) {
LOGGER.error("handleStagingReply failed: {}.", ce.toString());
}
}
Aggregations