Search in sources :

Example 1 with Pool

use of diskCacheV111.poolManager.Pool in project dcache by dCache.

the class NFSv41Door method getDeviceInfo.

// NFSv41DeviceManager interface
/*
    	The most important calls is LAYOUTGET, OPEN, CLOSE, LAYOUTRETURN
    	The READ, WRITE and  COMMIT goes to storage device.

    	We assume the following mapping between nfs and dcache:

    	     NFS     |  dCache
    	_____________|________________________________________
    	LAYOUTGET    : get pool, bind the answer to the client
    	OPEN         : send IO request to the pool
    	CLOSE        : sent end-of-IO to the pool, LAYOUTRECALL
    	LAYOUTRETURN : unbind pool from client

     */
@Override
public device_addr4 getDeviceInfo(CompoundContext context, GETDEVICEINFO4args args) throws ChimeraNFSException {
    layouttype4 layoutType = layouttype4.valueOf(args.gdia_layout_type);
    LayoutDriver layoutDriver = getLayoutDriver(layoutType);
    PoolDS ds = _poolDeviceMap.getByDeviceId(args.gdia_device_id);
    if (ds == null) {
        return null;
    }
    // limit addresses returned to client to the same 'type' as clients own address
    // NOTICE: according to rfc1918 we allow access to private networks from public ip address
    // Site must take care that private IP space is not visible to site external clients.
    InetAddress clientAddress = context.getRemoteSocketAddress().getAddress();
    InetSocketAddress[] usableAddresses = Stream.of(ds.getDeviceAddr()).filter(a -> !a.getAddress().isLoopbackAddress() || clientAddress.isLoopbackAddress()).filter(a -> !a.getAddress().isLinkLocalAddress() || clientAddress.isLinkLocalAddress()).filter(a -> clientAddress.getAddress().length >= a.getAddress().getAddress().length).toArray(InetSocketAddress[]::new);
    return layoutDriver.getDeviceAddress(usableAddresses);
}
Also used : org.dcache.nfs.v4.xdr.layouttype4(org.dcache.nfs.v4.xdr.layouttype4) CreateMode(org.apache.zookeeper.CreateMode) DoorTransferFinishedMessage(diskCacheV111.vehicles.DoorTransferFinishedMessage) Arrays(java.util.Arrays) GssSessionManager(org.dcache.oncrpc4j.rpc.gss.GssSessionManager) FsInode(org.dcache.chimera.FsInode) Pool(diskCacheV111.vehicles.Pool) Subjects(org.dcache.auth.Subjects) ZonedDateTime(java.time.ZonedDateTime) org.dcache.nfs.v4.ff.flex_files_prot(org.dcache.nfs.v4.ff.flex_files_prot) LAYOUTCOMMIT4args(org.dcache.nfs.v4.xdr.LAYOUTCOMMIT4args) NFS4Client(org.dcache.nfs.v4.NFS4Client) DoorValidateMoverMessage(org.dcache.vehicles.DoorValidateMoverMessage) Autowired(org.springframework.beans.factory.annotation.Autowired) NfsServerV3(org.dcache.nfs.v3.NfsServerV3) PoolMoverKillMessage(diskCacheV111.vehicles.PoolMoverKillMessage) Restrictions(org.dcache.auth.attributes.Restrictions) Command(dmg.util.command.Command) InetAddress(java.net.InetAddress) PnfsHandler(diskCacheV111.util.PnfsHandler) NFS4ProtocolInfo(org.dcache.chimera.nfsv41.mover.NFS4ProtocolInfo) Stat(org.dcache.nfs.vfs.Stat) LayoutUnavailableException(org.dcache.nfs.status.LayoutUnavailableException) Map(java.util.Map) EventNotifier(diskCacheV111.namespace.EventNotifier) LayoutDriver(org.dcache.nfs.v4.LayoutDriver) CDC(dmg.cells.nucleus.CDC) PrintWriter(java.io.PrintWriter) NFSv4Defaults(org.dcache.nfs.v4.NFSv4Defaults) NfsProxyIoFactory(org.dcache.chimera.nfsv41.door.proxy.NfsProxyIoFactory) org.dcache.nfs.v4.xdr.deviceid4(org.dcache.nfs.v4.xdr.deviceid4) EnumMap(java.util.EnumMap) Set(java.util.Set) GuardedBy(javax.annotation.concurrent.GuardedBy) org.dcache.nfs.v4.xdr.layout4(org.dcache.nfs.v4.xdr.layout4) StandardCharsets(java.nio.charset.StandardCharsets) ZoneId(java.time.ZoneId) Executors(java.util.concurrent.Executors) Serializable(java.io.Serializable) ClientCB(org.dcache.nfs.v4.ClientCB) Stream(java.util.stream.Stream) LAYOUTGET4args(org.dcache.nfs.v4.xdr.LAYOUTGET4args) AbstractCellComponent(dmg.cells.nucleus.AbstractCellComponent) LoginBrokerPublisher(dmg.cells.services.login.LoginBrokerPublisher) org.dcache.nfs.v3.xdr.nfs3_prot(org.dcache.nfs.v3.xdr.nfs3_prot) AlarmMarkerFactory(org.dcache.alarms.AlarmMarkerFactory) org.dcache.nfs.v4.ff.ff_layoutreturn4(org.dcache.nfs.v4.ff.ff_layoutreturn4) PredefinedAlarm(org.dcache.alarms.PredefinedAlarm) FsInodeType(org.dcache.chimera.FsInodeType) Callable(java.util.concurrent.Callable) IoDoorInfo(diskCacheV111.vehicles.IoDoorInfo) OptionalLong(java.util.OptionalLong) CellStub(org.dcache.cells.CellStub) TransferRetryPolicy.alwaysRetry(org.dcache.util.TransferRetryPolicy.alwaysRetry) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) org.dcache.nfs.v4.xdr.layoutiomode4(org.dcache.nfs.v4.xdr.layoutiomode4) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) PermException(org.dcache.nfs.status.PermException) PnfsId(diskCacheV111.util.PnfsId) BaseEncoding(com.google.common.io.BaseEncoding) PoolPassiveIoFileMessage(diskCacheV111.vehicles.PoolPassiveIoFileMessage) DelayException(org.dcache.nfs.status.DelayException) Glob(org.dcache.util.Glob) IOException(java.io.IOException) NFSv41DeviceManager(org.dcache.nfs.v4.NFSv41DeviceManager) ExecutionException(java.util.concurrent.ExecutionException) org.dcache.nfs.v4.xdr.nfs_fh4(org.dcache.nfs.v4.xdr.nfs_fh4) NDC(org.dcache.util.NDC) Layout(org.dcache.nfs.v4.Layout) FileAttribute(org.dcache.namespace.FileAttribute) TransferRetryPolicy(org.dcache.util.TransferRetryPolicy) LAYOUTERROR4args(org.dcache.nfs.v4.xdr.LAYOUTERROR4args) ProxyIoFactory(org.dcache.chimera.nfsv41.door.proxy.ProxyIoFactory) ByteUnit(org.dcache.util.ByteUnit) VirtualFileSystem(org.dcache.nfs.vfs.VirtualFileSystem) Assumptions(org.dcache.pool.assumption.Assumptions) Stateids(org.dcache.nfs.v4.Stateids) org.dcache.nfs.v4.xdr.clientid4(org.dcache.nfs.v4.xdr.clientid4) Transfer(org.dcache.util.Transfer) LoggerFactory(org.slf4j.LoggerFactory) TimeoutException(java.util.concurrent.TimeoutException) InterProcessSemaphoreMutex(org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex) org.dcache.nfs.v4.xdr.layoutreturn_type4(org.dcache.nfs.v4.xdr.layoutreturn_type4) ZKPaths(org.apache.curator.utils.ZKPaths) NFSv41Session(org.dcache.nfs.v4.NFSv41Session) org.dcache.nfs.v4.xdr.length4(org.dcache.nfs.v4.xdr.length4) org.dcache.nfs.v4.xdr.offset4(org.dcache.nfs.v4.xdr.offset4) PoolStatusChangedMessage(diskCacheV111.vehicles.PoolStatusChangedMessage) PoolManagerStub(org.dcache.poolmanager.PoolManagerStub) VfsCache(org.dcache.nfs.vfs.VfsCache) org.dcache.nfs.v4.xdr.stateid4(org.dcache.nfs.v4.xdr.stateid4) NoMatchingLayoutException(org.dcache.nfs.status.NoMatchingLayoutException) FileAttributes(org.dcache.vehicles.FileAttributes) CellMessageReceiver(dmg.cells.nucleus.CellMessageReceiver) CommandException(dmg.util.CommandException) Predicate(java.util.function.Predicate) org.dcache.nfs.v3.xdr.mount_prot(org.dcache.nfs.v3.xdr.mount_prot) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) InetAddressMatcher(org.dcache.nfs.InetAddressMatcher) GETDEVICEINFO4args(org.dcache.nfs.v4.xdr.GETDEVICEINFO4args) CellCommandListener(dmg.cells.nucleus.CellCommandListener) Instant(java.time.Instant) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) NFSv4StateHandler(org.dcache.nfs.v4.NFSv4StateHandler) Sets(com.google.common.collect.Sets) Objects(java.util.Objects) JdbcFs(org.dcache.chimera.JdbcFs) List(java.util.List) CuratorFramework(org.apache.curator.framework.CuratorFramework) org.dcache.nfs.v4.ff.ff_ioerr4(org.dcache.nfs.v4.ff.ff_ioerr4) UnknownLayoutTypeException(org.dcache.nfs.status.UnknownLayoutTypeException) CompoundContext(org.dcache.nfs.v4.CompoundContext) NFS4State(org.dcache.nfs.v4.NFS4State) org.dcache.nfs.v4.xdr.nfs_opnum4(org.dcache.nfs.v4.xdr.nfs_opnum4) Optional(java.util.Optional) DoorRequestInfoMessage(diskCacheV111.vehicles.DoorRequestInfoMessage) ChimeraFsException(org.dcache.chimera.ChimeraFsException) CellPath(dmg.cells.nucleus.CellPath) StaleException(org.dcache.nfs.status.StaleException) NfsV41FileLayoutDriver(org.dcache.nfs.v4.NfsV41FileLayoutDriver) Argument(dmg.util.command.Argument) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) CellInfoProvider(dmg.cells.nucleus.CellInfoProvider) org.dcache.nfs.v4.xdr.device_error4(org.dcache.nfs.v4.xdr.device_error4) ExceptionUtils.asNfsException(org.dcache.chimera.nfsv41.door.ExceptionUtils.asNfsException) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) VfsCacheConfig(org.dcache.nfs.vfs.VfsCacheConfig) CellAddressCore(dmg.cells.nucleus.CellAddressCore) IoDoorEntry(diskCacheV111.vehicles.IoDoorEntry) BadStateidException(org.dcache.nfs.status.BadStateidException) AtomicReference(java.util.concurrent.atomic.AtomicReference) NfsIoException(org.dcache.nfs.status.NfsIoException) FlexFileLayoutDriver(org.dcache.nfs.v4.FlexFileLayoutDriver) LoginManagerChildrenInfo(dmg.cells.services.login.LoginManagerChildrenInfo) org.dcache.nfs.nfsstat(org.dcache.nfs.nfsstat) CacheException(diskCacheV111.util.CacheException) ChimeraNFSException(org.dcache.nfs.ChimeraNFSException) KafkaTemplate(org.springframework.kafka.core.KafkaTemplate) LAYOUTRETURN4args(org.dcache.nfs.v4.xdr.LAYOUTRETURN4args) CDCScheduledExecutorServiceDecorator(org.dcache.util.CDCScheduledExecutorServiceDecorator) org.dcache.nfs.v4.xdr.utf8str_mixed(org.dcache.nfs.v4.xdr.utf8str_mixed) ExportFile(org.dcache.nfs.ExportFile) BadLayoutException(org.dcache.nfs.status.BadLayoutException) OncRpcSvcBuilder(org.dcache.oncrpc4j.rpc.OncRpcSvcBuilder) ExecutorService(java.util.concurrent.ExecutorService) Inode(org.dcache.nfs.vfs.Inode) CuratorFrameworkAware(org.dcache.cells.CuratorFrameworkAware) ClientRecoveryStore(org.dcache.nfs.v4.ClientRecoveryStore) Logger(org.slf4j.Logger) FireAndForgetTask(org.dcache.util.FireAndForgetTask) RedirectedTransfer(org.dcache.util.RedirectedTransfer) StatsDecoratedOperationExecutor(org.dcache.chimera.nfsv41.common.StatsDecoratedOperationExecutor) LAYOUTSTATS4args(org.dcache.nfs.v4.xdr.LAYOUTSTATS4args) RequestExecutionTimeGauges(org.dcache.commons.stats.RequestExecutionTimeGauges) MountServer(org.dcache.nfs.v3.MountServer) CostException(org.dcache.poolmanager.CostException) FileNotInCacheException(diskCacheV111.util.FileNotInCacheException) Subject(javax.security.auth.Subject) OncRpcProgram(org.dcache.oncrpc4j.rpc.OncRpcProgram) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) org.dcache.nfs.v4.xdr.nfs4_prot(org.dcache.nfs.v4.xdr.nfs4_prot) Collectors.toList(java.util.stream.Collectors.toList) org.dcache.nfs.v4.xdr.device_addr4(org.dcache.nfs.v4.xdr.device_addr4) PoolMonitor(org.dcache.poolmanager.PoolMonitor) OncRpcSvc(org.dcache.oncrpc4j.rpc.OncRpcSvc) CommandException.checkCommand(dmg.util.CommandException.checkCommand) Option(dmg.util.command.Option) DateTimeFormatter(java.time.format.DateTimeFormatter) ServerFaultException(org.dcache.nfs.status.ServerFaultException) GETDEVICELIST4args(org.dcache.nfs.v4.xdr.GETDEVICELIST4args) org.dcache.nfs.v4.xdr.layouttype4(org.dcache.nfs.v4.xdr.layouttype4) Required(org.springframework.beans.factory.annotation.Required) FsExport(org.dcache.nfs.FsExport) Collections(java.util.Collections) LayoutTryLaterException(org.dcache.nfs.status.LayoutTryLaterException) NFSServerV41(org.dcache.nfs.v4.NFSServerV41) InetSocketAddress(java.net.InetSocketAddress) LayoutDriver(org.dcache.nfs.v4.LayoutDriver) NfsV41FileLayoutDriver(org.dcache.nfs.v4.NfsV41FileLayoutDriver) FlexFileLayoutDriver(org.dcache.nfs.v4.FlexFileLayoutDriver) InetAddress(java.net.InetAddress)

Example 2 with Pool

use of diskCacheV111.poolManager.Pool in project dcache by dCache.

the class RemoteHttpDataTransferProtocol method verifyRemoteFile.

private void verifyRemoteFile(RemoteHttpDataTransferProtocolInfo info) throws ThirdPartyTransferFailedCacheException {
    FileAttributes attributes = _channel.getFileAttributes();
    boolean isFirstAttempt = true;
    long t_max = maxRetryDuration(attributes.getSize());
    long deadline = System.currentTimeMillis() + t_max;
    try {
        while (System.currentTimeMillis() < deadline) {
            long sleepFor = Math.min(deadline - System.currentTimeMillis(), DELAY_BETWEEN_REQUESTS);
            if (!isFirstAttempt && sleepFor > 0) {
                Thread.sleep(sleepFor);
            }
            isFirstAttempt = false;
            HttpClientContext context = storeContext(new HttpClientContext());
            HttpHead head = buildHeadRequest(info, deadline);
            buildWantDigest().ifPresent(v -> head.addHeader("Want-Digest", v));
            try {
                try (CloseableHttpResponse response = _client.execute(head, context)) {
                    StatusLine status = response.getStatusLine();
                    if (status.getStatusCode() >= 300) {
                        checkThirdPartyTransferSuccessful(!info.isVerificationRequired(), "rejected HEAD: %d %s", status.getStatusCode(), status.getReasonPhrase());
                        return;
                    }
                    if (shouldRetry(response)) {
                        continue;
                    }
                    OptionalLong contentLengthHeader = contentLength(response);
                    if (contentLengthHeader.isPresent()) {
                        long contentLength = contentLengthHeader.getAsLong();
                        long fileSize = attributes.getSize();
                        checkThirdPartyTransferSuccessful(contentLength == fileSize, "HEAD Content-Length (%d) does not match file size (%d)", contentLength, fileSize);
                    } else {
                        LOGGER.debug("HEAD response did not contain Content-Length");
                    }
                    String rfc3230 = headerValue(response, "Digest");
                    checkChecksums(info, rfc3230, attributes.getChecksumsIfPresent());
                    return;
                } catch (IOException e) {
                    throw new ThirdPartyTransferFailedCacheException("failed to " + "connect to server: " + e.toString(), e);
                }
            } catch (ThirdPartyTransferFailedCacheException e) {
                List<URI> redirections = context.getRedirectLocations();
                if (redirections != null && !redirections.isEmpty()) {
                    throw new ThirdPartyTransferFailedCacheException(e.getMessage() + "; redirections " + redirections, e.getCause());
                } else {
                    throw e;
                }
            }
        }
    } catch (InterruptedException e) {
        throw new ThirdPartyTransferFailedCacheException("pool is shutting down", e);
    }
    throw new ThirdPartyTransferFailedCacheException("remote server failed " + "to provide length after " + describeDuration(GET_RETRY_DURATION, MILLISECONDS));
}
Also used : HttpClientContext(org.apache.http.client.protocol.HttpClientContext) IOException(java.io.IOException) HttpHead(org.apache.http.client.methods.HttpHead) ThirdPartyTransferFailedCacheException(diskCacheV111.util.ThirdPartyTransferFailedCacheException) StatusLine(org.apache.http.StatusLine) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) OptionalLong(java.util.OptionalLong) List(java.util.List) ArrayList(java.util.ArrayList) FileAttributes(org.dcache.vehicles.FileAttributes)

Example 3 with Pool

use of diskCacheV111.poolManager.Pool in project dcache by dCache.

the class RemoteHttpDataTransferProtocol method receiveFile.

private void receiveFile(final RemoteHttpDataTransferProtocolInfo info) throws ThirdPartyTransferFailedCacheException {
    Set<Checksum> checksums;
    long deadline = System.currentTimeMillis() + GET_RETRY_DURATION;
    HttpClientContext context = storeContext(new HttpClientContext());
    try {
        try (CloseableHttpResponse response = doGet(info, context, deadline)) {
            String rfc3230 = headerValue(response, "Digest");
            checksums = Checksums.decodeRfc3230(rfc3230);
            checksums.forEach(_integrityChecker);
            HttpEntity entity = response.getEntity();
            if (entity == null) {
                throw new ThirdPartyTransferFailedCacheException("GET response contains no content");
            }
            long length = entity.getContentLength();
            if (length > 0) {
                _channel.truncate(length);
            }
            if (response.getStatusLine() != null && response.getStatusLine().getStatusCode() < 300 && length > -1) {
                _expectedTransferSize = length;
            }
            entity.writeTo(Channels.newOutputStream(_channel));
        } catch (SocketTimeoutException e) {
            String message = "socket timeout on GET (received " + describeSize(_channel.getBytesTransferred()) + " of data; " + describeSize(e.bytesTransferred) + " pending)";
            if (e.getMessage() != null) {
                message += ": " + e.getMessage();
            }
            throw new ThirdPartyTransferFailedCacheException(message, e);
        } catch (IOException e) {
            throw new ThirdPartyTransferFailedCacheException(messageOrClassName(e), e);
        } catch (InterruptedException e) {
            throw new ThirdPartyTransferFailedCacheException("pool is shutting down", e);
        }
    } catch (ThirdPartyTransferFailedCacheException e) {
        List<URI> redirections = context.getRedirectLocations();
        if (redirections != null && !redirections.isEmpty()) {
            StringBuilder message = new StringBuilder(e.getMessage());
            message.append("; redirects ").append(redirections);
            throw new ThirdPartyTransferFailedCacheException(message.toString(), e.getCause());
        } else {
            throw e;
        }
    }
    // HEAD requests.
    if (checksums.isEmpty() && info.isVerificationRequired()) {
        HttpHead head = buildHeadRequest(info, deadline);
        head.addHeader("Want-Digest", WANT_DIGEST_VALUE);
        try {
            try (CloseableHttpResponse response = _client.execute(head)) {
                String rfc3230 = headerValue(response, "Digest");
                checkThirdPartyTransferSuccessful(rfc3230 != null, "no checksums in HEAD response");
                checksums = Checksums.decodeRfc3230(rfc3230);
                checkThirdPartyTransferSuccessful(!checksums.isEmpty(), "no useful checksums in HEAD response: %s", rfc3230);
                // Ensure integrety.  If we're lucky, this won't trigger
                // rescanning the uploaded file.
                checksums.forEach(_integrityChecker);
            }
        } catch (IOException e) {
            throw new ThirdPartyTransferFailedCacheException("HEAD request failed: " + messageOrClassName(e), e);
        }
    }
}
Also used : HttpEntity(org.apache.http.HttpEntity) HttpClientContext(org.apache.http.client.protocol.HttpClientContext) IOException(java.io.IOException) HttpHead(org.apache.http.client.methods.HttpHead) ThirdPartyTransferFailedCacheException(diskCacheV111.util.ThirdPartyTransferFailedCacheException) SocketTimeoutException(java.net.SocketTimeoutException) Checksum(org.dcache.util.Checksum) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) List(java.util.List) ArrayList(java.util.ArrayList)

Example 4 with Pool

use of diskCacheV111.poolManager.Pool in project dcache by dCache.

the class ConsistentReplicaStore method get.

/**
 * Retrieves a CacheRepositoryEntry from the wrapped meta data store. If the entry is missing or
 * fails consistency checks, the entry is reconstructed with information from PNFS.
 */
@Override
public ReplicaRecord get(PnfsId id) throws IllegalArgumentException, CacheException {
    ReplicaRecord entry = _replicaStore.get(id);
    if (entry != null && isBroken(entry)) {
        LOGGER.warn("Recovering {}...", id);
        try {
            /* It is safe to remove FROM_STORE/FROM_POOL replicas: We have
                 * another copy anyway. Files in REMOVED or DESTROYED
                 * were about to be deleted, so we can finish the job.
                 */
            switch(entry.getState()) {
                case FROM_POOL:
                case FROM_STORE:
                case REMOVED:
                case DESTROYED:
                    _replicaStore.remove(id);
                    _pnfsHandler.clearCacheLocation(id);
                    LOGGER.info("Recovering: Removed {} because it was not fully staged.", id);
                    return null;
            }
            entry = rebuildEntry(entry);
        } catch (IOException e) {
            throw new DiskErrorCacheException("I/O error in healer: " + messageOrClassName(e), e);
        } catch (FileNotFoundCacheException e) {
            _replicaStore.remove(id);
            LOGGER.warn("Recovering: Removed {} because name space entry was deleted.", id);
            return null;
        } catch (FileIsNewCacheException e) {
            _replicaStore.remove(id);
            LOGGER.warn("Recovering: Removed {}: {}", id, e.getMessage());
            return null;
        } catch (TimeoutCacheException e) {
            throw e;
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new CacheException("Pool is shutting down", e);
        } catch (CacheException | NoSuchAlgorithmException e) {
            entry.update("Failed to recover replica: " + e.getMessage(), r -> r.setState(ReplicaState.BROKEN));
            LOGGER.error(AlarmMarkerFactory.getMarker(PredefinedAlarm.BROKEN_FILE, id.toString(), _poolName), "Marked {} bad: {}.", id, e.getMessage());
        }
    }
    return entry;
}
Also used : AlarmMarkerFactory(org.dcache.alarms.AlarmMarkerFactory) ReplicaStatePolicy(org.dcache.pool.classic.ReplicaStatePolicy) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) AccessLatency(diskCacheV111.util.AccessLatency) PredefinedAlarm(org.dcache.alarms.PredefinedAlarm) LoggerFactory(org.slf4j.LoggerFactory) Exceptions.messageOrClassName(org.dcache.util.Exceptions.messageOrClassName) DiskErrorCacheException(diskCacheV111.util.DiskErrorCacheException) RETENTION_POLICY(org.dcache.namespace.FileAttribute.RETENTION_POLICY) PnfsHandler(diskCacheV111.util.PnfsHandler) CacheException(diskCacheV111.util.CacheException) Iterables.concat(com.google.common.collect.Iterables.concat) SIZE(org.dcache.namespace.FileAttribute.SIZE) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) EnumSet(java.util.EnumSet) ChecksumModule(org.dcache.pool.classic.ChecksumModule) FileAttributes(org.dcache.vehicles.FileAttributes) STORAGEINFO(org.dcache.namespace.FileAttribute.STORAGEINFO) PnfsId(diskCacheV111.util.PnfsId) Logger(org.slf4j.Logger) OpenOption(java.nio.file.OpenOption) LOCATIONS(org.dcache.namespace.FileAttribute.LOCATIONS) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) Set(java.util.Set) IOException(java.io.IOException) Sets(com.google.common.collect.Sets) Checksum(org.dcache.util.Checksum) List(java.util.List) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) FileAttribute(org.dcache.namespace.FileAttribute) Collections(java.util.Collections) ACCESS_LATENCY(org.dcache.namespace.FileAttribute.ACCESS_LATENCY) CHECKSUM(org.dcache.namespace.FileAttribute.CHECKSUM) RetentionPolicy(diskCacheV111.util.RetentionPolicy) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) DiskErrorCacheException(diskCacheV111.util.DiskErrorCacheException) CacheException(diskCacheV111.util.CacheException) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) DiskErrorCacheException(diskCacheV111.util.DiskErrorCacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Example 5 with Pool

use of diskCacheV111.poolManager.Pool in project dcache by dCache.

the class NettyTransferService method startServer.

/**
 * Start netty server.
 *
 * @throws IOException Starting the server failed
 */
protected synchronized void startServer() throws IOException {
    if (serverChannel == null) {
        ServerBootstrap bootstrap = new ServerBootstrap().group(acceptGroup, socketGroup).channel(NioServerSocketChannel.class).childOption(ChannelOption.TCP_NODELAY, false).childOption(ChannelOption.SO_KEEPALIVE, true).childHandler(new ChannelInitializer<Channel>() {

            @Override
            protected void initChannel(Channel ch) throws Exception {
                NettyTransferService.this.initChannel(ch);
                ChannelCdcSessionHandlerWrapper.bindSessionToChannel(ch, "pool:" + address + ":" + name + ":" + ch.id());
            }
        });
        serverChannel = portRange.bind(bootstrap);
        lastServerAddress = (InetSocketAddress) serverChannel.localAddress();
        LOGGER.debug("Started {} on {}", getClass().getSimpleName(), lastServerAddress);
    }
}
Also used : NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) Channel(io.netty.channel.Channel) ServerBootstrap(io.netty.bootstrap.ServerBootstrap) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) CacheException(diskCacheV111.util.CacheException) IOException(java.io.IOException)

Aggregations

CacheException (diskCacheV111.util.CacheException)75 FileAttributes (org.dcache.vehicles.FileAttributes)49 PnfsId (diskCacheV111.util.PnfsId)48 Test (org.junit.Test)46 CellPath (dmg.cells.nucleus.CellPath)38 PoolV2Mode (diskCacheV111.pools.PoolV2Mode)33 FileNotFoundCacheException (diskCacheV111.util.FileNotFoundCacheException)25 ArrayList (java.util.ArrayList)24 PoolCostInfo (diskCacheV111.pools.PoolCostInfo)23 TimeoutCacheException (diskCacheV111.util.TimeoutCacheException)22 IOException (java.io.IOException)22 NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)20 List (java.util.List)18 PoolPreferenceLevel (diskCacheV111.poolManager.PoolPreferenceLevel)17 PermissionDeniedCacheException (diskCacheV111.util.PermissionDeniedCacheException)15 FileAttribute (org.dcache.namespace.FileAttribute)15 CellAddressCore (dmg.cells.nucleus.CellAddressCore)14 CellMessage (dmg.cells.nucleus.CellMessage)14 Map (java.util.Map)14 CellEndpoint (dmg.cells.nucleus.CellEndpoint)12