Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/source/AdministratorGuide/Resources/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DIRAC provides an abstraction of a SE interface that allows to access different
# The name of the DIRAC Plugin module to be used for implementation
# of the access protocol
PluginName = SRM2
# Flag specifying the access type (local/remote)
# Flag specifying the access type (local/remote/remoteonly)
Access = remote
# Protocol name
Protocol = srm
Expand Down Expand Up @@ -50,6 +50,7 @@ Configuration options are:
* ``UseCatalogURL``: default ``False``. If ``True``, use the url stored in the catalog instead of regenerating it
* ``ChecksumType``: default ``ADLER32``. NOT ACTIVE !
* ``Alias``: when set to the name of another storage element, it instanciates the other SE instead.
* ``Access``: Can be ``local``, ``remote`` or ``remoteonly``. Options specify that the protocol can be used in local (e.g. upload from a WN to local SE), remote+local or remote context.
* ``ReadAccess``: default ``True``. Allowed for Read if no RSS enabled (:ref:`activateRSS`)
* ``WriteAccess``: default ``True``. Allowed for Write if no RSS enabled
* ``CheckAccess``: default ``True``. Allowed for Check if no RSS enabled
Expand Down
8 changes: 8 additions & 0 deletions src/DIRAC/Resources/Storage/StorageElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,10 @@ def __filterPlugins(self, methodName, protocols=None, inputProtocol=None):
# Determine whether to use this storage object
pluginParameters = plugin.getParameters()
isProxyPlugin = pluginParameters.get("PluginName") == "Proxy"
try:
isRemoteOnly = pluginParameters.get("Access").lower() == "remoteonly"
except AttributeError:
isRemoteOnly = False

if not pluginParameters:
log.debug("Failed to get storage parameters.", f"{self.name} {protocolSection}")
Expand All @@ -1167,6 +1171,10 @@ def __filterPlugins(self, methodName, protocols=None, inputProtocol=None):
log.debug(f"Plugin {protocolSection} not allowed for {methodName}.")
continue

# If protocol is remote only and the context is local, skip it.
if isRemoteOnly and localSE:
continue

# If we are attempting a putFile and we know the inputProtocol
if methodName == "putFile" and inputProtocol:
if inputProtocol not in pluginParameters["InputProtocols"]:
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/Resources/Storage/StorageFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,14 @@ def _getConfigStorageProtocols(self, storageName, derivedStorageName=None, seCon
for protocolSectionName, protocolDict in self.protocols.items():
# Now update the local and remote protocol lists.
# A warning will be given if the Access option is not set to local or remote.
if protocolDict["Access"].lower() == "remote":
if protocolDict["Access"].lower() in ("remote", "remoteonly"):
self.remoteProtocolSections.append(protocolSectionName)
elif protocolDict["Access"].lower() == "local":
self.localProtocolSections.append(protocolSectionName)
else:
errStr = (
"StorageFactory.__getProtocolDetails: The 'Access' option \
for %s:%s is neither 'local' or 'remote'."
for %s:%s is not 'local', 'remote' or 'remoteonly'."
% (storageName, protocolSectionName)
)
gLogger.warn(errStr)
Expand Down
Loading